DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11908>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11908

Doctype.getInternalSubset() returning null

           Summary: Doctype.getInternalSubset() returning null
           Product: Xerces2-J
           Version: 2.0.2
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I am using Xerces 2.0.2 to import XML documents and then export them later.
I am finding that if I import a document with an internal subset, and try
later to get that internal subset using the getInternalSubset(), the
returned value is null.  I was originally using Xerces 2.0.0 when I first
saw this, so I upgraded to 2.0.2 after reading through the list archives,
thinking that might solve the problem.  However, I had no such luck.

Here's the DOCTYPE node of the file I am importing:
<!DOCTYPE
config
SYSTEM "http://localhost:82/cw-client/dtds/config.dtd";
[
<!ENTITY general SYSTEM "general.xml">
<!ENTITY mainPane SYSTEM "mainPane.xml">
<!ENTITY searches SYSTEM "searches.xml">
]
>

Here's what it looks like when I export it:
<!DOCTYPE config SYSTEM "http://localhost:82/cw-client/dtds/config.dtd";>

Here is the specific code I use to export the DOCTYPE node when I encounter it 
when walking through the tree:
case Node.DOCUMENT_TYPE_NODE: {
                                        
  DocumentType docType = (DocumentType)node;                    
  String nodeName = node.getOwnerDocument().getDocumentElement().getNodeName
();  // this is the root element
                                
  // first part of buffer
  out.print("<!DOCTYPE " + nodeName);
                        
  String id = docType.getPublicId();

  if (id != null && id.length() > 0) {
    out.print(" PUBLIC \"" + id + "\"");
    id = docType.getSystemId();
    if (id != null && id.length() > 0)
      out.print(" \"" + id + "\"");
  }
  else {
    id = docType.getSystemId();                         
    if (id != null && id.length() > 0)
      out.print(" SYSTEM \"" + id + "\"");
  }
                        
d = docType.getInternalSubset();
                                if (cat.isDebugEnabled()) {
                                        if (id == null)
                                                cat.debug("internal subset is 
null");
                                        else if (id.length() == 0)
                                                cat.debug("internal subset 
length is 0");
                                }
                                if (id != null && id.length() > 0)
                                        out.print(" [ " + id + " ]");
                                
                                out.print(">\r\n");
                                break;
                        }


As you can see, the getSystemId() call works just fine, but
getInternalSubset seems to fail.  Here are the features I am setting:

parser.setFeature("http://xml.org/sax/features/validation";, validate);
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-
dtd",validate);
parser.setFeature("http://apache.org/xml/features/validation/schema";, validate);
parser.setFeature("http://xml.org/sax/features/external-general-entities";, 
expand);
parser.setFeature("http://xml.org/sax/features/external-parameter-entities";, 
expand);
parser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-
nodes", !expand);

where validate == false and expand == true (for this particular case).

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to