On 11/12/2012 08:30 AM, Benoit Maisonny wrote:
Hi,
I have a Java extension to XXE that formats xincluded data based on some
meta-data deducted from the xpointer. Taking the VATrates.html example
from XXE's tutorial, let's say I create an xinclude as follows:
<xi:include href="xxe-pro-4_6_1/doc/user/tutorial/VATrates.html"
xpointer="austria_vat" xmlns:xi="http://www.w3.org/2001/XInclude" />
(yes, I'm still using XXE 4.6.1 but it seems the API hasn't changed in
5.4 for the issue I have. If it has, then it'd be a good reason for me
to upgrade!)
My @xpointer actually uses the xpointer() scheme, and my code uses the
@xpointer value to deduct meta-data. In this example, let's say I'd
extract "austria".
To obtain the @xpointer value, I have the following code:
import com.xmlmind.xml.xinclude.XInclude;
import com.xmlmind.xml.doc.Constants;
[...]
// get the XInclude definition
final XInclude xinclude = (XInclude) dataElement
.getProperty(Constants.INCLUSION_PROPERTY);
// get the xpointer attribute
final String xpointer = xinclude.xpointer;
This works fine as long as xi:include is part of the document being
edited. If it is part of another document, which is itself xincluded
from the document being edited, then the variable xinclude is null. The
javadoc for Constants.INCLUSION_PROPERTY[1] is indeed clear about this:
This property is set on the nodes /directly/ included in a document.
Fine. Now how can I obtain the XInclude object for /indirectly/ included
nodes, then?
There is no XInclude object for indirectly included nodes. Such nodes
just have a different SOURCE_URL_PROPERTY property:
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Constants.html#SOURCE_URL_PROPERTY
(You can use the "Show info about included elements" menu item found in
the "View" menu to see that by yourself.)
XXE does not maintain an XInclude object for indirectly included nodes
because such object would have no use (at least in the stock XXE).
Therefore the only way to obtain such XInclude object is:
1) To assume that all included nodes having a different
SOURCE_URL_PROPERTY property have been included from another file.
2) To load this other file and look for the INCLUSION_PROPERTY inside it.
Thanks in advance,
Benoit
[1]
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/doc/Constants.html#INCLUSION_PROPERTY
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support