REGEXP_REPLACE - replace '\n''s inside a xml string

I have this xml string and i need to replace the '\n' for one # but only the \n's inside the tag's not the first \n how do that with REGEXP_REPLACE?
<?xml version="1.0" encoding="UTF-8"?>\n
<ipb>
<address>Rua são Joao\n
Bragança
</address>
<calendar>
1º Semestre:\n
Início: 21/09/2009\n
Fim: 19/02/2010\n
Pausa Natal: de 21/12/2009 a 03/01/2010\n
\n
2º Semestre:\n
Início: 22/02/2010\n
Fim: 16/07/2010\n
</calendar>

Well, i'm no regular expression master, but no one's responded so i'll venture an answer (not using regular expression though).
ME_XE?with data as
select
'<?xml version="1.0" encoding="UTF-8"?>\n
<ipb>
<address>Rua são Joao\n
Bragança
</address>
<calendar>
1º Semestre:\n
Início: 21/09/2009\n
Fim: 19/02/2010\n
Pausa Natal: de 21/12/2009 a 03/01/2010\n
\n
2º Semestre:\n
Início: 22/02/2010\n
Fim: 16/07/2010\n
</calendar>' as col1 from dual
select
  replace(replace(replace(col1, '>\n', '~*~'), '\n', NULL), '~*~', '>\n') as new_col1
from data;
NEW_COL1
<?xml version="1.0" encoding="UTF-8"?>\n
<ipb>
<address>Rua s??o Joao
Bragan??a
</address>
<calendar>
1?? Semestre:
In??cio: 21/09/2009
Fim: 19/02/2010
Pausa Natal: de 21/12/2009 a 03/01/2010
2?? Semestre:
In??cio: 22/02/2010
Fim: 16/07/2010
</calendar>
1 row selected.
Elapsed: 00:00:00.17
ME_XE?Just used the regular replace to decode the instances of \n you want to keep (using a string you're not likely to find in your source data) and then replaced all the \n's with null, then put back the /n replacing the string we subbed in before.
If Michaels is around, maybe you'll get a flashy XML answer to your question ... sorry, but i'm not that much flash :)

