Re: [xml] encoding problem



On Tue, Mar 27, 2001 at 05:38:41PM +0200, Bernard Valton wrote:
Hello,

I've got a xml document containing :

  <setvar value="&#38;!=x1A9F9A"/>

after parsing, I get a tree like this :

 element : name = setvar
   attr : name = value
   children : name = #38
                 content = NULL

Maybe it's correct, I don't know ??

I would like to get :

 element : name = setvar
   attr : name = value
   children : name = text
                 content = &#38;!=x1A9F9A

Is it a bug or the resul of encoding ?
Is there a solution ?

  Okay I finally spent the hour needed to get this fixed. Basically
I had to rewrote xmlStringGetNodeList() to handle char references,
the patch to 2.3.6 is enclosed.

orchis:~/XML -> cat test.xml
<setvar value="&#38;!=x1A9F9A">&#38;!=x1A9F9A</setvar>
orchis:~/XML -> /usr/bin/xmllint --debug test.xml
DOCUMENT
version=1.0
URL=test.xml
standalone=true
  ELEMENT setvar
    ATTRIBUTE value
      ENTITY_REF(#38)
      TEXT
        content=!=x1A9F9A
    TEXT
      content=&!=x1A9F9A
orchis:~/XML -> ./xmllint --debug test.xml
DOCUMENT
version=1.0
URL=test.xml
standalone=true
  ELEMENT setvar
    ATTRIBUTE value
      TEXT
        content=&!=x1A9F9A
    TEXT
      content=&!=x1A9F9A
orchis:~/XML -> 

  The old version was generating an entity reference, the new one
properly generates a single text node for the attribute content.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Attachment: entity.patch
Description: Text document



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