Your entity is a 'parameter entity' which is only recognized within the
DTD. Change it to a regular entity (get rid of the '%' character) and you
will make it a general entity. Then it should work.

----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
[EMAIL PROTECTED]



[EMAIL PROTECTED] on 03/02/2000 03:37:39 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  How to include external XML files?





I have two XML files, one of which tries to include the other.  I can't
find the syntax to create a DOM with the included XML appearing.

The main file is:

<?xml version="1.0"?>
<!DOCTYPE testdoc [
<!ELEMENT test(testing)>
<!ELEMENT testing (name)>
<!ELEMENT name (#PCDATA)>
<!ENTITY  % local SYSTEM "testing.xml" >
]>
<test>
%local;
</test>


and testing.xml which is to be included in the main:

<?xml version="1.0"?>
<testing>
  <name>My Name</name>
</testing>

I read this in as:

DOMParser parser = new DOMParser();
try
{
   parser.setFeature( "http://xml.org/sax/features/validation";, true);
   parser.setFeature(
"http://apache.org/xml/features/dom/defer-node-expansion";, false );
   parser.setFeature(
"http://apache.org/xml/features/dom/create-entity-ref-nodes";, true);
   parser.setFeature(
"http://xml.org/sax/features/external-general-entities";, true);
   parser.setFeature(
"http://xml.org/sax/features/external-parameter-entities";, true);
   parser.parse( fileName );
} catch (SAXException se) {
   System.out.println("sax exception: " + se );
   se.printStackTrace();
} catch (IOException se) {
   se.printStackTrace();
}
return parser.getDocument( );


thanks,
-adrian.
--
Adrian Powell
[EMAIL PROTECTED]





Reply via email to