Reputation: 5445
This is probably a basic error for anyone with working knowledge of xml schemas and it probably is just a matter of a small config change in Eclipse Indigo, but it's exhausted my google search powers and all experiments failed to resolve it.
It's an xsd file in an existing project that functions happily. I am setting up the project to be a maven / dynamic web project in Eclipse and after turning on Eclipse's project facet for dynamic web project 2.4, Eclipse insists that I have problems with the file.
Here's the xsd start (with error logged on the pointer to www.w3.org/2001/xmlschema
)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions
name="ThreeDSecureService"
targetNamespace="http://magpie.webservices.valueobject.domain.acme.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://magpie.webservices.valueobject.domain.acme.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
and here are the errors:
s4s-elt-invalid: Element 'definitions' is not a valid element in a schema document. magpie.xsd /Model/src/main/resources line 8 XML Schema Problem
s4s-elt-schema-ns: The namespace of element 'definitions' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'. magpie.xsd /Model/src/main/resources line 8 XML Schema Problem
schema_reference.4: Failed to read schema document 'file:///home/adahar/projects/Model/src/main/resources/magpie.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not . magpie.xsd /Model/src/main/resources line 8 XML Schema Problem
Thanks for any help/advice.
Upvotes: 0
Views: 3894
Reputation: 5445
Turns out the file was garbage. It was a .wsdl file with the wrong file extension and it shouldn't have been there anyway. So Eclipse's error was justified and I've learnt something about webservices, and XSD too. I will be more wary of files from our SCM which were checked in by the committer who did that.
Upvotes: 3
Reputation: 19443
The root element of XSD must be xsd:schema
(not definitions
). Look at some XSD examples to see how to start. You need the xsd:
prefix because the XML namespace for the XSD elements is set to xsd
by this: xmlns:xsd="http://www.w3.org/2001/XMLSchema
Upvotes: 0