OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xml-dev] [Q] Xerces and DOM2 getInternalSubset



[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@megginson.com