I've run across a NullPointerException when parsing an XML document against
a schema and when that schema references an ENTITY in the content of a
textEntity delcaration that was defined in the internal DTD of the schema.
Wow, the sample code is shorter than the description!

I've just started working my way through the source code but if this is a
known problem or someone's got a quick fix, I'd appreciate the feedback.

Thanks,
george

-----environment
Windows NT 4.0sp4
Sun Win32 JDK 1.2.2
Xerces-J 1.0.0

-----command
java sax.SAXWriter test.xml

-----XML instance document (test.xml)
<?xml version='1.0'?>
<test xmlns='test.xsd' aaa='&const;'/>

-----XML Schema  (test.xsd)
<?xml version="1.0"?>
<!DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"
"http://www.w3.org/XML/Group/1999/09/23-xmlschema/structures/structures.dtd";
[
<!ENTITY constant '999'>
]>
<schema>
<!-----------------------*problem**------------->
<textEntity name='const'>&constant;</textEntity>
<element name='test'><archetype content='empty'>
<attribute name='aaa' type='integer' default='&constant;'/>
<attribute name="xmlns"/>
</archetype></element>
</schema>

-----Stack Trace
java.lang.NullPointerException:
 at org.apache.xerces.utils.StringPool.addString(StringPool.java:251)
 at
org.apache.xerces.validators.schema.XSchemaValidator.traverseSchema(XSchemaV
alidator.java:1751)
 at
org.apache.xerces.validators.schema.XSchemaValidator.loadSchema(XSchemaValid
ator.java:1701)
 at org.apache.xerces.framework.XMLParser.scanAttValue(XMLParser.java:1923)
 at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanne
r.java:1800)
 at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
LDocumentScanner.java:991)
 at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
java:381)
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1129)
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1168)
 at sax.SAXWriter.print(SAXWriter.java:134)
 at sax.SAXWriter.main(SAXWriter.java:380)


Reply via email to