R: [jdom-interest] SAXBuilder inclusion of default attributes
Ing. Terenzio Berni
tberni at dianoema.it
Tue Jan 20 02:53:18 PST 2004
Apparently I have the same problem Harry Evans reported.
I've tried his solution (setting up an entity resolver):
SAXBuilder builder = new SAXBuilder();
builder.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId) {
return new InputSource(new ByteArrayInputStream(new byte[0]));
}
});
after this I set up the XSD schema validation with these instructions:
saxBuilder.setFeature("http://apache.org/xml/features/validation/schema",
true);
saxBuilder.setFeature("http://xml.org/sax/features/namespaces",true);
saxBuilder.setProperty("http://apache.org/xml/properties/schema/external-sch
emaLocation","urn:hl7-org:v2xml file:///C:/HL7/xsd/messages.xsd");
but when I try to create the JDOMDocument via:
Document document = builder.build(inputstream);
I get a JDOMParseException (here reported)
org.jdom.input.JDOMParseException: Error on line -1: Premature end of file.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:381)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:684)
at HL7InOutWithJDOM.main(HL7InOutWithJDOM.java:49)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:370) ... 2 more
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:370)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:684)
at HL7InOutWithJDOM.main(HL7InOutWithJDOM.java:49)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:370)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:684)
at HL7InOutWithJDOM.main(HL7InOutWithJDOM.java:49)
Regards,
Terenzio Berni
More information about the jdom-interest
mailing list