0

Document document = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); document = parser.paser(xmlFilePath);

ParseException SaxException IOException

returned document without exception.

Using xmllist "schema" xml validated

SchemaFactory schema = SchemaFactory.newInstance(XMLConstanst.W3C_XML_SCHEMA_NS_URI);

Schema schema = schemaFactory.newSchema(new Source []{new StreamSource(xsd1), new StreamSource(xsd2), new StreamSource(xsd3), newStreamSource(xsd4)})

Validator validator = schema.newValidator(); validator.setErrorHandler(new CustomHandler);

validator.validate(new DOMSource(document);

SAXParseException cvc-elt.1 Cannot find the declaration of element "ElementinQuestion"

String node = document.getNodeName();

node = #document

When the following is added the node returns the same exception above

String node = document.getFirstChildNode().getNodeName();

node = "ElementinQuestion"

xsd

<s: element name = "ElementinQuestion" type = elementinquestion:ElementinQuestion"

What else can I check?

1 Answer 1

0

Added this line and the exception was resolved prior to creating the document (Found this scrolling down to the bottom Cvc-elt.1: Cannot Find The Declaration Of Element 'soap:Envelope')

Document document = null;
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(true);

DocumentBuilder parser = DocumentBuilderFactory.newInstance(); 
document = parser.paser(xmlFilePath);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.