Re: [xml] parser add '0x0a' around CDATA content, why?



On Mon, Nov 25, 2002 at 11:13:15AM +0800, Li Zhao wrote:
Sirs,

I read a xml document and found that:

after parsing, the contents in CDATA sections have been added a char, '0x0a' at head and tail.
e.g:
in 1.xml , a CDATA section like:
<![CDATA[<table>]]>

parse it, then read using 
xmlNodeListGetString(doc,cur,1);
the CDATA string appears in memory as:
<![CDATA[
<table>
]]>

Why the parser add '0x0a',
How to prevent xml parser from doing this?
or can I choose whether the parse add or not?

  Sorry, I looked at the code and there no such character added within
the library. I cannot reproduce your problem:

paphio:~/XML -> cat tst.xml
<doc><![CDATA[<table>]]></doc>
paphio:~/XML -> ./xmllint tst.xml
<?xml version="1.0"?>
<doc><![CDATA[<table>]]></doc>
paphio:~/XML ->

  even when formatting the output the CDATA are preserved

paphio:~/XML -> ./xmllint --format tst.xml
<?xml version="1.0"?>
<doc>
<![CDATA[<table>]]>
</doc>
paphio:~/XML ->

  Please read the instructions at http://xmlsoft.org/bugs.html
on the way to report bugs, including:
 "Make sure you can reproduce the bug with xmllint or one of the
  test programs found in source in the distribution."

  thanks,

Daniel
-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]