Steve
Steve

Reputation: 31

Cannot find the declaration of element -SOAP

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?

Upvotes: 0

Views: 68

Answers (1)

Steve
Steve

Reputation: 31

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);

Upvotes: 0

Related Questions