xsltproc: xsl:version: only 1.1 features are supported - xslt

Not looking to do anything spectacular here, just looking for, really, any sort of simple xslt which will run from xsltproc and give reasonably interesting output -- but simple.
thufir#dur:~/jaxb/ship$
thufir#dur:~/jaxb/ship$ ls
a.xslt shiporder.xml
thufir#dur:~/jaxb/ship$
thufir#dur:~/jaxb/ship$ cat shiporder.xml
<?xml version="1.0" encoding="UTF-8"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
thufir#dur:~/jaxb/ship$
thufir#dur:~/jaxb/ship$ trang shiporder.xml shiporder.xsd
thufir#dur:~/jaxb/ship$
thufir#dur:~/jaxb/ship$ ls
a.xslt shiporder.xml shiporder.xsd xsi.xsd
thufir#dur:~/jaxb/ship$
thufir#dur:~/jaxb/ship$ cat shiporder.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xs:import namespace="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="xsi.xsd"/>
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element ref="orderperson"/>
<xs:element ref="shipto"/>
<xs:element maxOccurs="unbounded" ref="item"/>
</xs:sequence>
<xs:attribute name="orderid" use="required" type="xs:integer"/>
<xs:attribute ref="xsi:noNamespaceSchemaLocation" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="address"/>
<xs:element ref="city"/>
<xs:element ref="country"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:NCName"/>
<xs:element name="item">
<xs:complexType>
<xs:sequence>
<xs:element ref="title"/>
<xs:element minOccurs="0" ref="note"/>
<xs:element ref="quantity"/>
<xs:element ref="price"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string"/>
<xs:element name="quantity" type="xs:integer"/>
<xs:element name="price" type="xs:decimal"/>
</xs:schema>
thufir#dur:~/jaxb/ship$
thufir#dur:~/jaxb/ship$ cat xsi.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xs:import schemaLocation="shiporder.xsd"/>
<xs:attribute name="noNamespaceSchemaLocation" type="xs:NCName"/>
</xs:schema>
thufir#dur:~/jaxb/ship$
thufir#dur:~/jaxb/ship$ cat a.xslt
<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:copy-of select="unparsed-text(static-base-uri())"/>
</xsl:template>
</xsl:stylesheet>
thufir#dur:~/jaxb/ship$
thufir#dur:~/jaxb/ship$ xsltproc a.xslt shiporder.xml > output.xml
compilation error: file a.xslt line 1 element stylesheet
xsl:version: only 1.1 features are supported
xmlXPathCompOpEval: function static-base-uri not found
XPath error : Unregistered function
xmlXPathCompiledEval: evaluation failed
no result for shiporder.xml
thufir#dur:~/jaxb/ship$
The xml is from w3school -- frankly, just looking to generate some sort of output using xsltproc, which means xslt version 1, I believe.

xsltproc uses the libxsltprocessor which supports only XSLT 1.0 or 1.1 (in some configurations).
Your XSLT contains:
<xsl:copy-of select="unparsed-text(static-base-uri())"/>
static-base-uri() is an XPath 2.0 function, and your processor cannot handle it - which is why you see:
xmlXPathCompOpEval: function static-base-uri not found
XPath error : Unregistered function
Note that unparsed-text() is an XSLT 2.0 function and you would get an error with it too, if the processor ever got that far.
just looking to generate some sort of output using xsltproc
Try the identity transform for starters?

Related

Parse soap msg with gSOAP

I have following example xml message:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<to>...</to>
<from>...</from>
<id>..</id>
<relatesTo>...</relatesTo>
<action>...</action>
<version>...</version>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<customComplexElement>
<a>a_v</a>
<b>b_v</b>
<c>c_v</c>
<d>d_v</d>
<e>e_v</e>
<f>f_v</f>
</customComplexElement>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
From which I have generated a xsd file with use of one of online tools:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"></import>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="id" type="xs:string"/>
<xs:element name="relatesTo" type="xs:string"/>
<xs:element name="action" type="xs:string"/>
<xs:element name="version" type="xs:string"/>
<xs:element name="customComplexElement">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="a"/>
<xs:element type="xs:string" name="b"/>
<xs:element type="xs:string" name="c"/>
<xs:element type="xs:string" name="d"/>
<xs:element type="xs:string" name="e"/>
<xs:element type="xs:string" name="f"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Then I generate the appropriate header file with wsdl2h.exe and then compile it with soapcpp2.exe compiler.
Then I try to read xml file with a function soap_read_customComplexElement() and all I get is SOAP_TAG_MISMATCH. This method seems to work if I get rid of all the soap stuff the message but I wonder if there are some functions in gSOAP to parse soap envelope, header and body?
I've had same problem. But i've just fixed it.
So, in my case i use this line of code.
struct soap *soap = soap_new1(SOAP_C_UTFSTRING | SOAP_XML_IGNORENS | SOAP_XML_TREE);
The key paramter is SOAP_XML_IGNORENS. This parameter ignore namespaces.
SOAP_XML_IGNORENS in: ignores the use of XML namespaces in input
The root of this problem is that you don't declare namespaces in your body content. That why gSoap don't know how to convert this xml.
This wouldn't be converted, because gSoap don't know what is ns4:
<ns4:ParseKeywords><ns4:Keyword>Hello</ns4:Keyword></ns4:ParseKeywords>
But if i declare namespace it will be converted
<ns4:ParseKeywords xmlns:ns4="com.idurdyev.idcommerce:ParseKeywords:1.0"><ns4:Keyword>Hello</ns4:Keyword></ns4:ParseKeywords>

