Working with XML 1.1 in Oxygen XML Editor version 23.1.
Originally I wandted to make an xsd schema that can have a complexType-element with a child-element, an extension and a bunch of attributes. A first possible solution I was able to get here but figured out it didn't fit to my problem, because the child-element itself consists of several elements and attributes which makes the original approach invalid, causing the error message: "The content type of a derived type and that of its base must both be mixed or both be element-only. Type 'complexTypeContent' is mixed, but its base type is not".
To my problem itself: The aim is for the child-element random to only be used when the attribute until has the value 'random'. So in the end a XML-file like this should be valid:
<instruction>
<type repeat='1' until='random'><random start='1' end='6'/>Dice Roll</type>
</instruction>
Instead - if the attribute until has not the value "random" - the element random must not be allowed. So something like this should be forbidden:
<instruction>
<type repeat='1' until='2'><random start='1' end='6'/>Dice Roll</type>
</instruction>
With help from here I was able to modify my xsd-scheme to something like this. But as already stated, it doesn't compile without an error message:
<xs:element name="root">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="instruction" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="type">
<xs:alternative test="#until = 'random'" type="complexTypeContent"/>
<xs:alternative type="simpleTypeContent"/>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="complexTypeContent" mixed="true">
<xs:complexContent>
<xs:extension base="simpleTypeContent">
<xs:sequence>
<xs:element name="random" type="random" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="random">
<xs:attribute name="start">
<xs:simpleType>
<xs:restriction base="xs:integer"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="end">
<xs:simpleType>
<xs:restriction base="xs:integer"/>
</xs:simpleType>
</xs:attribute>
<xs:assert test="#start le #end"/>
</xs:complexType>
<xs:complexType name="simpleTypeContent" mixed="true">
<xs:simpleContent>
<xs:extension base="type2">
<xs:attribute name="until">
<xs:simpleType>
<xs:union memberTypes="type2 annotation xs:integer until"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="condition">
<xs:simpleType>
<xs:union memberTypes="type2 annotation extended"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="repeat" type='xs:integer'/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="type2">
<xs:restriction base="xs:string">
<xs:enumeration value="Dice Roll"/>
<xs:enumeration value="Wait"/>
<xs:enumeration value="Repeat"/>
<xs:enumeration value="Double Roll"/>
<xs:enumeration value="Instruction"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="until">
<xs:restriction base="xs:string">
<xs:enumeration value="end"/>
<xs:enumeration value="random"/>
<xs:enumeration value="Instruction"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="annotation">
<xs:restriction base="xs:string">
<xs:enumeration value="rolltwice"/>
<xs:enumeration value="halfcount"/>
<xs:enumeration value="doublecount"/>
<xs:enumeration value="roll-"/>
<xs:enumeration value="roll+"/>
<xs:enumeration value="numberChange"/>
<xs:enumeration value="NoNumberChange"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="extended">
<xs:restriction base="xs:string">
<xs:enumeration value="noRolling"/>
<xs:enumeration value="noEven"/>
<xs:enumeration value="noUneven"/>
<xs:enumeration value="stopped"/>
</xs:restriction>
</xs:simpleType>
The error messages I had now all imply that this solution is invalid because of the not mixed content of simpleTypeContent or because it has simpleContent which cannot be derived from the complex content of complexTypeContent. So, how do I get it working? I cannot figure out any working solution for the problem I am facing.
As far as I understand, XSD (not even 1.1) doesn't offer a way to restrict the mixed content text to some simple type, so the only way, if you really need that single element together with a certain list of values seems to be an assertion; that means, unfortunately, you need to duplicate the values you also want for an attribute.
So some (slightly adapted, see my comment about the `#until = 'random' check) sample schema would be
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.1">
<xs:element name="root">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="instruction" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="type">
<xs:alternative test="#until = 'random'" type="complexTypeContent"/>
<xs:alternative type="simpleTypeContent"/>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="complexTypeContent" mixed="true">
<xs:complexContent>
<xs:extension base="simpleTypeContent">
<xs:sequence>
<xs:element name="random" type="random" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="random">
<xs:attribute name="start">
<xs:simpleType>
<xs:restriction base="xs:integer"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="end">
<xs:simpleType>
<xs:restriction base="xs:integer"/>
</xs:simpleType>
</xs:attribute>
<xs:assert test="#start le #end"/>
</xs:complexType>
<xs:complexType name="simpleTypeContent" mixed="true">
<xs:attribute name="until">
<xs:simpleType>
<xs:union memberTypes="type2 annotation xs:integer until"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="condition">
<xs:simpleType>
<xs:union memberTypes="type2 annotation extended"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="repeat" type='xs:integer'/>
<xs:assert test=". = ('Dice Roll', 'Wait', 'Repeat', 'Double Roll', 'Instruction')"/>
</xs:complexType>
<xs:simpleType name="type2">
<xs:restriction base="xs:string">
<xs:enumeration value="Dice Roll"/>
<xs:enumeration value="Wait"/>
<xs:enumeration value="Repeat"/>
<xs:enumeration value="Double Roll"/>
<xs:enumeration value="Instruction"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="until">
<xs:restriction base="xs:string">
<xs:enumeration value="end"/>
<xs:enumeration value="random"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="annotation">
<xs:restriction base="xs:string">
<xs:enumeration value="rolltwice"/>
<xs:enumeration value="halfcount"/>
<xs:enumeration value="doublecount"/>
<xs:enumeration value="roll-"/>
<xs:enumeration value="roll+"/>
<xs:enumeration value="numberChange"/>
<xs:enumeration value="NoNumberChange"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="extended">
<xs:restriction base="xs:string">
<xs:enumeration value="noRolling"/>
<xs:enumeration value="noEven"/>
<xs:enumeration value="noUneven"/>
<xs:enumeration value="stopped"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
and that then makes the first instruction in below sample (also slightly adapted as there was a spelling difference between the schema and the sample (Dice roll vs. Dice Roll) in your snippets) valid while the second is invalid:
<root>
<instruction>
<type repeat='1' until='random'><random start='1' end='6'/>Dice Roll</type>
</instruction>
<instruction>
<type repeat='1' until='2'><random start='1' end='6'/>Dice Roll</type>
</instruction>
</root>
Related
I have problem with my XSD schema. Task is simple, a have this xml:
<?xml version="1.0" encoding="UTF-8"?>
<Pisemnost nazevSW="EPO MF ČR" verzeSW="40.23.1">
<DPPDP8 verzePis="04.01">
<VetaP>
<VetaO>
<VetaU> All these elements can be repeated and have any order.
<VetaE> They can have any attributes, but they have no content.
<VetaF>
<VetaS>
<VetaUA>
<VetaUB>
<VetaUD>
<Prilohy>
-- Any content ---
</Prilohy>
</DPPDP8>
-- Any content ---
</Pisemnost>
I make this XSD schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Pisemnost">
<xs:complexType>
<xs:sequence maxOccurs="1">
<xs:element name="DPPDP8">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:choice>
<xs:element name="VetaD" />
<xs:element name="VetaE" />
<xs:element name="VetaF" />
<xs:element name="VetaO" />
<xs:element name="VetaP" />
<xs:element name="VetaS" />
<xs:element name="VetaU" />
<xs:element name="VetaUA" />
<xs:element name="VetaUB" />
<xs:element name="VetaUD" />
</xs:choice>
</xs:sequence>
<xs:attribute name="verzePis" />
</xs:complexType>
</xs:element>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="nazevSW" />
<xs:attribute name="verzeSW" />
</xs:complexType>
</xs:element>
</xs:schema>
I would like to add "Prilohy" element with any content to XSD, but all my ideas ends with an invalid XSD. Please, can anybody help me? I ask for help, because I cant XSD and it is complicated for me. Thanks for any ideas :)
According to the reference DPPDP8 schema from here It should look like this:
<xs:element maxOccurs="1" minOccurs="0" name="Prilohy">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="ObecnaPriloha">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="cislo" use="required">
<xs:annotation>
<xs:documentation>Pořadové číslo přílohy</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="4"/>
<xs:fractionDigits value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="nazev" use="optional">
<xs:annotation>
<xs:documentation>Popis přiloženého souboru</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="jm_souboru" use="optional">
<xs:annotation>
<xs:documentation>
<strong>Název přiloženého souboru.</strong><br/>povolené typy souborů jsou: DOC, DOCX, RTF, XLS, XLSX, PDF, JPG, TXT a TXT/CSV. Dále je možné přiložit podepsané (formát PKCS#7) a komprimované (formát ZIP) soubory, vždy však jde o jeden podepsaný nebo jeden komprimovaný soubor některého z podporovaných formátů. Součet velikostí všech souborů přiložených v elektronické podobě (tzv. e-příloh) může být nejvýše 4 000 kilobajtů.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="kodovani" use="optional">
<xs:annotation>
<xs:documentation>Kódování přiloženého souboru</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="base64"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="1" minOccurs="0" name="PredepsanaPriloha">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="cislo" use="required">
<xs:annotation>
<xs:documentation>Pořadové číslo přílohy</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="4"/>
<xs:fractionDigits value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="nazev" use="optional">
<xs:annotation>
<xs:documentation>Popis přiloženého souboru</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="jm_souboru" use="optional">
<xs:annotation>
<xs:documentation>
<strong>Název přiloženého souboru.</strong><br/>povolené typy souborů jsou: DOC, DOCX, RTF, XLS, XLSX, PDF, JPG, TXT a TXT/CSV. Dále je možné přiložit podepsané (formát PKCS#7) a komprimované (formát ZIP) soubory, vždy však jde o jeden podepsaný nebo jeden komprimovaný soubor některého z podporovaných formátů. Součet velikostí všech souborů přiložených v elektronické podobě (tzv. e-příloh) může být nejvýše 4 000 kilobajtů.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="kodovani" use="optional">
<xs:annotation>
<xs:documentation>Kódování přiloženého souboru</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="base64"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="kod" use="required">
<xs:annotation>
<xs:documentation>Kód přiloženého souboru</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="(PP_OPISPUV){1}"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
I need a required attribute or element only if a specific value of an enumeration is chosen. Example below:
<xs:element name="TYPE" type="TestEnum" />
<!-- // This Element should only required when TYPE = INTERNATIONAL -->
<xs:element name="IBAN"/>
</xs:complexType>
<xs:simpleType name="TestEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="NATIONAL"/>
<xs:enumeration value="INTERNATIONAL"/>
</xs:restriction>
</xs:simpleType>
XSD 1.1
Here's how use xs:assert to make IBAN be mandatory when TYPE = 'INTERNATIONAL':
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
vc:minVersion="1.1">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="TYPE" type="TestEnum" />
<!-- // This Element should only required when TYPE = INTERNATIONAL -->
<xs:element name="IBAN" minOccurs="0"/>
</xs:sequence>
<xs:assert test="not(TYPE = 'INTERNATIONAL') or IBAN"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="TestEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="NATIONAL"/>
<xs:enumeration value="INTERNATIONAL"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
I get an error on validation:
Error - Line 14, 36: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 36; s4s-elt-must-match.1: The content of 'simpleType' must match (annotation?, (restriction | list | union)). A problem was found starting at: attribute.
How to resolve it?
My XML fragment
<CHANEL_NAME lang="RUS/MD">N4</CHANEL_NAME>
And XSD:
<xs:element name="CHANEL_NAME">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="40"/>
</xs:restriction>
<xs:attribute name="lang">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="MD"/>
<xs:enumeration value="RUS"/>
<xs:enumeration value="RUS/MD"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:simpleType>
</xs:element>
So I need in attribute 'lang' only determined values like 'MD', 'RUS' or 'RUS/MD'. I read examples and I guess it's OK.
Or is enumeration only for elements and not for attributes?
The problem is the first simpleType. Simple types can't have attribute.
You probably need a complex type with simple content. Something like:
<xs:element name="CHANEL_NAME">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="xs:string">
<xs:length value="40"/>
<xs:attribute name="lang">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="MD"/>
<xs:enumeration value="RUS"/>
<xs:enumeration value="RUS/MD"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
(Not tested.)
Also consider naming your anonymous types.
ps. Also consider using/restricting xs:language as language type.
Всего наилучшего.
I have a schema like below, the color elements of default and instance have identical restriction (red/green/blue). I want to move the restriction to higher level and set all color element with it (Like declare a type or enum in Java/C#)
How can I do for that?
<xs:element name="something">
<xs:complexType>
<xs:sequence>
<xs:element name="instance" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="color" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="red"/>
<xs:enumeration value="green"/>
<xs:enumeration value="blue"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="default">
<xs:complexType>
<xs:attribute name="color" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="red"/>
<xs:enumeration value="green"/>
<xs:enumeration value="blue"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Define the type:
<xs:simpleType name="colorenum">
<xs:restriction base="xs:string">
<xs:enumeration value="red"/>
<xs:enumeration value="green"/>
<xs:enumeration value="blue"/>
</xs:restriction>
</xs:simpleType>
And reference it:
<xs:attribute name="color" type="colorenum" />
I have an XSD that I created. A Transaction Header can one or more Transaction-Items. This XSD will only allow ONE Transaction Header and multiple Transaction-Items in an XML file. I am looking for MULTIPLE Transaction Headers with it's related multiple Transaction-Items. What is missing in the XSD to allow me to do this? Thanks.
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2010 (http://www.altova.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="transaction-item">
<xs:complexType>
<xs:sequence>
<xs:element ref="StartDate"/>
<xs:element ref="EndDate"/>
<xs:element ref="Amount"/>
<xs:element ref="BusinessPartnerID"/>
<xs:element ref="Description"/>
</xs:sequence>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Production or Import"/>
<xs:enumeration value="Transfer: Release Obligation"/>
<xs:enumeration value="Transfer: Retain Obligation"/>
<xs:enumeration value="Acquire: Without Obligation"/>
<xs:enumeration value="Acquire: With Obligation"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="Amount">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger"/>
</xs:simpleType>
</xs:element>
<xs:element name="Year">
<xs:simpleType>
<xs:restriction base="xs:short"/>
</xs:simpleType>
</xs:element>
<xs:element name="TransactionHeader">
<xs:complexType>
<xs:sequence>
<xs:element ref="Quarter"/>
<xs:element ref="Year"/>
<xs:element ref="FuelPathwayCode"/>
<xs:element ref="PhysicalPathwayCode"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="StartDate">
<xs:simpleType>
<xs:restriction base="xs:date"/>
</xs:simpleType>
</xs:element>
<xs:element name="Quarter">
<xs:simpleType>
<xs:restriction base="xs:byte"/>
</xs:simpleType>
</xs:element>
<xs:element name="PhysicalPathwayCode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="PP001"/>
<xs:enumeration value="PP002"/>
<xs:enumeration value="PP003"/>
<xs:enumeration value="PP004"/>
<xs:enumeration value="PP005"/>
<xs:enumeration value="PP006"/>
<xs:enumeration value="PP007"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="LCFS-report">
<xs:complexType>
<xs:sequence>
<xs:element ref="TransactionHeader"/>
<xs:element ref="transaction-item" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="total-sum" use="required">
<xs:simpleType>
<xs:restriction base="xs:byte"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="detailed" type="xs:boolean" use="required"/>
<xs:attribute name="currency" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="USD"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="FuelPathwayCode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="CARBOB001"/>
<xs:enumeration value="CARBOB002-HIGH"/>
<xs:enumeration value="CARBOB002-INC"/>
<xs:enumeration value="Ethanol001"/>
<xs:enumeration value="Ethanol002"/>
<xs:enumeration value="Ethanol003"/>
<xs:enumeration value="Ethanol004"/>
<xs:enumeration value="Ethanol005"/>
<xs:enumeration value="Ethanol006"/>
<xs:enumeration value="Ethanol007"/>
<xs:enumeration value="Ethanol008"/>
<xs:enumeration value="Ethanol009"/>
<xs:enumeration value="Ethanol0010"/>
<xs:enumeration value="Ethanol0012"/>
<xs:enumeration value="Fossil CNG001"/>
<xs:enumeration value="Fossil CNG002"/>
<xs:enumeration value="Biogas CNG001"/>
<xs:enumeration value="Electricity001_30"/>
<xs:enumeration value="Electricity002_27"/>
<xs:enumeration value="ULSD-CA Diesel Fuel"/>
<xs:enumeration value="Compressed Hydrogen001"/>
<xs:enumeration value="Liquid Hydrogen001"/>
<xs:enumeration value="Compressed Hydrogen002"/>
<xs:enumeration value="Compressed Hydrogen003"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="EndDate">
<xs:simpleType>
<xs:restriction base="xs:date"/>
</xs:simpleType>
</xs:element>
<xs:element name="Description">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:element>
<xs:element name="BusinessPartnerID">
<xs:simpleType>
<xs:restriction base="xs:short"/>
</xs:simpleType>
</xs:element>
</xs:schema>
First, I would convert your TransactionHeader to a separate type:
<xs:complexType name="TransactionHeaderType">
<xs:sequence>
<xs:element ref="Quarter"/>
<xs:element ref="Year"/>
<xs:element ref="FuelPathwayCode"/>
<xs:element ref="PhysicalPathwayCode"/>
</xs:sequence>
</xs:complexType>
Then you can define a new element of complex type that can contain any number of transaction headers:
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element name="TransactionHeader"
type="TransactionHeaderType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
By default, in XML Schema, minOccurs and maxOccurs both are set to 1 - but in a sequence, you can change that number to anything you like - including the "unbounded" for maxOccurs.
Marc