Thank you in advance for any assistance provided. I am attempting to validate an XML against an XSD that is importing another XSD. As simple as this sounds I am experiencing an interesting error that does not make sense to me.
The XML:
<?xml version="1.0" encoding="utf-8"?>
<tt:TroubleTicket xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tt="http://metadata.dod.mil/mdr/ns/netops/shared_data/trouble_ticket/0.4"
xsi:schemaLocation="http://metadata.dod.mil/mdr/ns/netops/shared_data/trouble_ticket/0.4 newSchemas/trouble_ticket.xsd">
<tt:troubleTicketID>
<!-- all child nodes -->
</tt:troubleTicketID>
</tt:TroubleTicket>
The Main XSD (trouble_ticket.xsd):
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http:/ww.w3.org/2001/XMLSchema-instance"
targetNamespace="http://metadata.dod.mil/mdr/ns/netops/shared_data/trouble_ticket/0.4"
xmlns:tt="http://metadata.dod.mil/mdr/ns/netops/shared_data/trouble_ticket/0.4"
xsi:schemaLocation="http://metadata.dod.mil/mdr/ns/netops/shared_data/trouble_ticket/0.4 newSchemas/trouble_ticket.xsd"
elementFormDefault="qualified">
<xsd:import namespace="http://metadata.dod.mil/mdr/ns/netops/net_defense/cnd-core/0.4" schemaLocation="cnd-core.xsd"/>
<!-- element declarations, simple and complex definitions -->
The imported XSD (cnd-core.xsd):
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://metadata.dod.mil/mdr/ns/netops/net_defense/cnd-core/0.4"
xmlns:cndc="http://metadata.dod.mil/mdr/ns/netops/net_defense/cnd-core/0.4"
elementFormDefault="qualified">
<!-- element declarations, simple and complex definitions -->
And finally the error that is generating when I attempt a validation:
[Error] :9:39: src-import.3.1: The namespace attribute, "http://metadata.dod.mil/mdr/ns/netops/net_defense/cnd-core/0.4" of an import element information item must be identical to the targetNamespace attribute, "http://metadata.dod.mil/mdr/ns/netops/shared_data/trouble_ticket/0.4", of the imported document.
So, I am guessing this deals with the attempted import of cnd-core.xsd into trouble_ticket.xsd. From what I can see, the namespace attribute of the import element (in trouble_ticket.xsd) DOES match the targetNamespace attribute of the document being imported (cnd-core.xsd). The targetNamespace attribute of the imported document is not what the error says it is. I am confused as to why the error shows the targetNamespace attribute to be different.
I have followed along with so many tutorials and publications to make sure I am setting these up correctly, but there must be something that I am missing. Any insight will be greatly appreciated! Thanks!