Cannot find the declaration of element 'emp_comp'

It seems that I am facing some problem while validating this XML
This is XML ,which I have created.
<?xml version="1.0" encoding="UTF-8"?>
<emp_comp xmlns:xsi="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="http://localhost:9080/ermWeb/WebContent/XSD/Compensation.xsd">
<emp>
<row_id>0</row_id>
<emp_code>002</emp_code>
<emp_compdt>01-04-2014</emp_compdt>
<emp_cdata>
<emp_cname>Basic</emp_cname>
<emp_ccurr>INR</emp_ccurr>
<emp_camt>100.00</emp_camt>
</emp_cdata>
</emp>
</emp_comp>
Corresponding schema is
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="emp_comp">
<xs:complexType>
<xs:sequence>
<xs:element name="emp" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="row_id" type="xs:int" />
<xs:element name="emp_code" type="xs:string"
minOccurs="0" />
<xs:element name="emp_compdt"
minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern
value="|([0-3][0-9][\-](Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[\-][0-9]{4})" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="emp_cdata" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="emp_cname"
type="xs:string" minOccurs="0" />
<xs:element name="emp_ccurr"
type="xs:string" minOccurs="0" />
<xs:element name="emp_camt" minOccurs="0" > <!-- ^\d+\.\d{0,2}$ -->
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]+(\.[0-9][0-9]?)?" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Error which I am getting is Cannot find the declaration of element 'emp_comp'
what could be the reason for this.
Change:
xmlns:xsi="http://www.w3.org/2001/XMLSchema"
To:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Then, provided that you do really have your XSD at http://localhost:9080/ermWeb/WebContent/XSD/Compensation.xsd, it will work. Pull it up in a browser to be sure.
Problem
The problem is on first tag, remove this declaration xmlns:xsi="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="http://localhost:9080/ermWeb/WebContent/XSD/Compe‌​nsation.xsd" and and fix <emp_compdt>01-APR-2014</emp_compdt>
Possible Solution
Define a namespace on XSD targetNamespace="http://namespace"
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://namespace">
<xs:element name="emp_comp">
<xs:complexType>
<xs:sequence>
<xs:element name="emp" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="row_id" type="xs:int" />
<xs:element name="emp_code" type="xs:string"
minOccurs="0" />
<xs:element name="emp_compdt"
minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern
value="|([0-3][0-9][\-](Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[\-][0-9]{4})" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="emp_cdata" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="emp_cname"
type="xs:string" minOccurs="0" />
<xs:element name="emp_ccurr"
type="xs:string" minOccurs="0" />
<xs:element name="emp_camt" minOccurs="0" > <!-- ^\d+\.\d{0,2}$ -->
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]+(\.[0-9][0-9]?)?" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
the XML could be
<ns1:emp_comp xmlns:ns1="http://namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://namespace http://localhost:9080/ermWeb/WebContent/XSD/Compensation.xsd">
<emp>
<row_id>0</row_id>
<emp_code>002</emp_code>
<emp_compdt>01-APR-2014</emp_compdt>
<emp_cdata>
<emp_cname>Basic</emp_cname>
<emp_ccurr>INR</emp_ccurr>
<emp_camt>100.00</emp_camt>
</emp_cdata>
</emp>
</ns1:emp_comp>
Ok, this might be first I am answering my own Question
<?xml version="1.0" encoding="UTF-8"?>
<emp_comp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://localhost:9080/ermWeb/XSD/Compensation.xsd">
<emp>
<row_id>0</row_id>
<emp_code>002</emp_code>
<emp_compdt>01-Jan-2014</emp_compdt>
<emp_cdata>
<emp_cname>Basic</emp_cname>
<emp_ccurr>INR</emp_ccurr>
<emp_camt>100.00</emp_camt>
</emp_cdata>
<emp_cdata>
<emp_cname>VPF</emp_cname>
<emp_ccurr>INR</emp_ccurr>
<emp_camt>120.00</emp_camt>
</emp_cdata>
<emp_cdata>
<emp_cname>Employer NPS</emp_cname>
<emp_ccurr>INR</emp_ccurr>
<emp_camt>130.00</emp_camt>
</emp_cdata>
<emp_cdata>
<emp_cname>Employee NPS</emp_cname>
<emp_ccurr>INR</emp_ccurr>
<emp_camt>140.00</emp_camt>
</emp_cdata>
</emp>
</emp_comp>
there were 3 errors as they are pointed out by other answers.
1)01-04-2014 is incorrect, 04 must be replaced by APR
2)xmlns:xsi="http://www.w3.org/2001/XMLSchema" , must add -instance in the end
and
3) I need to use the XSD resource with the nameSpace ,to do that I have to add noNamespace before SchemaLocation in xsi:
Now XML is getting validated in accordance with XSD.

