[Home] [By Thread] [By Date] [Recent Entries]

  • From: David Megginson <david@m...>
  • To: xml-dev@l...
  • Date: Fri, 26 Oct 2001 13:09:02 -0400

[Apologies for posting this here, but the subscription process for the
Apache Xerces Java users' list has utterly failed.]

Does anyone happen to know what Xerces 1.4 or 2.0beta Java needs to
return a non-null value for the DOM2 DocumentType.getInternalSubset
method?  I know that proper support for the method is optional, but
Xerces seems to include code to handle it; unfortunately, the control
flow in Xerces is surprisingly complicated, and I haven't been able to
find how to invoke the code.

Here's a simple test program that compiles and runs for both the 1.*
and 2.* branches:

  import org.apache.xerces.parsers.DOMParser;

  public class XercesSubsetTest
  {

      public static void main (String args[])
	  throws Exception
      {
	  DOMParser parser = new DOMParser();
	  parser.setFeature("http://xml.org/sax/features/validation", true);
	  for (int i = 0; i < args.length; i++) {
	      parser.parse(args[i]);
	      System.out.println(parser.getDocument().getDoctype()
				 .getInternalSubset());
	  }
      }

  }


And here's a simple test document:

  <!DOCTYPE foo [
    <!ELEMENT foo (#PCDATA)>
    <!ENTITY x "y">
  ]>
  <foo></foo>


And finally, here's the result of running the program on my system
(Linux 2.4.12, Java 1.3.1, *both* Xerces 1.4 *and* 2.0beta):

  david@notebook:~/src/java$ java XercesSubsetTest foo.xml
  null
  david@notebook:~/src/java$ 


Thanks in advance for any help,


David

-- 
David Megginson
david@m...


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member