CDATA sections converted to text nodes by XMLDOM parser

I have done a lot of reading, experimentation and openned a TAR on this. I am suprised nobody else has posted on the issue. The xmlparser.parseClob call appears to parse an XML document properly but converts CDATA sections into text nodes.
For example take the following XML:
<some><pnode><![CDATA[the <xml>]]></pnode></some>
If I immediately write it back out using xmldom.writeToClob the resulting XML will be:
<some>
<pnode>the &amp;#60;xml></pnode>
</some>
For one I wish writeToClob wouldn't add whitespace (but that's another issue), but as you can see the CDATA node no longer exists, being replaced by an encoded text node.
I wrote code to traverse the DOM outputting node types and even writing a similar printer to the writeToClob. The fact is there really is no CDATA node in the DOM after parsing. Instead the code which traverses the DOM identifies a single text node with CDATA text contained in it.
In my opinion this is extremely odd default behavior and I cannot seem to work around it due to the fact that the DOM structure is not created properly by the parse. Please tell me that other people have ran into this behavior and I'm not just nuts? Better yet, please just tell me I'm doing something wrong and you have the answer...that would be kinder to my project schedule.
If you like I have example code. I am using the xmldom API on Oracle 9.2.0.4.

Thanks for the response Mark. I have gotten some feedback from my TAR as well. We are using version 9.2.0.*. I have since learned that this is a bug in the xmldom implementation based on Java. It has been recommended that I use the dbms_* packages as you suggested. I originally attempted to use the dbms_* packages (the C-based implementation) when following the tutorials and other documentation but for some reason we do not seem to have those packages installed. I was directed by my DBA's to use the other package as we both bevelieved it was just the same package in a different location. I am working with my DBA to get the C-based dbms_* packages installed.

