[jdom-interest] Nesting multiple levels of xml docs and using entity references.

Jeff Rasmussen jrasmussen at lnxi.com
Tue May 18 09:37:33 PDT 2004

I am trying to set up an interface to build documents in DocBook. I
would like to divide the xml files into sections based on the docbook
dtd. Ex. 

Set -->(contains) Book(one to many) -->(contains) Part(one to many)
-->(contains) Article(one to many)

I would like to separate these logical partitions into physical
partitions and place the files in separate directories. I will generate
dynamic header files(these contain the DocType) so I can export any
level of these documents on-the-fly without reading the entire document.

When I try to read a document that has entity references but no DocType
I get a error "The entity ENTITY_REFERENCE_NAME was referenced, but not
declared.". I understand that it was not declared because I declare it
in a separate "header file" that references this file. Is there any way
to suppress this error and construct the document?

I have tried the following code:

this.expandEnitites = false;
this.validate = false;

SAXBuilder builder = new SAXBuilder();
if(! this.validate){ 
builder.setEntityResolver(new NoOpEntityResolver());
Document document = builder.build(new File(fileHandle));

I am trying to read this XML file:

<?xml version="1.0" encoding="UTF-8"?>
      <para>No notice is required.</para>
    <edition>First Edition</edition>
        <date>Mon May 17 09:08:41 MST 2004</date>

Thanks for any available help!!!

Jeff Rasmussen

More information about the jdom-interest mailing list