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

Re: [xml] Predefined Entities Reference problem in SAX parsing



On Thu, Jan 22, 2009 at 11:42:05AM +0530, Rabi Narayan Sahoo wrote:
> Hi 
> 
>   When I perform a sax parsing on the below xml file 
> 
>    <?xml version="1.0"?>
> 
>        <object DN="&amp;&lt;;DN;&gt;@&amp;#&lt;;Attribute;&gt;"
> operation="modify">
> 
>        </object> 
> 
> In the startelementns callback for trigger element the value of the
> attribute DN was $#38;<;DN;> @&#38;#<;Attribute;>
> 
> For all the predefined entities references it replace the corresponding
> character but for amp it
> 
> replace again with a character reference.

  ask for entity replacement.

> As of XML1.0 specification "if a general entity reference appears in the
> value of an attribute its replacement text MUST be processed in place of the
> reference itself."

  libxml2 was designed for editing, the only way to keep editing
  capabilities of entities in attrribute values is to tweak the SAX
  interface. Just ask for entity substitution when  starting the parser
  XML_PARSE_NOENT option IIRC.


Daniel

[...]
> ctxt->replaceEntities. Can anybody please describe why an amp entity
> reference is handled in this manner in SAX?
> 
> Thanks and Regards
> 
>       Rabi

-- 
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]