Similar Messages

  • Xsl output attributes for cdata-section-elements and doctype-system

    I am using an xsl file to transform one xml document to another xml document. I want to use the xsl:output Element to do two things:
    1.Generate CDATA sections for the text contained in an xml element,"Description"
    2. Add the line "<!DOCTYPE PartInformation SYSTEM "part.dtd">
    I am using the following code in the xsl file to do these two things, but it does not seem to be doing anything.
    <xsl:output cdata-section-elements="Description" doctype-system="part.dtd"/>
    Does anybody have any idea what's happening?
    Thanks
    Kishore

    Would you specify the XDK version and supply a simple sample including XML and XSL file?

  • Problems with CDATA sections

    I am loading XML containing a CDATA section into a DOMParser and using getDocument() to obtain an XMLDocument with the loaded XML.
    The input XML contains a CDATA section, but the subsequent XMLDocument no longer has a CDATA section, but now holds the contents of the CDATA section in an XMLText node. How do I maintain the CDATA section when loading into the Parser and XMLDOcument?
    I can create a CDATA secti0on and append this to the same XMLDocument without problem.

    My idea would be to spend some time finding out
    whether it really does.yes, I was thinking about that after posting, so I added to the writeXmlFile method the next lines
            XPath xpath = XPathFactory.newInstance().newXPath();
            String desc = xpath.evaluate("//descripcioAssignatura", doc);
            System.out.println("descripcioAssignatura=>" + desc);The element descripcioAssignatura is really filled with its value, but in the transform method this value disappears. I tryed to put different values for the node name in the line xformer.setOutputProperty(OutputKeys.CDATA_SECTION_ELEMENTS,"descripcioAssignatura");like descripcioAssignatura, /plaDocent/dades/descripcioAssignatura (the real path to the element) or //descripcioAssignatura, but the result is the same
    thanks DrClap

  • Problem retrieving Data from a CDATA-Section using XMLDOM

    Hello,
    Ware: Oracle 8.1.7.4 64bit, XDK for PL/SQL Version 9.2.0.3, Solaris8 64bit
    I can't retrieve Data from the CDATA-Section of an XML-String, neither with
    getData(DOMCharacterData) or substringData. Also getLength fails. I get always
    the following error:
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.ClassCastException
    ORA-06512: at "XML_SCHEMA.XMLCHARDATACOVER", line 0
    ORA-06512: at "XML_SCHEMA.XMLDOM", line 853
    ORA-06512: at "SCHWABE.XML_TEST", line 47
    ORA-06512: at line 1
    I can successfully cast the DOMNode to a CharacterData with makeCharacterData
    and check with isNull (DOMCharacterData) (returns FALSE).
    My Testcase:
    1) A Function which build a XML-Document:
    CREATE OR REPLACE FUNCTION XML_ResponseCalc RETURN VARCHAR2 IS
    doc VARCHAR2(32767);
    BEGIN
    doc :=
    '<?xml version="1.0" encoding="UTF-8"?>
    <RSDecEng>
    <Version>1.00</Version>
    <ResponseCalc>
    <ID>00000000000000000014</ID>
    <Burst>
    <Definition>
    <Count>1</Count>
    <ID>
    <Start>1</Start>
    <Length>4</Length>
    </ID>
    <Var>
    <Name>Risiko_1</Name>
    <Start>5</Start>
    <Length>5</Length>
    </Var>
    </Definition>
    <Data>
    <Length>9</Length>
    <Count>5</Count>
    <![CDATA[
    1 0.001
    2 0.002
    3 0.003
    4 0.004
    5 0.005
    6 0.006
    7 0.007
    8 0.008
    9 0.009
    10 0.010
    ]]>
    </Data>
    </Burst>
    </ResponseCalc>
    </RSDecEng>
    2) The Procedure which parses the XML-Document (no Exception-Handling):
    CREATE OR REPLACE PROCEDURE XML_TEST IS
    Parser XML_SCHEMA.XMLParser.Parser;
    DOMDocument XML_SCHEMA.XMLDOM.DOMDocument;
    DOMNode XML_SCHEMA.XMLDOM.DOMNode;
    DOMNodeItem XML_SCHEMA.XMLDOM.DOMNode;
    DOMNodeList XML_SCHEMA.XMLDOM.DOMNodeList;
    DOMCharacterData XML_SCHEMA.XMLDOM.DOMCharacterData;
    TheDocument CLOB;
    ID VARCHAR2(100);
    Data VARCHAR2(200);
    BEGIN
    -- LOB
    DBMS_LOB.CREATETEMPORARY(TheDocument, TRUE);
    DBMS_LOB.WRITEAPPEND(TheDocument, LENGTH(XML_ResponseCalc), XML_ResponseCalc);
    -- Parse
    Parser := XML_SCHEMA.XMLParser.NewParser;
    XML_SCHEMA.XMLParser.ParseCLOB(Parser, TheDocument);
    DOMDocument := XML_SCHEMA.XMLParser.GetDocument(Parser);
    XML_SCHEMA.XMLParser.FreeParser(Parser);
    -- Node
    DOMNode := XML_SCHEMA.XMLDOM.MakeNode(DOMDocument);
    -- Get ID
    DOMNodeList := XML_SCHEMA.XSLProcessor.SelectNodes
    (DOMNode,'/RSDecEng/ResponseCalc/ID/text()');
    IF XML_SCHEMA.XMLDOM.GetLength(DOMNodeList) > 0 THEN
    DOMNodeItem := XML_SCHEMA.XMLDOM.Item(DOMNodeList, 0);
    XML_SCHEMA.XMLDOM.WriteToBuffer(DOMNodeItem, ID);
    SYS.DBMS_OUTPUT.PUT_LINE ('ID: '||ID);
    END IF;
    -- Get CDATA
    DOMCharacterData := XML_SCHEMA.XMLDOM.MakeCharacterData(DomNode); -- <-- ok here...
    IF NOT XML_SCHEMA.XMLDOM.isNull (DOMCharacterData) THEN -- <-- ...and here
    Data := XML_SCHEMA.XMLDOM.GETDATA(DOMCharacterData); -- <-- ...but here Exception raise
    END IF;
    END;
    I hope you can help me.
    Thank you in advance
    Markus Schwabe

    You need to notice the definitions for makecharacterdata:
    FUNCTION makeCharacterData(n DOMNode) RETURN DOMCharacterData;
    PURPOSE
    Casts given DOMNode to a DOMCharacterData
    It only do the casting.

  • XML parser fails to convert html encoded text nodes

    Under the strain of large documents this defect rears its ugly head more often. While parsing a text node containing html encoded chars i.e. < > &; etc...
    The parser will seemingly forget to change the chars at random, 99.9% of the time everything is ok and the proper conversions take place:
    < -> &#60;
    > -> >
    &; -> &#38;
    Once an error occurs it is reproducible until the text node is changed ( values and/or order ) then it is a crapshoot again.
    These tests were done using the default UTF-8 encoding, here is the exception thrown by the parser along with a portion of the text node before and after the first parsing.
    Let me be clear, the parser actually succeeds the first time but the transformation of the HTML encoded pieces possibly fails. It is on the parsing of the text node value as its own document that the parser fails.
    Error 0 : Error parsing XML string! Line :: 1, Column :: 65674
    Error 1 : End tag does not match start tag 'Project'.
    End tag does not match start tag 'Project'.
    at oracle/xml/parser/v2/XMLError.flushErrors (XMLError.java:233)
    at oracle/xml/parser/v2/NonValidatingParser.parseDocument (NonValidatingParser.java:248)
    at oracle/xml/parser/v2/XMLParser.parse (XMLParser.java:117)
    at pacificedge/xml/XMLUtilities.loadParserFromString (XMLUtilities.java:104)
    Preprocessing ::
    <Project stuff0="0" stuff1="0" stuff2="0" stuff3="1" stuff4="100167" stuff5="100213">
    <StuffA>100213</StuffA>
    <Name>I am a Name</Name>
    <StartDate>1998-08-10</StartDate>
    <FinishDate>2000-06-30</FinishDate>
    <Path>Folder1\Folder2</Path>
    </Project>
    Post processing:
    <Project stuff0="0" stuff1="0" stuff2="0" stuff3="1" stuff4="100167" stuff5="100213">
    <StuffA>100213</StuffA>
    <Name>I am a Name</Name>
    <StartDate>1998-08-10</StartDate> <-- Error is raised here when the value of the text node is used as an xml document
    <FinishDate>2000-06-30</FinishDate>
    <Path>Folder1\Folder2</Path>
    </Project>
    Please investigate this. It is a chronic problem for us and possibly many others.
    null

    Sorry for the encoding issues in the message before here are the pertinent pieces hope this shows up correctly.
    &;lt; -> &;#60;
    &;gt; -> >
    &;amp; -> &;#38;
    Preprocessing ::
    &;lt;Project stuff0="0" stuff1="0" stuff2="0" stuff3="1" stuff4="100167" stuff5="100213"&;gt;
    &;lt;StuffA&;gt;100213&;lt;/StuffA&;gt;
    &;lt;Name&;gt;I am a Name&;lt;/Name&;gt;
    &;lt;StartDate&;gt;1998-08-10&;lt;/StartDate&;gt;
    &;lt;FinishDate&;gt;2000-06-30&;lt;/FinishDate&;gt;
    &;lt;Path&;gt;Folder1\Folder2&;lt;/Path&;gt;
    &;lt;/Project&;gt;
    Post processing:
    <Project stuff0="0" stuff1="0" stuff2="0" stuff3="1" stuff4="100167" stuff5="100213">
    <StuffA>100213</StuffA>
    <Name>I am a Name</Name>
    &;lt;StartDate>1998-08-10</StartDate> <-- Error is raised here when the value of the text node is used as an xml document
    <FinishDate>2000-06-30</FinishDate>
    <Path>Folder1\Folder2</Path>
    </Project>
    null

  • Problem: Storing binary data in Xml Cdata section

    The objective : Tranport image using xml
    1. I convert the image to input stream.
    2. store it in an array.
    3. encode the string using Base64 library and get a string
    4.then i store it in xml CDATA section.
    the code snippet is
    public class ImgToXml01 {
         public static void main(String[] args) throws IOException
              File inputFile = new File("C:\\Arup\\ImgXml\\read\\Sample.jpg");
              FileInputStream in = new FileInputStream(inputFile);
              String str="";
              int c;
              while ((c = in.read()) != -1) {
              str+= ""+c;
              String val = util.Base64.encode(str);
              System.out.println(""+val);
              OutputStream fout = new FileOutputStream("img.xml");
              OutputStreamWriter out = new OutputStreamWriter(fout);
              out.write("<?xml version = \"1.0\" encoding = \"ISO-8859-1\"?>\r\n");
              out.write("<Image>\r\n");
              out.write("[CDATA["+val+"]]");
              //out.write("]]>");
              out.write("</image>\r\n");
              out.close();
    When i retrieve it i write the code:
    import org.xmldb.api.base.*;
    import org.xmldb.api.modules.*;
    import org.xmldb.api.*;
    import org.w3c.dom.*;
    import java.io.*;
    import org.xml.sax.SAXException;
    import oracle.xml.parser.v2.*;
    public class CdataToImage01 {
         public static void main(String[] args) //throws IOException
         try{
         String uri="c:\\Arup\\ImgXml\\img1.xml";
         String data="";      
         File file = new File(uri);
         FileInputStream fis = new FileInputStream(file);
         BufferedInputStream in = new BufferedInputStream(fis);      
         DOMParser parser = new DOMParser();
         parser.parse(in);      
         Document doc = parser.getDocument();
         Node r = doc.getElementsByTagName("Image").item(0);          
         NodeList kids = r.getChildNodes();
         if ( kids != null )     {
              for ( int i = 0; i < kids.getLength(); i++ ) {
                   if ( (kids.item(i).getNodeType() == Node.TEXT_NODE) ||
                             (kids.item(i).getNodeType() == Node.CDATA_SECTION_NODE)) {
                             data=kids.item(i).getNodeValue();
              String data1 = util.Base64.decode(data);
              File outputFile = new File("Sample.jpg");
              FileOutputStream out = new FileOutputStream(outputFile);      
              byte[] buff = data1.getBytes();
              InputStream inn = new ByteArrayInputStream(buff);
              int c;
              System.out.println(buff.length);
              while ((c = inn.read()) != -1) {
              out.write(c);
              inn.close();
              out.close();
         catch (SAXException e) {
              System.err.println(e);
              e.printStackTrace();
         catch (Exception ex){
              System.err.println("Exception occured " + ex.getMessage());
              ex.printStackTrace();
    But i am not getting the appropriate result .I get a corrupted image.
    FROM
    ARUP GHOSH

    String str="";
    int c;
    while ((c = in.read()) != -1) {
    str+= ""+c;
    }Your problem is here.
    Let's suppose you just have a trivial 3-byte file containing the bytes 27, 55, and 126. Your program will convert that into the string "2755126". Then you base-64 encode it, etc etc, then you base-64 decode it and (hopefully) produce the same string "2755126". Converting this string to bytes and writing it to a file produces a 7-byte file containing the bytes 50, 55, 53, 53, 49, 50, and 54. Not the same at all. You could prove this to yourself by putting in some debugging statements.
    I don't know how to suggest a fix because it looks to me as if your base-64 utility takes a String as its input. It should take an array of bytes, or an InputStream.
    PC&#178;

  • Generating CDATA containing XML-like text using XSLT Mapper in OFM 11g

    Hi,
    One of our partners requires XML to be sent as XML string inside a CDATA section. The use of "real" XML is not an option at the moment. We try to generate something like the following using XSLT/XSLT Mapper in SOA Suite 11g:
    <element>
    <![CDATA[
    <supplierElement1>
    <supplierElement2>
    etcetera
    <supplierElement2>
    </supplierElement1>
    ]]>
    </element>
    We've tried the following two approaches, so far unsuccessful:
    <xsl:template match="/">
    <inp1:singleString>
    <inp1:input>
    <xsl:text disable-output-escaping="yes">&lt;![CDATA[test]]&gt;</xsl:text>
    </inp1:input
    </inp1:singleString>
    </xsl:template>
    resulting in:
    <inp1:singleString xmlns:inp1="http://xmlns.oracle.com/singleString">
    <inp1:input>&lt;![CDATA[test]]></inp1:input>
    </inp1:singleString>
    and:
    <xsl:output method="xml" indent="yes" cdata-section-elements="input"/>
    <xsl:template match="/">
    <inp1:singleString>
    <input>test</input>
    </inp1:singleString>
    </xsl:template>
    resulting in:
    <inp1:singleString xmlns:inp1="http://xmlns.oracle.com/singleString" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <input>test</input>
    </inp1:singleString>
    Does anyone know how to generate the CDATA section declaratively (within XSLT/XSLT Mapper), without resorting to custom code and parsing as we have to do now?
    Thanks!
    Ronald

    The exact error message I'm getting is :
    ABAP XML formatting error in XML node of type "element", name: "abap"

  • Confused with CDATA section

    Hi,
    I am confused as to how the DOM tree is formed for the following XML
    <Template>
    <Query>
    <sql name="A">
    <![CDATA[
    SELECT     name from salary where salary >1000;
      ]]>
    </sql>
    <sql name="B">
    <![CDATA[
    SELECT    *            FROM         EMPLOYEES
                WHERE       rownum <= 2;
      ]]>
    </sql>
    </Query>
    </Template>I want to know how the tree for the above XML is formed
    ELEMENT
    --Text
    --CDATA Element
    --Text
    I have used xpath to get a NodeList
    XPATH QUERY => Template/Query/sql
    The NodeList is passed to a function to get the sql query inside CDATA,
    This is the function I wrote
    public static void traverseCData(NodeList rootNode){
    for(int index = 0; index < rootNode.getLength();
    index ++){
    Node aNode = rootNode.item(index);
    printNodeType(aNode);
    if (aNode.getNodeType() == Node.CDATA_SECTION_NODE){
    Node firstChild = aNode.getFirstChild();
    System.out.println("FirstChild => "); printNodeType(firstChild);
    if(firstChild.getNodeType() == Node.TEXT_NODE){
    System.out.println("NodeName " + firstChild.getNodeName());
    System.out.println("Node Value " + firstChild.getNodeValue());
    System.out.println("Text Content " + firstChild.getTextContent());
    traverseCData(aNode.getChildNodes());
    Please clarify
    1) If the DOM tree for the NodeList I have assumed above is right
    2) How do I traverse the CData section above. I actually need to replace the sql query in the CDATA section with a new sql query. Can you please help me how to proceed.
    Thanks
    Kart

    1) If the DOM tree for the NodeList I have assumed above is rightI would suggest a simple test program that just dumps out the DOM structure would be the best way of finding if your assumption is true.

  • How to identify a CDATA section in DOM API?

    I'm having a problem reading a CDATA section from using the DOM API. A call to Node.getNodeType() doesn't return CDATA_SECTION_NODE as expected but returns TEXT_NODE. Also, a call to getValue() doesn't return <![CDATA[<foo>]]> but returns
    <foo> instead. Does anyone know how to get getNodeType() to return the proper value?
    For example suppose I have the following XML:
    <?XML version="1.0"?>
    <document>
    <elm><![CDATA[text with <b>HTML</b>]]></elm>
    </document>
    A call to getNodeType() for the value Node (the child of the <elm> node) returns TEXT_NODE. I would expect it to return CDATA_SECTION_NODE.
    Ken

    C'mon Oracle people -- help me out here,
    Is this a known bug or what? I just discovered that if you do a cloneNode()
    the CDATA section gets messed up, too.
    Ken
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Kenneth Liu ([email protected]):
    I'm having a problem reading a CDATA section from using the DOM API. A call to Node.getNodeType() doesn't return CDATA_SECTION_NODE as expected but returns TEXT_NODE. Also, a call to getValue() doesn't return <![CDATA[<foo>]]> but returns
    <foo> instead. Does anyone know how to get getNodeType() to return the proper value?
    For example suppose I have the following XML:
    <?XML version="1.0"?>
    <document>
    <elm><![CDATA[text with <b>HTML</b>]]></elm>
    </document>
    A call to getNodeType() for the value Node (the child of the <elm> node) returns TEXT_NODE. I would expect it to return CDATA_SECTION_NODE.
    Ken<HR></BLOCKQUOTE>
    null

  • XI File Sender CC, CDATA Sections

    Hello all,
    i configured a File Sender CC with content conversion but the
    integration engine gives me a parser exception because there are characters in the file which are not allowed for a field without CDATA section. Can i configure somewhere that for the content conversion CDATA sections are used ?
    Thx !
    Andreas

    Hi Andreas,
               Yes as the XML parser does not understand "'" char in the FIELD1 string, it gives the following errore. So to do that you need to put the following in CDATA, as the XML parser ignores anuting between CDATA.
    To acheive CDATA you need to implement XSLT mapping.
    Check out this link: <a href="/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping Mapping</a>
    The code mentioned below is relevant to the example in the blog:
    Pls follow the following steps to insert XML string into a single element:
    Create a xsl file with the following data:
    <?xml version='1.0' ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" NSpace>
    <xsl:template match="/">
    <namespace:name1>
    <xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text><xsl:copy-of select="//namespace:name"/><xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
    </namespace:name1>
    </xsl:template>
    </xsl:stylesheet>
    In the above code I have removed xmlns:p2="http://frik.bcc.com.pl" which is not needed.
    Also you have to put '//' before the target element from where you want to start creating XML string over here it is name. And name1 is the element you want to store the XML string in.
    So anything in the element name will be stored in name1
    Regarding the namespace: To find out the namespace test your message mapping between the source and the target without adding XSLT mapping. After testing click on 'SCR' tab present on top of the target window. There you will see ns1: or ns2: attached to each element. Replace namespace in the above code with ns1: or ns2:. And replace NSpace in the above XSL Header with the namespace in the SCR of test map.
    So the final XSL file will look like that:
    <?xml version='1.0' ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="http://sap.com/xi/HR">
    <xsl:template match="/">
    <ns1:name1>
    <xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text><xsl:copy-of select="//ns1:name"/><xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
    </ns1:name1>
    </xsl:template>
    </xsl:stylesheet>
    Dont forget to put '//' before the target element.
    This should work. Or pls put the source and target xml struct and we will assist you further.
    Regards,
    Ashish

  • CreateCDATASection() method doesn't creates a CDATA Section.

    Hi,
    While using Oracle XDK, if I try to create a CDATA Section using createCDATAsection() method, it doen't creates a CDATA Section. Instead it creates a normal Text node. If I try the same code with Apache Xerces, it works fine and I have CDATA section.
    The problem I am facing because, my node data has some special characters and I don't want parser to validate that. Has anyone else faced the same problem or have a work around?
    Any help will be appreciated.
    Thanks,
    Atif

    The double square bracket closing the CDATA section was never a problem. I had issues with LrXml encoding the opening angle bracket as an &lt; entity:
        local xml = LrXml.createXmlBuilder(false)
        xml:beginBlock("var")
        xml:tag("name", "var1")
        xml:beginBlock("value")
        xml:tag("string", "<![CDATA[value123]]>")
        xml:endBlock()
        xml:endBlock()
        local strXML = xml:serialize()
    Produces the following maligned XML:
    <?xml version="1.0"?>
    <var>
    <name>var1</name>
    <value>
    <string>&lt;![CDATA[value123]]></string>
    </value>
    </var>
    I guess one way to go about it is to run serialized XML through string.gsub to un-encode the "&lt;![CDATA[" sequence as follows:
    strXML = string.gsub(strXML, "&lt;!%[CDATA%[", "<![CDATA[")
    This is a nasty workaround, but this appears to be the only way to get the job done. Now my serialized XML looks as expected:
    <?xml version="1.0"?>
    <var>
    <name>var1</name>
    <value>
    <string><![CDATA[value123]]></string>
    </value>
    </var>
    This only leaves me wondering as to why LrXml doesn't support CDATA sections through its API, they are not that uncommon...

  • How do i return a CDATA section in a SOAP response?

    hi,
    i am relatively new to SOAP/web services. but i know what i want ;-). i naively thought that i could simply send a CDATA wrapped string in a SOAP response by simply doing SOAPElement.addTextNode("<![CDATA[..."). of course, WLS 8.1's javax.xml.soap implementation escapes the <pre>"<" & ">"</pre> as <pre>"<" and ">"</pre> in the response.
    IF i could use the saaj 1.2 implementation, i would do something along the lines of the following to return a CDATA section in a SOAP response :
    <pre>  
       org.w3c.dom.CDATASection myCDATASection ...;
       SOAPBodyElement myBodyElement ...;
       myBodyElement.appendChild(myCDATASection);
    </pre>
    or maybe even something like:
    <pre>
       String myCDATAString = "<![CDATA[...]]>";
    javax.xml.soap.SOAPBody soapBody = ...;
    javax.xml.parsers.DocumentBuilder builder = ...;
    org.xml.sax.InputSource.InputSource inputSource = ...;
    org.w3c.dom.Document document = builder.parse(inputSource);
    soapBody.addDocument(document);
    </pre>          
    but that is a BIG IF! of course, as i have learned after a lengthy trawl through this ng, WLS 8.1 uses its own implementation of the javax.xml.soap.* classes. in particular, weblogic's SOAPBody implementation is devoid of an addDocument(org.w3c.dom.Document) method. and SOAPBodyElement does not have an appendChild(org.w3c.dom.Node)
    please, can anybody fill me in on how to go about doing what i am trying to do using WLS 8.1's javax.xml.soap classes?
    many thanks

    if anybody else out there is also trying to do what i have described (return xml text in a soap response), the solution (told to me by my company's BEA rep) is to just add the raw xml text to the SOAPElement.addTextNode() and weblogic will do the right thing (namely, escape whatever needs to be escaped).
    i had been lead to believe that you couldn't send entity refs (<pre>< and ></pre>) in a soap response. i was told i needed to wrap my raw xml in a CDATA section. but actually i don't need a CDATA section after all for the response i need to return (xml text). contrary to what i was lead to believe by another developer, entity refs are not a problem in a soap response (according to BEA, anyway).

  • CDATA section in a tag of an XML file

    Hi SDNers:
    I have an issue with using the method CREATE_CDATA_SECTION of Interface IF_IXML_DOCUMENT.
    I have created an XML file from ABAP using methods in IF_IXML_DOCUMENT etc.
    The XML file is perfectly alright. But now there's a need to add CDATA section.
    I need the CDATA section as follows in XML file...
    <CustomField>
        <![CDATA[
              First Line of Text
              Second line of Text
              Third Line of Text
          ]]>
    </CustomField>
    but don't know how to program this. Can anybody help/advice me on this?
    Looking forward to your optimum response(s).
    Best Regards

    Hi SDNers:
    I have an issue with using the method CREATE_CDATA_SECTION of Interface IF_IXML_DOCUMENT.
    I have created an XML file from ABAP using methods in IF_IXML_DOCUMENT etc.
    The XML file is perfectly alright. But now there's a need to add CDATA section.
    I need the CDATA section as follows in XML file...
    <CustomField>
        <![CDATA[
              First Line of Text
              Second line of Text
              Third Line of Text
          ]]>
    </CustomField>
    but don't know how to program this. Can anybody help/advice me on this?
    Looking forward to your optimum response(s).
    Best Regards

  • Using XQuery to filder CDATA section

    How do I filter value inside CDATA section using XQUERY in SELECT statement?
    I am using value function.
    <DomainConfig>
         <typeOfDBConnection>
               <![CDATA[#MS SQL]]>
         </typeOfDBConnection>
    </DomainConfig>

    declare @x xml = '<DomainConfig>
    <typeOfDBConnection>
    <![CDATA[#MS SQL]]>
    </typeOfDBConnection>
    </DomainConfig>
    select
    ltrim(rtrim(replace(replace(replace
    (@x.value ('(/DomainConfig/typeOfDBConnection/text())[1]', 'varchar(100)') , char(10), ''), char(13), ''), char(9), '')
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • Newline inserted into CDATA section by parser

    I'm parsing an xml file with a CDATA value that contains xml content. After parsing the file, I display the CDATA value within a JTextArea. For some reason, this xml content ends up double-spaced (hex data 0D 0A 0D 0A, instead of just the original 0D 0A at the end of each line). A newlines are being inserted into my CDATA data. I thought the parser wasn't supposed to change this data.
    I'm extending the SAX DefaultHandler and don't implement the LexicalHandler. Am I supposed to implement the LexicalHandler interface when using CDATA?

    The character data within the CDATA section is being altered. Though I will admit that my original data was incorrect (see below).
    Below is an excerpt form my CDATA section:
    <Configuration>
      <BaseDeviceID>
    ...The hex character data that I see between these two tags (after the first ">" and before the second "<") at different stages is shown below.
    In the original XML file on disk, using a hex editor:
    0D 0A 20 20
    Input to the characters(...) method of my SAXEventHandler during parsing:
    0A 0A 20 20
    Copied from the displayed text in the JTextArea to the hex editor after parsing:
    0D 0A 0D 0A 20 20 (this is where my original data came from)
    It appears that the XML processor (parser?) is changing the carriage return (0D) to a linefeed (0A). This shouldn't happen even if section 2.11 of the spec applies.

Maybe you are looking for

  • My flashplayer wont work in window 7

    OK so everytime I try to download flashplayer a small box pops up and says your not downloading the latest version of flash player please go to "their Website" to get the lattest version" The problem is...I am at their website and still having the is

  • Question? Can you safely delete huge media cache files?

    Dear Experts: In working with PRE7 I found that almost all of my disc space was contained in my media cache folder and it was clogging up all my work. What is that file and can it be deleted without causing harm or losing work? Tom

  • Differences between VMware and Oracle VM

    Hi guys, I am sure that some people have used VMware and moving to OVM or vice versa. I am curious to get some feedback resulting from comparing both products -VMware and OVM- (pros and cons). I am preparing some documentation so I thought of getting

  • How do I get rid of Quizulous, and go back to what I had before?

    I don't want this, and I can't figure out how to get back to what I had before.

  • New Java layout ?

    Hello, I heard of a new kind of layout by Sun which is easier than using GridBagLayout. Did anybody know something about it? If yes, why do i have to use this kind of layout instaed of GridBagLayout? Is JBuilder the best tool to create Java GUI ? Che