2009/11/2 Hussein Shafie <hussein at xmlmind.com> > Benoit Maisonny wrote: > > > > I'm developing a custom implementation of XInclusion. > > Unfortunately we cannot provide support for this kind of advanced > extensions. > > Thank you for responding anyway, then.
> > When opening in > > XXE a file containing my custom include element, I get the following > error: > > file:[some file URI here]::: inclusion implementation error: missing > > source URL > > > > I load the target file using: > > context.getDocument(url); > > context is the XInclusionContext passed to the method > XInclusion.include(). > > > > I thought I might need to set SOURCE_URL_PROPERTY myself, so I tried: > > doc.putProperty(Constants.SOURCE_URL_PROPERTY, url); > > right after the line above, but the result is the same: the error > > message above. > > > > What should I do to provide that source URL? > > According to the doc > > http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/load/XInclusion.html#include(com.xmlmind.xml.doc.Node,%20com.xmlmind.xml.doc.Node,%20boolean,%20com.xmlmind.xml.load.XInclusionContext)<http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/load/XInclusion.html#include%28com.xmlmind.xml.doc.Node,%20com.xmlmind.xml.doc.Node,%20boolean,%20com.xmlmind.xml.load.XInclusionContext%29> > --- > Node[] include(Node firstNode, > Node lastNode, > boolean updating, > XInclusionContext context) > throws InclusionException > > returns a non-empty array containing included nodes. > > Included nodes are copies of some ``original nodes''. > > These copies are not always clones of the original nodes (e.g. DITA > conref). > > The returned nodes must each have a Constants.SOURCE_URL_PROPERTY > property properly set. > > On the other hand, adding the Constants.INCLUSION_PROPERTY and > Constants.READ_ONLY_PROPERTY properties to returned nodes is not useful. > --- > > Therefore, you need to invoke putProperty(Constants.SOURCE_URL_PROPERTY, > XXX) on each node returned by include() and not on doc like you did it. > This worked, thanks. Indeed I read the doc but another page in the javadoc let me believe that the doc.putProperty() would be enough. > > And what if the included nodes are built on request and don't come from > > an actual source document? > > > > In theory, an XInclusion (but not a SimpleInclusion) allows to do this. > > However, we currently have no implementation of an XInclusion which is > not also a SimpleInclusion. Therefore, XXE probably has design and/or > implementation and/or documentation bugs related to the support of > ``pure XInclusions''. > Good to know. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20091103/8b2339f1/attachment-0001.htm

