[xml] Questions about xml:id



Hi all;
 libxml2 apparently supports xml:id
[ http://www.w3.org/TR/2004/WD-xml-id-20040407/ ]
but I'm a little unclear on how it works, particularly
since I'm using libxml2 via XML::LibXML, rather than the C API.

It seems that libxml2 only gives an attribute that magic ID-ness
if the attribute's local-name is "xml:id"
 [in perl:  $node->setAttribute('xml:id','someid'); ]
rather than an "id" attribute in xml namespace
 [in perl: $node->setAttributeNS('http://www.w3.org/XML/1998/namespace','id','someid'); ]
Is this the intention?

Second question: It appears that libxml2 creates an index of these ID's
that is used by the xpath function id().  The index gets created
when a document gets parsed and/or validated.  Apparently, the index
does not get `maintained' when a document is created or manipulated by hand.

Is there a `cheap' way to notice & update the association between ID & node
when the structure gets rearranged?  Alternatively a call (short of validation)
I can use when I _know_ the association has changed?

Thanks!

--
bruce miller nist gov
http://math.nist.gov/~BMiller/



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