Merging Multiple xsd into Single File

Questions about XML that are not covered by the other forums should go here.
cosmarchy
Posts: 1
Joined: Wed Nov 23, 2016 10:43 pm

Merging Multiple xsd into Single File

Post by cosmarchy » Wed Nov 23, 2016 10:57 pm

Hi,

I'm trying to merge two schemas into a single file. I have the following code, which I have taken as a basis to get started:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:resourcedata type="acquisition">
<xs:details>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="resource">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:long" name="identifier"/>
<xs:element type="xs:string" name="requestedby"/>
<xs:element type="xs:string" name="product"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</xs:details>
</xs:resourcedata>
<xs:resourcedata type="warningletter">
<xs:details>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="resource">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:long" name="identifier"/>
<xs:element type="xs:string" name="email"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</xs:details>
</xs:resourcedata>
</xs:schema>
However I get the following error message in <oXygen/> XML editor:
Engine name: Xerces
Severity: error
Description: s4s-elt-invalid-content.1: The content of 'schema' is invalid. Element 'resourcedata' is invalid, misplaced, or occurs too often.
I can see resourcedata appears too often but I'm not sure how I correct this to allow multiple schemas in a single file.

Thanks

Radu
Posts: 6398
Joined: Fri Jul 09, 2004 5:18 pm

Re: Merging Multiple xsd into Single File

Post by Radu » Thu Nov 24, 2016 9:36 am

Hi,

The XML Schema vocabulary specification:

https://www.w3.org/TR/xmlschema-1/

defines a set of schema element names. You are using tags like xs:resourcedata or xs:details which are not part of the XML Schema specification.
Maybe you should try to google and read an XML Schema tutorial, just to understand what a schema is and how multiple schemas can be combined.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply