cvc-elt.1: Cannot find the declaration of element 'countries'
I am new learner of xml schema validation and found above error with
fileSchema.xsd:
> <xs:schema version="1.0"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://localhost:8080/ajaxprac"
> xmlns="http://localhost:8080/ajaxprac"
> elementFormDefault="qualified">
>
> <xs:element name="countries" type="xs:string"/>
> </xs:schema>
file.xml
<countries xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://localhost:8080/ajaxprac"
xsi:schemaLocation="http://localhost:8080/ajaxprac fileSchema.xsd">
This is the xml with just root element
</countries>
Factory Setting
DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
f.setValidating(true);
//f.setNamespaceAware(true);
try {
f.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
} catch (IllegalArgumentException e) {
System.out.println("Exception Occured: "+e.getMessage());
}
I have used
-test.namespace
-urn:Test.Namespace
instead of "http://localhost:8080/ajaxprac"
but facing same error.
Please find the error.
Thanks in advance.