Re: [xml] Entity with elements inside it?



On Thu, Jul 09, 2009 at 12:14:27PM +0800, Bo Yang wrote:
Hi,
   I am now using libxml2 as my parser for XML, but I can't find a way
to expand the elements inside an entity declaration. For example

<!ENTITY ent4 "<title attr1="some">some text</title>" >

And in the document, this entity is referenced as

<ele> &ent4; </ele>

When libxml2 parse to above, it creates a EntityRef element and pass
the entity ent4 as a child of this EntityRef element. And the
passed-in child has a entity->content as "<title attr1="some">some
text</title>", but what I want is not the string , I want to parse
this string to a DOM tree, could you please tell me how can I archieve
this?  Thanks a lot!

ps: I use xmlParseChunk to parse my file part by part. I don't think I
can call another xmlParseChunk to parse the entity string... :)

  You need to create the parser context with XML_PARSE_NOENT option

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]