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

Similar Messages

  • Problem while creating xml with cdata section

    I am facing problem while creating xml with cdata section in it. I am using Oracle I am writing a stored procedure which accepts a set of input parameters and creates a xml document from them. The code snippet is as follows:
    select xmlelement("DOCUMENTS",
    (m.document_name_txt as "DOCUMENT_NAME_TXT",
    m.document_type_cd as "DOCUMENT_TYPE_CD",
    '<![cdata[' || m.document_clob_data || ']]>' as "DOCUMENT_CLOB_DATA"
    ) from table(cast(msg_clob_data_arr as DOCUMENT_CLOB_TBL))m;
    msg_clob_data_arr is an input parameter to procedure and DOCUMENT_CLOB_TBL is a pl/sql table of an object containing 3 attributes: first 2 being varchar2 and the 3rd one as CLOB. The xml document this query is generating is as follows:
    The problem is instead of <![cdata[....]]> xmlforest query is encoding everything to give &lt; for cdata tag. How can I overcome this? Please help.

    SQL> create or replace function XMLCDATA_10103 (elementName varchar2,
      2                                             cdataValue varchar2)
      3  return xmltype deterministic
      4  as
      5  begin
      6     return xmltype('<' || elementName || '><![CDATA[' || cdataValue || ']]>
      7  end;
      8  /
    Function created.
    SQL>  select xmlelement
      2         (
      3            "Row",
      4            xmlcdata_10103('Junk','&<>!%$#&%*&$'),
      5            xmlcdata_10103('Name',ENAME),
      6            xmlelement("EMPID", EMPNO)
      7         ).extract('/*')
      8* from emp
    SQL> /
    14 rows selected.

  • Problem with CDATA and new line character

    I parse a xml document with org.w3c.dom, the document contain a CDATA section in which there are more lines of text, each line is terminated with the new line character (\n).
    first line
    second line
    third line
    When a parse this node:
    Text txt_nota=(Text)elm_nota.getFirstChild();
    String nota=txt_nota.getData();
    the value returned is one string with no new line characters, example:
    "first linesecond linethird line"
    what's wrong?

    Because i use the string nota into a jsp page and i print the string nota into a textarea and the text is with no newline, example:
    <textarea name="nota" rows="4" cols="60"><%= nota %></textarea>
    the text into textarea is:
    first linesecond linethird line
    but i want that the text displayed into textarea is equal the text into the CDATA section:
    first line
    second line
    third line

  • Confused with CDATA section

    I am confused as to how the DOM tree is formed for the following XML
    <sql name="A">
    SELECT     name from salary where salary >1000;
    <sql name="B">
    SELECT    *            FROM         EMPLOYEES
                WHERE       rownum <= 2;
    </Template>I want to know how the tree for the above XML is formed
    --CDATA Element
    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);
    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());
    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.

    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.

  • I have a problem with this section

    catch (ClassNotFoundException cnfe)
    System.err.println("Derby driver not found.");
    System.out.println("Available drivers:");
    Enumeration<Driver> drivers = DriverManager.getDrivers();
    while (drivers.hasMoreElements())
    give an example of the type of output you would receive from running this code and explain how this section of the code illustrates the overall aims of JDBC and Open Database Connectivity.

    koketso wrote:
    catch (ClassNotFoundException cnfe)
    System.err.println("Derby driver not found.");
    System.out.println("Available drivers:");
    Enumeration<Driver> drivers = DriverManager.getDrivers();
    while (drivers.hasMoreElements())
    give an example of the type of output you would receive from running this code and explain how this section of the code illustrates the overall aims of JDBC and Open Database Connectivity.What problem are you having with this section? Other than, you know, not wanting to do your own homework...

  • Multicolumn report: problem with continuous section breaks

    Hi All,
    There is a need to create RTF template which consists of 3 logical parts:
    (1) Static text -> some kind of header information;
    (2) Multicolumn (2 columns) text -> contract terms;
    (3) Static text -> information about signers;
    Here is a small screenshot as an example:
    Click for full size
    The problem is that MS Word will place continuous section breaks before and after multicolumn part. And BI Publisher will transform these section breaks into page breaks. As a result each of 3 parts will be on its own page.
    Does anyone have a solution or workaround to avoid such behavior?
    Or can advice anything?
    Thanks in advance.
    P.S. Partly solution is to put the 1st part into page header. In this case MS Word won’t place continuous section break before multicolumn part. But still there is a problem with the 3rd part as it will go to separate page :(

    Thanks for suggestion.
    I've already tried such approach and unfortunately it didn't work.
    If there is only "2 column" text in main template with the subtemplate calls before and after text, then text from subtemplates is appended to 2 column text and also formated as "2 column" text.
    Here is an example files: URL was removed
    XML file is empty as at this moment it is not important.
    Purpose is to get all 3 sections without page breaks.
    Section 2 can be 2-3 pages big.
    Edited by: user534692 on Aug 12, 2009 8:04 AM

  • CNN website problems with Comments section. Scroll and post problems

    CNN website, myself and other firefox users can no longer scroll up and down inside a comment when making a post.
    Often you can not post the comment with the 'post' button unless page is reloaded.
    Problem has been occurring for last week or so.
    I have confirmed that other uses on CNN have same problems with firefox.
    Problem doesn't occur when using I.E.8

    I have this problem with IE 8. I cannot post comments on I thought might have disabled my ability to post comments but am not sure if they have that ability. Thanks for your help!

  • Problem with CDATA

    I have this schema:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xs:schema targetNamespace="com/ejie/validationResponse/xml" xmlns:ns="com/ejie/validationResponse/xml" xmlns:xs="" elementFormDefault="qualified">
         <xs:element name="data">
                        <xs:element ref="ns:respuesta" maxOccurs="unbounded"/>
         <xs:element name="respuesta" type="xs:string"/>     
         <xs:element name="serviceresponse">
                        <xs:element ref="ns:data"/>
    and when i try to insert this in the "respuesta"
    it doesn't insert the CDATA and i want the CDATA to be inserted.
    if for example i insert this:
    it works ok ... i don't know why.
    The code i try is this way (very very simple)
    String sXML = "<empresas><TIPOXML>OK</TIPOXML></empresas>";
    ServiceresponseDocument srd = ServiceresponseDocument.Factory.newInstance();
    Serviceresponse sr = srd.addNewServiceresponse();
    Data data = sr.addNewData();
    Even if i insert the CDATA manually then it appears:
    <[CDATA .........
    Any idea?
    thanks in advance

    And also with an XML that is more than 550 characters the CDATA is not added...
    We're lost. We have added the question also directly to bea but they don't respond.
    Any idea?
    For example:

  • Problem with Header Section in BusinessObjects 6.5 (2)

    I am using BusinessObjects 6.5 (2). I created a Report and it includes the Min Section. The Main section has 3 parts; H, S F.
    I have 4 questions:
    1) Why the height of the header is different in different pages?
    2) I also inserted a table in the header, and the vertical spacing between the bottom of the table and the Main Section is different in different pages.  In the first page the table is farther to the Main Section, and in the other pages the vertical space between the table in the header and the Main Section is closer.
    3) How do I manipulate the height of each Section H, S, F
    4)  When I change the background of the Main Section Header(H) it is only changed in the first page(Section Format, Background Color). 
    You can view the screen shots in my Blog:
    Sherry Barkodar

    Moved to Legacy products

  • XSLT mapping problem with CDATA

    This is my input message
    <?xml version="1.0"?>
    My XSL
    <xsl:stylesheet xmlns:xsl=""
    <xsl:template match='node()|@*'>
    <xsl:apply-templates select='node()|@*'/>
    <?xml version="1.0" encoding="UTF-16"?><root>&lt;a&gt;test&lt;/a&gt;</root>
    My Desired Output
    Please give me the solution
    Edited by: Gabriel Sagaya Selvam on Jul 24, 2008 1:29 AM

    please look at this
    But i cant get the result

  • Custom PDF/RTF reports with Cocoon (problem with special characters)

    Hi all,
    I've setup application (APEX 3.0.1) with some custom PDF reports (using Cocoon 2.1.10),
    I'm generating my own hierarchical xml structure, using query with xmlelement() and xmlagg() functions,
    I cannot use built-in xml generator, because I need to get master-detail report with sub-grouping.
    Everything works fine if data in report doesn't contains special characters like "&",
    but Cocoon stops processing XML data when it found special character, following error is written to cocoon log:
    INFO (2007-10-02) 12:34.16:828 [sitemap.transformer.log] (/cocoon/fop_post/) http-8888-1/LogTransformer: [startElement] uri=,local=PRZEDMIOT,raw=PRZEDMIOT
    INFO (2007-10-02) 12:34.16:828 [sitemap.transformer.log] (/cocoon/fop_post/) http-8888-1/LogTransformer: [startCDATA]
    INFO (2007-10-02) 12:34.16:828 [sitemap.transformer.log] (/cocoon/fop_post/) http-8888-1/LogTransformer: [characters] PPHU "T
    ERROR (2007-10-02) 12:34.16:828 [] (/cocoon/fop_post/) http-8888-1/StreamGenerator: StreamGenerator.generate()
    org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
    ERROR (2007-10-02) 12:34.16:828 [sitemap.handled-errors] (/cocoon/fop_post/) http-8888-1/ErrorHandlerHelper: Failed to process pipeline
         at <map:serialize type="xml"> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:22:32
         at <map:generate type="stream"> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:18:33
         at <map:serialize type="fo2pdf"> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:58:37
         at <map:transform> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:51:39
         at <map:transform type="log"> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:45:35
         at <map:generate> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:42:38
         at <map:mount> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/sitemap.xmap:1034:92
    org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
    This error occur when Cocoon process folowing XML entity:
    I tried to escape "&" character with CDATA section, but it didn't work.
    I tested following alternatives:
    <PRZEDMIOT><PPHU &quot;T&amp;M&quot; Ltd.></PRZEDMIOT> --remove '<' and '>' characters
    but I still get the same error.
    Can anyone help me with this ?
    Tomasz K.

    Ok, I found that only '&' and '%' characters breaks Cocoon processing.
    The workaround is to use replace() function and change:
    '&' to '%26' and '%' to '%25', but I think that is a dirty way...
    Other characters like " - 'double citation' are succesfully escaped with xmlcdata() function.
    Perhaps someone know the simpler way to get Master/Detail PDF reports from APEX without using BI Publisher ???
    Actually I have page process invoked by button, which generates XML data, post it to Cocoon with UTL_HTTP and save generated PDF to database table (for future use).
    The same button invokes branch to URL with download procedure.
    Standard APEX reporting is not very usefull for me, because I don't know how to generate "complex" documents, with several grouping sections.
    I will be gratefull for any aid.

  • Inline XML with CDATA problem

    Hi everyone,
    I'm trying to include some JavaScript (JSON 2, to be precise)
    in with some ActionScript 3 classes. I'm using the inline XML
    method (E4X) of declaring the data. It looks like this:
    public static var JSON_2:XML = <data><![CDATA[
    if (!this.JSON) {
    JSON = function () {
    function f(n) {
    return n < 10 ? '0' + n : n;
    Date.prototype.toJSON = function (key) {
    return this.getUTCFullYear() + '-' +
    f(this.getUTCMonth() + 1) + '-' +
    f(this.getUTCDate()) + 'T' +
    f(this.getUTCHours()) + ':' +
    f(this.getUTCMinutes()) + ':' +
    f(this.getUTCSeconds()) + 'Z';
    String.prototype.toJSON =
    Number.prototype.toJSON =
    Boolean.prototype.toJSON = function (key) {
    return this.valueOf();
    var cx = /[\u0000
    Actually, this is only about a quarter of what I need to
    include but this is where it breaks down. Right after the second
    slash in the last line, Flash reports:
    TypeError: Error #1091: XML parser failure: Unterminated CDATA
    In fact, as you can see this is a perfectly valid CDATA
    section and isn't being terminated anywhere (there is no instance
    of "]]>" anywhere in the data). Unfortunately, Flash doesn't
    think so and seems to think that the backslash is an XML node
    Does anyone have an idea of how to effectively deal with
    this? The JSON source code has *many* backslashes so not having to
    convert them would be *very* useful.
    Many thanks for all your suggestions,

    I've *kind* of solved the problem...replacing each backslash
    ("\") with a double backslash ("\\"). At least this has removed the
    compiler error. However, this would suggest that the CDATA section
    is actually being interpreted by Flash, which is something it isn't
    supposed to do...or did I misunderstand how this works?

  • In my Iphone 5, Nothing on my App Store is working its displaying blank (Except for Genius section). I've tried to uninstall and install itunes and all its component but still it doen't fix. Not sure if its problem with apple servers. Someone help please!

    In my Iphone 5, Nothing on my App Store is working,  its displaying blank (Except for Genius section). I've tried to uninstall and install itunes and all its component in my desktop but still it doesn't fix the app store issue. Not sure if its problem with apple servers. Someone help please!

    settigns>itunes and app store to make sure you are signed in.. If  you are, you will see your account name..... anyhow, click your account name, sign out and sign back in
    also go to to settings>general>reset and reset network settings... if that doesnt work settings>general>reset and reset all settings!
    one of those shall work. The last step would be to restore your device ( HT1414

  • Problem retrieving Data from a CDATA-Section using XMLDOM

    Ware: Oracle 64bit, XDK for PL/SQL Version, 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.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:
    doc VARCHAR2(32767);
    doc :=
    '<?xml version="1.0" encoding="UTF-8"?>
    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
    2) The Procedure which parses the XML-Document (no Exception-Handling):
    Parser XML_SCHEMA.XMLParser.Parser;
    DOMDocument XML_SCHEMA.XMLDOM.DOMDocument;
    DOMCharacterData XML_SCHEMA.XMLDOM.DOMCharacterData;
    TheDocument CLOB;
    ID VARCHAR2(100);
    Data VARCHAR2(200);
    -- LOB
    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);
    -- Node
    DOMNode := XML_SCHEMA.XMLDOM.MakeNode(DOMDocument);
    -- Get ID
    DOMNodeList := XML_SCHEMA.XSLProcessor.SelectNodes
    IF XML_SCHEMA.XMLDOM.GetLength(DOMNodeList) > 0 THEN
    DOMNodeItem := XML_SCHEMA.XMLDOM.Item(DOMNodeList, 0);
    XML_SCHEMA.XMLDOM.WriteToBuffer(DOMNodeItem, 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;
    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;
    Casts given DOMNode to a DOMCharacterData
    It only do the casting.

  • Have a problem with my MacBook Pro.5,3 and monitor.  Intermittently, the desk top screen becomes broken up into vertical sections, which appear in the wrong order, creating a haphazard picture.    The Apple icon, usually at top left corner, appears in to

    have a problem with my MacBook Pro.5,3 and monitor.  Intermittently, the desk top screen becomes broken up into vertical sections, which appear in the wrong order, creating a haphazard picture.
    The Apple icon, usually at top left corner, appears in top right corner  in a strip including all that left hand.  When the computer is restarted, the screen goes back to normal.  But I have to move the mouse to the far left of the screen and then up until it reappears on the far right hand side of the screen so that I can hit shut down button.
    It seems to happen randomly though always on desk top and sometimes when I move mouse and computer switches on from rest mode.   My large flat screen is relatively new.
    The video card on this computer, which is approximately two years old, is Nvidia FeForce 9400M.
    Any help would be welcome as my usual source of assistance is not available and I am not well versed in workings of the Mac although I have used one for many years.

    That sounds like a Hardware problem.
    You may be able to confirm that with Apple Hardware Test, or make an appointmenst for a free Genius Bar evaluation.

Maybe you are looking for

  • Need to dial a phone number from Cold Fusion

    My boss asked me if there was any way that a phone number could be dialed from Cold Fusion. We have a website where at some point we want to just click a button and dial that phone number. My guess is that the conversation will then be carried throug

  • Connectivity Through Oracle Server

    The senario is that i have established Oracle 8.05 as a server and three Oracle 8 client in a LAN Environment.HOst naming Configuration technique make SQLPLUS of client to connect with Oracle server.i have also installed Developer 2000 on the CLient

  • G5 Tower Crashes Photoshop on File Open

    My G5 2.0ghz DP Tower started closing Photoshop whenever I tried to use File>Open from within Photoshop CS3. I reinstalled PS to no effect. I then reinstalled OSX 10.4.11 and PS to no effect. Files can be opened by double clicking on them with no cra

  • 5.2 Language Support

    I was just reading that an instance of ME can only support one language at a time, is this true? Only support one language per server/install The web browser, Netweaver, and the database server must be configured to use the same language We are plann

  • Adobe Acrobat Pro 8

    Adobe Acrobat Pro 8 stopped working (it won't launch), today. I ran the update, wthout incident, but the program still won't open. Any ideas? Thanks!