I am trying to parse a XSD file. The parser parse method doesn’t give any Exception but when I use parser.getResult(), it returns null.
My XSD file have one Schema node in it.
XSOMParser parser = new XSOMParser();
parser.parse(new File(schemaPath)); //This runs fine
this.schemaSet = parser.getResult(); //here I get A null
Any ideas?
The javadoc for XSOMParser::getResult() states that it’ll return null if there was a parsing error. If your schema only has <xsd:schema/> and you’re getting null with your version of the parser, I would call it a bug in the implementation (an empty schema is a valid schema). If not, then I would explicitly attach an error handler to make sure there aren’t other issues at play. Most likely there’s something wrong with it.
Try to validate your XSD file first, using some sort of XML Schema validating tool. If your schema references external schemas, make sure that you specify a system id if your external references use relative URIs.