Similar Messages

  • Parsing xml string does not see the dtd inside jar

    Hello,
    I have problem parsing an XML string because the DTD file is not found (my DTD file is located inside my application's jar file). I am trying to instruct the parser where the DTD is located. If my DTD would have been on the filesystem directlly things would be working just fine, but i need to keep the DTD inside my JAR.
    String dtdLocation = ClassLoader.getSystemResource("mydtd.dtd").toURI().toString();
    Document xmlDocument = builder.parse(new ByteArrayInputStream(xmlFile.getBytes()),dtdLocation);The XML string looks something like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE Properties SYSTEM "mydtd.dtd">
    <Properties>
    <Prop>val<Prop>
    </Properties>

    >
    Hi,
    Don't resurrect old threads, and why on earth did you resurrect 5 threads? I'm locking the zombie threads. Create a new thread if you have a specific question.
    Kaj

  • Problem in parsing a xml string using dom parser

    i want to parse a Xml String using a Dom parser......the parse function in dom parser takes only input stream as argument.......so i made the code as
    InputStream inputstream = new StringBufferInputStream(XmlData) ;
    InputSource inputSource = new InputSource(inputstream );
    but saxexception is coming and also warning called
    "java.io.StringBufferInputStream in java.io has been deprecated"
    please help me.........

    i want to parse a Xml String using a Dom
    parser......the parse function in dom parser takes
    only input stream as argument.......This is not true of the DOM parser in Java 1.4. So you might want to get rid of your old parser and replace it by something more current. Or perhaps you are using 1.4 and you just didn't read all of the API docs.

  • How to get an XML string store in CLOB or LONG column ?

    How to get an XML string store in CLOB or LONG column ?
    We use XSU with the following command
    String str = qry.getXMLString();
    but all the "<" are replace by "&lt;"
    It's impossible to parse the result for XSLT transformation
    Thank's for your help
    Denis Calvayrac
    Example :
    in the column "TT_NAME"
    "<name><firstname>aaa</<firstname><lastname>bbb</lastname></name>
    I want this result
    <TT_NAME>
    <name>
    <firstname>aaa</firstname>
    <lastname>bbb</lastname>
    </name>
    </TT_NAME>
    but, I have this result
    <TT_NAME>
    &lt;name&gt;
    &lt;firstname&gt;aaa&lt;/firstname&gt;
    &lt;lastname&gt;bbb&lt;/lastname&gt;
    &lt;/name&gt;
    </TT_NAME>

    Can you post some of your code, so I can take a look ?
    Thanks

  • Usage of the xml string get from xsql

    I can retrieve a string of xml from database like:
    <rowset>
    <row num="1">
    <xml_string>
    <test>value1</test><test>value2</test>
    </xml_string>
    </row>
    </rowset>
    whereas xml_string is the fieldname and under <xml_string> is the field value.
    Question is I cannot refer to the value of the string as xml in my stylesheet. How can I treat that string as part of my whole xml document generated by xsql?
    Any help is great!

    Ah.. I've just find another related issue.
    For the included xsql page, I find that if I include the stylesheet as type="text/xsl" just like the "document" example, the multibyte characters will become "???".
    However, if I change the type="xml", those multibyte characters will appear correctly.
    The only different inside the xml is that if I use type="xml", the following line will be added to the xml document:
    <?xml version="1.0" ?>
    Anyway, should I use
    <?xml-stylesheet type="xml" href="my_stylesheet.xsl"?>
    instead of
    <?xml-stylesheet type="text/xsl" href="my_stylesheet.xsl"?>
    And the thing is, I'm waiting for newer version of xsql parser to upgrade and hope my existing xsql code still works in the future.
    Thanks for any advice.

  • OWSM: it's possible manipulate a xml string date with a policies ?

    Hello,
    It's the first time that i use the OWSM. The objecties of my project is reuse a old webservice deploy in the old application. The authentication of websercice is inside the structure string xml type. For example any service are the follow soap structure:
    <n:getInformation>
    <data xsi:type="xs:string">..................</data>
    </n:getInformation>
    The type string the data is based on the xsd schema rules where among other there is the authentication info (user and pwd)
    <authentication>
    <user>hello<user>
    <password>xxx<password>
    <inputdata>
    <inputdata>
    My question is : It's possible create an agent or gateway policy without affect the webservice ? I wish manipulate a xml string type and add with a policy a xml data authentication information......
    Thanks in advance.

    Yeah you can certainly do that, but I can tell you that OWSM is not right place to do this.
    - You can create custom step and get hold on the entire payload and change
    - You can create XSLT to do the transformation from old to new.
    HTH,
    Chintan

  • Parsing XML Strings

    I am getting an XML String from a web-service.. Is there a method inside of BPM to parse this xml string?

    Hi, my xml string is:-
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns2:Exception xmlns:ns2="http://example.com/" >
         <errorCode>0</errorCode>
         <errorSubcode>0</errorSubcode>
         <message>Connection refused</message>
         <messageWithProperties>Connection refused
         Error Code=[0]
         ticketId=[1]
         fileName=[testFile]
    </messageWithProperties>
         <properties>
              <name>Error Code</name>
              <value>0</value>
         </properties>
         <properties>
              <name>ticketId</name>
              <value>1</value>
         </properties>
         <properties>
              <name>fileName</name>
              <value>testFile</value>
         </properties>
         <propertiesAsString>     Error Code=[0]
         ticketId=[1]
         fileName=[testFile]
    </propertiesAsString>
    </ns2:Exception>
    I wanted to parse through it and get the errorCode....
    I am using :-
    xmlObject.load(xmlText : xmlContent);
    xmlMessage = xmlObject.selectString(xpath : "/ns2/errorCode");
    But this doesn't seem to work..
    Any idea?

  • Inserting XML String into Table with help of Stored Proc

    I will be getting XML String from JAVA, which I have to insert in Table A, XML String is as follows
    <?xml version = '1.0'?>
    < TableA>
    <mappings Record="3">
    < MESSAGEID >1</ MESSAGEID >
    < MESSAGE >This  is available at your address!</ MESSAGE>
    </mappings>
    <mappings Record="3">
    < MESSAGEID >2</ MESSAGEID>
    < MESSAGE >This isn’t available at your address. </ MESSAGE>
    </mappings>
    </ TableA >
    Table Structure*
    MESSAGEID     VARCHAR2(15 BYTE)
    MESSAGE     VARCHAR2(500 BYTE)
    This is the stored procedure which I have written to insert data into TableA, V_MESSAGE will be input parameter for inserting XML String 
    create or replace procedure   AP_DBI_PS_MESSAGE_INSERT
    V_MESSAGE VARCHAR2(1024)
    AS
    declare
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    V_FILEHANDLE UTL_FILE.FILE_TYPE;
    begin
    -- the name of the table as specified in our DTD
    xmlgen.setRowsetTag('TableA');
    -- the name of the data set as specified in our DTD
    xmlgen.setRowTag('mappings');
    -- for getting the output on the screen
    dbms_output.enable(1000000);
    -- open the XML document in read only mode
    v_FileHandle := utl_file.fopen(V_MESSAGE);
    --v_FileHandle := V_MESSAGE;
    loop
    BEGIN
    utl_file.get_line(v_FileHandle, charString);
    exception
    when no_data_found then
    utl_file.fclose(v_FileHandle);
    exit;
    END;
    dbms_output.put_line(charString);
    if finalStr is not null then
    finalStr := finalStr || charString;
    else
    finalStr := charString;
    end if;
    end loop;
    -- for inserting the XML data into the table
    rowsp := xmlgen.insertXML('ONE.TableA',finalStr);
    dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
    xmlgen.resetOptions;
    end;Please Help
    Edited by: 846857 on Jul 18, 2011 10:55 PM

    with t as (select xmltype('<TableA >
                               <mappings Record="3">
                               <MessageId>1</MessageId>
                               <Message> This bundle is available at your address!</Message>
                               </mappings>
                               <mappings Record="3">
                               <MessageId>2</MessageId>
                               <Message>This isn’t available at your address. </Message>
                               </mappings>
                               </TableA  >') col FROM dual)
      --End Of sample data creation with subquery factoring.
      --You can use the query from here with your table and column name.
    select EXTRACTVALUE(X1.column_value,'/mappings/MessageId') MESSAGEID
          ,EXTRACTVALUE(X1.column_value,'/mappings/Message') MESSAGE
    from t,table(XMLSEQUENCE(extract(t.COL,'/TableA/mappings'))) X1;Above Code works as i get result
    MESSAGEID     MESSAGE
    1             This bundle is available at your address!
    2             This isn’t available at your address.
    _____________________________________________ now I want to insert the result into Table A... How to proceed... Please help
    Edited by: 846857 on Jul 19, 2011 12:15 AM

  • Open XML string in browser

    Requirement : From my webdynpro screen, I want to open a xml string in a browser.
    I have some data in the form of an xml string in my program. On clicking a button in the webdynpro screen, I want to show this string in a separate window (in a browser), properly formatted like an xml document.
    Any pointers on how to achieve this???
    regards,
    Priyank

    Hello, Priyank,
    Have you tried something like this:
      DATA: xml_source   TYPE        string,
            xml_xsource  TYPE        xstring,
            lr_conv      type ref to cl_abap_conv_out_ce.
      xml_source = '<xml source here>'.   " Your XML is inside xml_source variable
      lr_conv = cl_abap_conv_out_ce=>create( ).
      lr_conv->convert( exporting data = xml_source
                        importing buffer = xml_xsource ).
      cl_wd_runtime_services=>attach_file_to_response( i_filename      = 'File.xml'
                                                       i_content       = xml_xsource
                                                       i_mime_type     = 'application/xhtml+xml'
                                                       i_in_new_window = 'X'
                                                       i_inplace       = 'X' ).
    Hope this helps.
    Regards,
    Andre

  • How to convert  information of a job posting into a xml string or file

    hi hr experts,
    I hope to find some answers.
    Is there a function in the ERP system that converts all the information of a job posting into a xml string or file?
    This could be used to communicate with external job databases, e.g. monster or jobpilot.
    The function CALL TRANSFORMATION converts data to XML. Is this really the only way to convert the job posting?
    Thanks for your feedback and help.
    Ralf von Seht
    Edited by: Ralf von Seht on Mar 26, 2008 4:45 PM
    Edited by: Ralf von Seht on Mar 26, 2008 4:46 PM

    Hi Elena,
    The issue is caused by XSLT is not script enabled by default.  Please provide XsltSettings in the loading to fix the issue. For more information, please see:
    http://daomingworks.wordpress.com/2009/12/11/xslt-transform-data-error-use-the-xsltsettings-enablescript-property-to-enable-it/
    Thanks,
    Jinchun Chen
    Jinchun Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)

  • Is there a way to execute a procedure referenced in an XML string?

    The XML string can contain a stand-alone procedure/function or one within a package. The procedure/functions themselves may contain any number of inputs or outputs for procedures. I'm not sure how the procedure that will process this XML string will "know" the datatypes for the IN/OUT parameters for any given stored program. Does Oracle have any built-in mechanism that will execute stored procs in an XML, or would I have to write something that loops through the XML, extracting the proc names, parameters, and parameter values, then query the data dictionary for what type of OUT parameter data type should be used?
    I am told that SQL*Server is able to execute procs reference in XML, so I'm assuming Oracle must have some sort of API to use as a gateway for executing a procedure.

    Hi ,
    Open your edgeProject/index_edgeActions.js.Replace the following with single line comment. Open in edge animate 2014 and publish again. Published content will work
             /*================================================================================
             change Q number to match breakers || Q should = breakers +1 to account for 0 value if no BK0 exists
                     |    |
                     |    |
                     |    |                   DOUBLE CHECK BECAUSE OF BK0
                     |    |
                     |    |
                     |    |
                   __|    |__
             ================================================================================*/
    Like this.
             //================================================================================
             //change Q number to match breakers || Q should = breakers +1 to account for 0 value if no BK0 exists
             //        |    |
             //        |    |
             //        |    |                   DOUBLE CHECK BECAUSE OF BK0
             //        |    |
             //        |    |
             //        |    |
             //      __|    |__
             //================================================================================

  • Converting SQL Server text field containing XML string to XI XML via JDBC

    Hello
    My client has a SQL Server database containing a field of type Text which contains an XML string e.g.
    <DispatchJob> <DispatchDateTime>2003-09-29T13:29:15</DispatchDateTime> <AssignedFSE>F118</AssignedFSE> <DispatchJobPurchase> <DealerID>14C5</DealerID> <DateOfPurchase>1997-10-01T00:00:00</DateOfPurchase> </DispatchJob>
    I am using JDBC to access this but could someone please recommend the best and easiest solution for converting this string to XI XML for subsequent mapping to BAPI or IDOC or ABAP Proxy and transmission to SAP. There are other fields as well in the database table so thoughts at the moment are to use a normal graphical message mapping followed by an XSL mapping. Will an XSL mapping be able to do this and if so is that the best solution?
    Also I need to do the reverse of this and take fields coming from SAP via BAPI,IDOC etc. and convert them to a single database table field as an XML string also via the JDBC adapter. What is the best way to do this. Could it be done simply with functions in the graphical mapping e.g. concatenate?
    Thank you in advance.
    Trevor

    Hi Michal
    Thanks for the prompt reply.
    I was anticipating XSLT for reading from the SQL Server database and converting the XML string.
    But how would you convert the individual fields from SAP into a single field as an XML string for storing in the SQL Server database? What approach would you use?
    Regards
    Trevor

  • Performance problem submitting big XML string parameter to the web service

    We deployed a web service on the OC4J via oracle.j2ee.ws.StatelessJavaRpcWebService . This web service takes one string as a parameter. The string contains XML. Evrything works great UNLESS input XML string reaches 5Mb in size. When it happens OC4J does something with it for about 10 minutes (yes, minutes) before it calls the web service method. At this time java.exe consumes 100% of CPU.
    WE tried to increase JVM heap size, stack size, etc, - no effect.
    Please, help!
    Thank you in advance,
    Vlad.

    Hi Sheldon,
    What i feel is that it's not been handled in your webservice if the parameter is null or "" <blank> space
    i just you to take care in webservice that if the parameter is null or "" pass the parameter null to the stored proc
    Regards
    Pavan

  • How can i read XML string in a loop???

    i changed xml file reader to xml string reader by
    looking around this and other forums.
    here is the code.
    public class XMLTester2 {
        public static void main(String[] args) {
            String s = "<firsttag><secondtag>123</secondtag></firsttag>";
            java.io.Reader reader = new java.io.StringReader(s);
            org.xml.sax.InputSource source = new org.xml.sax.InputSource(reader);
            org.w3c.dom.Document doc = null;
            javax.xml.parsers.DocumentBuilderFactory fact = javax.xml.parsers.DocumentBuilderFactory.newInstance();
            try {
                javax.xml.parsers.DocumentBuilder builder = fact.newDocumentBuilder();
                doc = builder.parse(source);
            } catch (javax.xml.parsers.ParserConfigurationException pce) {
            } catch (org.xml.sax.SAXException se) {
            } catch (java.io.IOException ioe) {
            } finally {
                try {
                    reader.close();
                } catch (java.io.IOException ignored) {
    }i put this stuff into a loop, but i always ends up
    having new in the loop.
                String inputLine = "Start";
                // define what's needed for XML messages
                Reader reader = new StringReader(inputLine);
                InputSource source = new InputSource(reader);
                Document doc = null;
                DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = null;
                Node xmlNode = null;
                try {
                    builder = fact.newDocumentBuilder();
                } catch (ParserConfigurationException pce) {
                // -->
                while ( (inputLine = in.readLine()) != null) {
                    System.out.println("readLine() : {" + inputLine + "}");
                    reader = new StringReader(inputLine);
                    source.setCharacterStream(reader);
                    try {
                        doc = builder.parse(source);
                    } catch (SAXException se) {
                        System.out.println("SAXException : " + se);
                        System.out.println("SAXException source : " + source.toString() );
                        se.printStackTrace();
                    } catch (IOException ioe) {
                        System.out.println("IOException : " + ioe);
                    } finally {
                        try {
                            reader.close();
                        } catch (IOException ignored) {
                    reader = null;i know putting new in the loop is VERY bad.
    i gotto get ride of this new from the loop.
    can anyone help me?

    i know putting new in the loop is VERY bad.
    i gotto get ride of this new from the loop.Don't design your application based on one-liners you heard somewhere. Do some timings to see if it matters. My guess would be that parsing an XML file would take a fair bit longer than creating a StringReader object. And you do need a new StringReader each time, they aren't reusable, so the alternatives are not obvious. And don't accept my guess about the timings, check it for yourself.

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

Maybe you are looking for

  • Install XP on Satellite 2410

    A friend asked me to do a clean install of XP Pro on his Satellite laptop.  He does not have the original installation disks.  His Windows Product Key is for XP Professional, so I used my own XP Pro disk for the install.  When it gets to inserting th

  • Shambles: why am I trying to come back to BT?

    One year ago I moved house. I decided to go with BT for my phone and broadband. It was a disaster and despite two attempts at ordering, I ended up cancelling and going with the Post Office. One year on and I decide to come back to BT again. I make an

  • Authentication on an IDSM-2?

    I have a requirement to have Authentication on our network devices using RSA Secure tokens or restrict it's mgmt interface from the network. So far I am using AAA through the ACS to accomplish this but I can find nothing about AAA for the IDSM-2. Doe

  • BTDF - Web services deployment (Orch publishing as WCF service)

    I wanted to include my WCF published Orch deployed  in btdf.proj way. (BTDF 6.0) I followed the instructions by adding :  and set Virtual Directory to True When I deploy it, receiving error as : error : The VDirList ItemGroup is no longer supported. 

  • Calling css and js file in webcenter portal template

    Hi All, I stored all js and css file in wcc.I want to invoke css and js file in webcenter portal template .How can i invoke by direct link? First question, to get the direct link for the css file in webcenter content