codesynthesis not parsing my xml file

I am using codesynthesis to generate classes which represent my xsd file. The xml file has been validated against the schema file using an online validation program and it seems to be fine. However upon running my program which simply reads the xml and attempts to create the structures representing the xml file i get exceptions for every element such as : error: attribute 'dburl' is not declared for element 'quantoptions', error: no declaration found for element 'option' and error: no declaration found for element 'symbol'. Can someone please advise as to why this is happening?
This is the XML file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Document created with online XML Editor http://xmlgrid.net 2013/09/08 2:17:41 -->
<quantoptions dburl="test attribute">
<option>
<symbol>test string</symbol>
<dateselection enddate="2002-09-24" startdate="2002-09-24"></dateselection>
</option>
<option>
<symbol>test string</symbol>
<dateselection enddate="2002-09-24" startdate="2002-09-24"></dateselection>
<blackscholes>false</blackscholes>
<volatility>true</volatility>
</option>
</quantoptions>
this is the xsd file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="quantoptions">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="1" name="option">
<xs:complexType>
<xs:sequence maxOccurs="1" minOccurs="1">
<xs:element maxOccurs="1" minOccurs="1" name="symbol" type="xs:string"/>
<xs:element maxOccurs="1" minOccurs="1" name="dateselection">
<xs:complexType>
<xs:attribute name="enddate" type="xs:date" use="required"/>
<xs:attribute name="startdate" type="xs:date" use="required"/>
</xs:complexType>
</xs:element>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element maxOccurs="1" minOccurs="1" name="blackscholes" type="xs:boolean"/>
<xs:element maxOccurs="1" minOccurs="1" name="volatility" type="xs:boolean"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="dburl" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
and finally here is the code, exception is thrown on this line: std::auto_ptr optionConfig (quantoptions_ (configPath));
const std::string configPath = "../config/quantoptions.xml";
std::auto_ptr<quantoptions> optionConfig (quantoptions_ (configPath));
optionConfig->dburl();
for(quantoptions::option_const_iterator i (optionConfig->option().begin()); i != optionConfig->option().end(); ++i)
{
std::cout<< i->symbol();
}
thanks in advance
finally fixed the problem, i am not sure if this was documented but although the xml was well formed, code synthesis was looking for the following lines within xml : . so the working xml looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Document created with online XML Editor http://xmlgrid.net 2013/09/08 2:17:41 -->
<quantoptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd" dburl="test attribute">
<option>
<symbol>test string</symbol>
<dateselection enddate="2002-09-24" startdate="2002-09-24"></dateselection>
</option>
<option>
<symbol>test string</symbol>
<dateselection enddate="2002-09-24" startdate="2002-09-24"></dateselection>
<blackscholes>false</blackscholes>
<volatility>true</volatility>
</option>
</quantoptions>

how to use BW mapper to replace the values in one XML by another xml?

