[jdom-interest] Xinclude

Emmanuel van der Meulen emmanuelm at absa.co.za
Tue Mar 9 00:40:25 PST 2004


>On 04 March 2004 06:38 PM, Elliotte Rusty Harold replied; my response was
erroneously not to the mailing list but directly to him; for completenes I
place my reply;

Could you please look past my terminology; I suspect I'm not
conveying/expressing myself clearly; at the concept of my
request/suggestion.

I'm merely have a requirement to include an XML file in another XML file,
hopefully using only JDOM.

The way I currently achieve this, is via Xinclude in two steps.  With the
mechanics via Xinclude, say as implemented by
http://xincluder.sourceforge.net/, I parse the XML file with JDom's
SAXBuilder using the build() method which returns a Document object.  Then I
use JDOMXIncluder's resolve() method and pass the Document object as
returned by JDOM to expand the 'embedded' XML file.  This produces another
Document object where the embedded XML files content exists in one Document
object.

When I set out with above requirement, I intuitively felt that JDOM would
cater for above processing (in one step).  Seeing as it doesn't I raised
this point.

Could you please evaluate and assist with this request/suggestion.

Kind regards
Emmanuel

--
PS. ------------------------------------------------------------------------
-----

Here is a snippet of the java code;
-----------------------------------
Document docOrig = new SAXBuilder(true).build(new File(file)); //
document.xml
Document docNew = JDOMXIncluder.resolve(docOrig, base);        // base is
URL pointing to folder where disclaimer.xml resides

Here is the content of the two XML files;
-----------------------------------------
document.xml
<?xml version='1.0'?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">

  <p>Some text.</p>
  <xi:include href="disclaimer.xml"/>
</document>

disclamer.xml
<?xml version='1.0'?>
<disclaimer>
  <p>Some disclaimer text.</p>
</disclaimer>

----------------------------------------------------------------------------
------

______________________________________________

E-mail Disclaimer and Company Information

http://www.absa.co.za/ABSA/EMail_Disclaimer




More information about the jdom-interest mailing list