Reputation: 1029
i want to add some XSD files to my Eclipse XML Catalog so it can validate XML files. Unfortunately the XSD includes and imports other XSD, and in turn they import other XSD files as well.
First XSD, BPMN20.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
targetNamespace="http://www.omg.org/spec/BPMN/20100524/MODEL">
<xsd:import namespace="http://www.omg.org/spec/BPMN/20100524/DI" schemaLocation="BPMNDI.xsd"/>
<xsd:include schemaLocation="Semantic.xsd"/>
...
Second XSD, Semantic.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.omg.org/spec/BPMN/20100524/MODEL">
<xsd:element name="activity" type="tActivity"/>
<xsd:complexType name="tActivity" abstract="true">
...
Eclipse immediately tells me that the second XSD can not be registered because it uses the same name space http://www.omg.org/spec/BPMN/20100524/MODEL
under which i already registered the first XSD.
Is it possible to solve this issues of XSDs importing/including other XSDs with Eclipse? I see lots of XSD files referencing other files, so it seems to be quite common to split type or attribute definitions and persist them in different files.
Thanks Joysn
Upvotes: 3
Views: 1948
Reputation: 492
You should avoid having different xsd files declaring the same namespace. A namespace is a URI so it should identify a single resource.
Check this tutorial about how to use/define namespaces: http://www.liquid-technologies.com/Tutorials/XmlSchemas/XsdTutorial_04.aspx
Upvotes: 1