Re: [xml] patch for xmlwriter



Hi

Okay, applied. But I didn't commited because this generate a change in behaviour for the xmlWriter.c example which "make test"
triggers:
 < <EXAMPLE><!--This is a comment with special chars: <äöü>--><ORDER version="1.0" xml:lang="de"><!--This is another comment with special chars: 
<äöü>--><HEADER><X_ORDER_ID>0000053535</X_ORDER_ID><CUSTOMER_ID>1010</CUSTOMER_ID><NAME_1>Müller</NAME_1><NAME_2>Jörg</NAME_2></HEADER><ENTRIES><ENTRY><ARTICLE>&lt;Test&gt;</ARTICLE><ENTRY_NO>10</ENTRY_NO></ENTRY><ENTRY><ARTICLE>&lt;Test 
2&gt;</ARTICLE><ENTRY_NO>20</ENTRY_NO></ENTRY></ENTRIES><FOOTER><TEXT>This is a text.</TEXT></FOOTER></ORDER></EXAMPLE>
---
 > <EXAMPLE><!--This is a comment with special chars: &lt;äöü&gt;--><ORDER version="1.0" xml:lang="de"><!--This is another comment with special chars: 
&lt;äöü&gt;--><HEADER><X_ORDER_ID>0000053535</X_ORDER_ID><CUSTOMER_ID>1010</CUSTOMER_ID><NAME_1>Müller</NAME_1><NAME_2>Jörg</NAME_2></HEADER><ENTRIES><ENTRY><ARTICLE>&lt;Test&gt;</ARTICLE><ENTRY_NO>10</ENTRY_NO></ENTRY><ENTRY><ARTICLE>&lt;Test 
2&gt;</ARTICLE><ENTRY_NO>20</ENTRY_NO></ENTRY></ENTRIES><FOOTER><TEXT>This is a text.</TEXT></FOOTER></ORDER></EXAMPLE>

  < and > are now escaped in the output. It's probably not something you
really intended, so I'm waiting for a possible fix before commiting it.
Regression tests are good ... we need more especially for the xmlWriter.

        The point about < and > escaping is that xmlTextWriterWriteComment()
now calls xmlTextWriterWriteString(), which when tests entity state
and matches XML_TEXTWRITER_COMMENT it calls xmlEncodeSpecialChars().
I also don't know if it's a desired functionallity, but the attached
patch disable escaping.
        It must be applied after Alfred's earlier patch.

regards

--

[]'s
Lucas Brasilino
brasilino recife pe gov br
http://www.recife.pe.gov.br
Emprel -        Empresa Municipal de Informatica (pt_BR)
                Municipal Computing Enterprise (en_US)
Recife - Pernambuco - Brasil
Fone: +55-81-34167078
--- xmlwriter.c.precommentpatch 2004-02-16 16:50:09.000000000 -0300
+++ xmlwriter.c 2004-02-16 16:50:21.000000000 -0300
@@ -1309,7 +1309,6 @@
             /* fallthrough */
         case XML_TEXTWRITER_PI_TEXT:
         case XML_TEXTWRITER_TEXT:
-        case XML_TEXTWRITER_COMMENT:
           encode:
             buf = xmlEncodeSpecialChars(NULL, content);
             if (buf == NULL)
@@ -1329,6 +1328,7 @@
         case XML_TEXTWRITER_DTD_TEXT:
         case XML_TEXTWRITER_DTD_ELEM:
         case XML_TEXTWRITER_CDATA:
+        case XML_TEXTWRITER_COMMENT:
             buf = xmlStrdup(content);
             if (buf == NULL)
                 count = -1;


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