Re: [xml] parser xml file crash, any body can give me some suggest



On Thu, Aug 05, 2010 at 05:36:42PM +0800, Trident wrote:
when i use the xmlParseFile(filename) to parser this xml file, the terminal show 
parser error : out of memory error
parser error : out of memory error
/opt/trident-widgets/work/bv/config.xml:10: parser error : out of memory error
  <xyz:content src="&pass;"/>
I don't known how to use the api, i am first time to use the libxml2, and any body can give me some suggest.
The xml file is follow: 
<?xml version="1.0" standalone="yes" ?>
<!-- 
Tests support of XML, XMLNS, and UTF-8. To pass, the user agent must load pass.html.
-->
<!DOCTYPE widget [
<!ENTITY widgets-ns "http://www.w3.org/ns/widgets";>
<!ENTITY pass "pass&amp;.html">
]>
<xyz:widget xmlns:xyz="&widgets-ns;">
  <xyz:content src="&pass;"/>
  <xyz:name>bv</xyz:name>
</xyz:widget>

I don't know what you are doing because it works 'fine' for me even with
DTD validation and entity substitution:

paphio:~/XML -> xmllint --valid --noent tst.xml
tst.xml:10: element widget: validity error : No declaration for
attribute xmlns:xyz of element widget
<xyz:widget xmlns:xyz="&widgets-ns;">
                                    ^
tst.xml:11: element content: validity error : No declaration for
attribute src of element content
  <xyz:content src="&pass;"/>
                           ^
tst.xml:11: element content: validity error : No declaration for element
content
  <xyz:content src="&pass;"/>
                             ^
tst.xml:12: element name: validity error : No declaration for element
name
  <xyz:name>bv</xyz:name>
                         ^
tst.xml:13: element widget: validity error : No declaration for element
widget
</xyz:widget>
             ^
<?xml version="1.0" standalone="yes"?>
<!--
     Tests support of XML, XMLNS, and UTF-8. To pass, the user agent
must load
     pass.html.
     -->
<!DOCTYPE widget [
<!ENTITY widgets-ns "http://www.w3.org/ns/widgets";>
<!ENTITY pass "pass&amp;.html">
]>
<xyz:widget xmlns:xyz="http://www.w3.org/ns/widgets";>
  <xyz:content src="pass&amp;.html"/>
  <xyz:name>bv</xyz:name>
</xyz:widget>
paphio:~/XML -> cat .memdump 
      02:23:21 PM

      MEMORY ALLOCATED : 0, MAX was 31209
BLOCK  NUMBER   SIZE  TYPE
paphio:~/XML -> 

 and the parser allocated only 31 KBytes to build the document.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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