Open dkus opened 1 month ago
Hi,
I have two XSDs with same namespace:
document.a.1.0.xsd
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.0" xmlns="urn:xsd:document.a.1.0" targetNamespace="urn:xsd:document.a.1.0"> <xs:element name="Document" type="DocumentType"></xs:element> <xs:complexType name="DocumentType"> <xs:sequence> <xs:element name="A1" type="xs:string" fixed="1"></xs:element> <xs:element name="A2" type="A2Type"></xs:element> </xs:sequence> </xs:complexType> <xs:complexType name="A2Type"> <xs:sequence> <xs:element name="A3" type="xs:string" fixed="3"></xs:element> </xs:sequence> </xs:complexType> </xs:schema>
document.a.1.0.add.xsd
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.0" xmlns="urn:xsd:document.a.1.0" targetNamespace="urn:xsd:document.a.1.0"> <xs:element name="Document" type="DocumentType"></xs:element> <xs:complexType name="DocumentType"> <xs:sequence> <xs:element name="A1" type="xs:string" fixed="2"></xs:element> <xs:element name="A2" type="A2Type_2"></xs:element> </xs:sequence> </xs:complexType> <xs:complexType name="A2Type_2"> <xs:sequence> <xs:element name="A3" type="xs:string" fixed="33"></xs:element> </xs:sequence> </xs:complexType> </xs:schema>
And I generally use validation using catalog. For this XSD's I have the following entries in catalog.
catalog.xml
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system"> <system systemId="document.a.1.0.xsd" uri="document.a.1.0.xsd" /> <system systemId="document.a.1.0.add.xsd" uri="document.a.1.0.add.xsd" /> <uri name="urn:xsd:document.a.1.0" uri="document.a.1.0.xsd" /> <uri name="urn:xsd:document.a.1.0" uri="document.a.1.0.add.xsd" /> </catalog>
The validation of the following XML passes in VsCode using this extension (I would say due to order of XSDs in catalog):
<?xml version="1.0" encoding="UTF-8"?> <p:Document xmlns:p="urn:xsd:document.a.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <p:A1>1</p:A1> <p:A2> <p:A3>3</p:A3> </p:A2> </p:Document>
But, this one fails:
<?xml version="1.0" encoding="UTF-8"?> <p:Document xmlns:p="urn:xsd:document.a.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <p:A1>2</p:A1> <p:A2> <p:A3>33</p:A3> </p:A2> </p:Document>
When I do validation in Java code I must choose the correct XSD to validate XML. The issue may be related to XERCESJ-1130.
Is there a way to do the similar in VsCode, keeping the catalog as-is, but choose correct XSD?
Hi,
I have two XSDs with same namespace:
document.a.1.0.xsd
document.a.1.0.add.xsd
And I generally use validation using catalog. For this XSD's I have the following entries in catalog.
catalog.xml
The validation of the following XML passes in VsCode using this extension (I would say due to order of XSDs in catalog):
But, this one fails:
When I do validation in Java code I must choose the correct XSD to validate XML. The issue may be related to XERCESJ-1130.
Is there a way to do the similar in VsCode, keeping the catalog as-is, but choose correct XSD?