I have an XML (first.xml) which looks like ::
<?xml version="1.0" encoding="utf-8"?>
<saw:jobInfo xmlns:saw="com.analytics.web/report/v1.1">
<saw:jobStats>...........</saw:jobStats>
<saw:detailedInfo> .....</saw:detailedInfo>
<saw:fileInfo>..........</saw:fileInfo>
</saw:jobInfo>
The below XML (second.xml) is same as the above but with a different namespace.
<?xml version="1.0" encoding="utf-8"?>
<soap:jobInfo xmlns:soap="urn://bi.webservices/v6">
<soap:jobStats>...........</saw:jobStats>
<soap:detailedInfo> .....</saw:detailedInfo>
<soap:fileInfo>..........</saw:fileInfo>
</soap:jobInfo>
As I have the same element and attribute names in both the xml's I am using the same xsd file to validate both.
XSD file ::
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="com.analytics.web/report/v1.1"
xmlns="com.analytics.web/report/v1.1"
xmlns:saw="com.analytics.web/report/v1.1"
xmlns:soap="urn://bi.webservices/v6"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
After including xmlns:soap="urn://bi.webservices/v6" the schema validation failed for second.xml saying unkown element "soap:jobinfo". I poked around and found the targetNamespace value should be same as the namespace URI. Please let me know how to use the same XSD for two different namespaces having different URIs.