I have following xml:
usa11.xml:
<?xml version="1.0" encoding="UTF-8"?>
<country xmlns="http://www.tibco.com/xmlns/ApplicationManagement" >
<state name="CA">
<city>
<street>El Comino Ave.</street>
<library>library 11111.</library>
</city>
<city>
<street>DeAnza Ave.</street>
<library>library 22222.</library>
</city>
<city>
<street>shoreline Ave.</street>
<library>library 33333.</library>
</city>
</state>
</country>
and another xml:
usa22.xml:
<?xml version="1.0" encoding="UTF-8"?>
<country xmlns="http://www.tibco.com/xmlns/ApplicationManagement" >
<state name="CA">
<city>
<street>El Comino Ave.</street>
<library>library AAAAA.</library>
</city>
<city>
<street>DeAnza Ave.</street>
<library>library BBBBB.</library>
</city>
</state>
</country>
then I hope to use Tibco BW mapper to use usa22.xml's elements vaules to replace usa11.xml's ones ONLY if their street names are same: then get output usa33.xml as follows out.xml:
<?xml version="1.0" encoding="UTF-8"?>
<country xmlns="http://www.tibco.com/xmlns/ApplicationManagement">
<state name="CA">
<city>
<street>El Comino Ave.</street>
<library>library AAAAA.</library>
</city>
<city>
<street>DeAnza Ave.</street>
<library>library BBBBB.</library>
</city>
<city>
<street>shoreline Ave.</street>
<library>library 33333.</library>
</city>
</state>
</country>
Please throw some lights how to use Tibco BW mapper to do this value replacing??
Schema as follows:
usa.xsd:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.tibco.com/xmlns/ApplicationManagement" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="country">
<xs:complexType>
<xs:sequence>
<xs:element name="state">
<xs:complexType>
<xs:sequence>
<xs:element name="city" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="street"/>
<xs:element type="xs:string" name="library"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="name"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Thanks so much!!!
An easy way to do what you are asking for is to place a XML/Parse XML activity inside a Group in your BW processs, and make it iterate through your usa11.xml. In each loop, you can make the decision by xPath and choose if to replace the contents of the current
element or not.
Link to Designer screenshot
Hope that helps a bit!

Primary and foreign keys in xml schema

I am trying to insert primary and foreign keys in XSD schema file below :-
Primary key is StudentID and Foreign Keys are courseID, AddressID, GradeID.
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Student">
<xs:complexType>
<xs:sequence>
<xs:element name="Title" type="xs:string"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Dateborn" type="xs:date"/>
<xs:element name="Gender" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
However above code is not working in my setup please help me in tracing the issue,
In general you would need to put more details in a question... So this should be enough to understand what else you might need to define, and how. I'll tackle what's needed to understand how to define a primary key/foreign key by illustrating an assumed student/address relationship.
First you need to define a context where these constraints hold true. In my modified XSD, I call it the "World".
<?xml version="1.0" encoding="utf-8" ?>
<!-- XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="World">
<xs:complexType>
<xs:sequence>
<xs:element ref="Student" maxOccurs="unbounded"/>
<xs:element ref="Address" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:key name="PKStudents">
<xs:selector xpath="Student/StudentID"/>
<xs:field xpath="."/>
</xs:key>
<xs:key name="PKAddresses">
<xs:selector xpath="Address/AddressID"/>
<xs:field xpath="."/>
</xs:key>
<xs:keyref name="FKStudentToAddress" refer="PKAddresses">
<xs:selector xpath="Student/AddressID"/>
<xs:field xpath="."/>
</xs:keyref>
</xs:element>
<xs:element name="Student">
<xs:complexType>
<xs:sequence>
<xs:element name="Title" type="xs:string"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Dateborn" type="xs:date"/>
<xs:element name="Gender" type="xs:string"/>
<xs:element name="StudentID" type="xs:string"/>
<xs:element name="AddressID" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Address">
<xs:complexType>
<xs:sequence>
<xs:element name="AddressID" type="xs:string"/>
<xs:element name="Street" type="xs:string"/>
<xs:element name="City" type="xs:string"/>
<xs:element name="Province" type="xs:string" minOccurs="0"/>
<xs:element name="Country" type="xs:date" minOccurs="0"/>
<xs:element name="PostalCode" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Then an XML like this would pass or fail, depending on what you do with the values in the StudentID and AddressID fields.
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<World xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Student>
<Title>Title1</Title>
<FirstName>FirstName1</FirstName>
<LastName>LastName1</LastName>
<Dateborn>1900-01-01</Dateborn>
<Gender>Gender1</Gender>
<StudentID>StudentID1</StudentID>
<AddressID>AddressID1</AddressID>
</Student>
<Student>
<Title>Title1</Title>
<FirstName>FirstName1</FirstName>
<LastName>LastName1</LastName>
<Dateborn>1900-01-01</Dateborn>
<Gender>Gender1</Gender>
<StudentID>StudentID2</StudentID>
<AddressID>AddressID1</AddressID>
</Student>
<Address>
<AddressID>AddressID1</AddressID>
<Street>Street1</Street>
<City>City1</City>
<Province>Province1</Province>
<Country>1900-01-01</Country>
<PostalCode>PostalCode1</PostalCode>
</Address>
<Address>
<AddressID>AddressID2</AddressID>
<Street>Street1</Street>
<City>City1</City>
<Province>Province1</Province>
<Country>1900-01-01</Country>
<PostalCode>PostalCode1</PostalCode>
</Address>
</World>
To finish your solution, you would need to define the Course and Grade "entities" in your "world", define the xs:key for each, similar to Student/*Address*, then add CourseID and GradeID attributes to the entities that need them, and finally, define the keyref, as above, for Entity to Grade and Entity to Course.