On Thu, Jul 9, 2009 at 2:10 PM, Daniel Veillard<[email protected]> wrote: > 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
Thanks for your reply, Daniel. But I did not find any param used to pass option in xmlCreatePushParserCtxt. And I pass it in at xmlCtxtUseOptions, I think they have the same effect. And the option XML_PARSE_NOENT means, there will be no entity_reference node created, right? Regards! Bo _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
