Re: [xml] Identifying the source file for an xi inclusion

On Fri, Feb 13, 2009 at 12:23:09PM -0800, Marc Munro wrote:
On Sat, 2009-01-31 at 08:12 +0100, Daniel Veillard wrote:
On Thu, Jan 29, 2009 at 01:50:52PM -0800, Marc Munro wrote:
I am processing a document which contains nested inclusions using
xi:include.  How can I tell the source file from which a given node was
included into the document?

  Not always possible, for example if you XInclude a text node, well
there is little to help. But you can use 2 things:
  xml:base attribute left by the xinclude process, if you ask for the
    base at a given included point, you may get the proper URI
    if there was room left to put the base attribute at the inclusion
    point (i.e. on an element)
  the XInclude process also turns the original xi:include element into
    an XML_XINCLUDE_START node with all attributes left and also add
    an XML_XINCLUDE_END after the included element(s)

I thought I'd try figuring out the URI the hard way and so traversed to
the XML_XINCLUDE_START node for the inclusion.  I was hoping to find the
href attribute saved there but instead find no attributes at all.

  The XML_XINCLUDE_START node is really the old xi:xinclude node just
changed to be of the new type, really all informations should be there,
though the attribute reading API may not work because the node type
is not XML_ELEMENT_NODE ... check directly the ->properties list.


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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