On Fri, Jul 10, 2009 at 10:01:06AM +0800, Bo Yang wrote:
> > m...@flunder:~/win-dev/XML > xmllint --noent nstoken.xml
> > <?xml version="1.0"?>
> > <!DOCTYPE Urmel [
> > <!ENTITY jaja "<eins><zwei/><drei>drei</drei></eins>">
> > ]>
> > <Urmel> <eins><zwei/><drei>drei</drei></eins> </Urmel>
> 
> The above is not my desired behavior. I want to the parser create a
> entity_ref node, and then append the parsed "jaja" to the children of
> entity_ref.

  it's the default behaviour !!!
  it's what it does, get a clue, when reserializing obviously it
won't output things twice !!!

paphio:~/XML -> xmllint --debug nstoken.xml
DOCUMENT
version=1.0
URL=nstoken.xml
standalone=true
  DTD(Urmel)
    ENTITYDECL(jaja), internal
     content=<eins><zwei/><drei>drei</drei></eins>
      ELEMENT eins
        ELEMENT zwei
        ELEMENT drei
          TEXT compact
            content=drei
  ELEMENT Urmel
    TEXT compact
      content= 
    ENTITY_REF(jaja)
      INTERNAL_GENERAL_ENTITY jaja
      content=<eins><zwei/><drei>drei</drei></eins>
    TEXT compact
      content= 
paphio:~/XML -> 

  Complete proof:

(gdb) p *doc->children->next->children->next
$5 = {_private = 0x0, type = XML_ENTITY_REF_NODE, name = 0x7a0238
"jaja", 
  children = 0x7a3658, last = 0x7a3658, parent = 0x7a0448, next =
0x7a3918, 
  prev = 0x7a3798, doc = 0x7a00a8, ns = 0x0, 
  content = 0x7a3728 "<eins><zwei/><drei>drei</drei></eins>", 
  properties = 0x0, nsDef = 0x0, psvi = 0x0, line = 0, extra = 0}
(gdb) p *doc->children->next->children->next->children
$6 = {_private = 0x0, type = XML_ENTITY_DECL, name = 0x79fc5d "jaja", 
  children = 0x7a3c28, last = 0x7a3c28, parent = 0x7a02d8, next = 0x0, 
  prev = 0x0, doc = 0x7a00a8, ns = 0x7a0398, 
  content = 0x7a3728 "<eins><zwei/><drei>drei</drei></eins>", 
  properties = 0x100000025, nsDef = 0x0, psvi = 0x0, line = 0, extra =
0}
(gdb) p *doc->children->next->children->next->children->children
$7 = {_private = 0x0, type = XML_ELEMENT_NODE, name = 0x79fc6d "eins", 
  children = 0x7a3ce8, last = 0x7a3da8, parent = 0x7a3658, next = 0x0, 
  prev = 0x0, doc = 0x7a00a8, ns = 0x0, content = 0x0, properties = 0x0, 
  nsDef = 0x0, psvi = 0x0, line = 1, extra = 0}
(gdb) 

  End of story, now please use the library and explore what it does
that will be more productive !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
[email protected]  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to