Hi,
for a class on XQuery someone wrote a simple XSchema from scratch and a sample instance. Both get evaluated for example by http://apps.gotdotnet.com/xmltools/xsdvalidator/; the Schema can be opened with the Tamino Schema Editor, validated and defined for a new database.
It is even possible to insert data to the database, but: I ran into problems querying the data.
A simple query like:
for $a in input() return $a
or X-Query for /
works fine, but anything more complicated results in an illegal cursor position or something like that. This is especially true for XPath expressions, however easy they are (yes, I checked spelling, etc. )
I can’t see any reason for that, but maybe someone of you will see it. Maybe it has something to do with self-defined (complex) data types? I never did this before, as all my other databases were based on a DTD and not on XSchema.
See Schema below and sample instance (no, that is not an actual person, just sample data).
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd=“XML Schema”
xmlns=“http://example.com/addressList”
targetNamespace=“http://example.com/addressList”
elementFormDefault=“qualified”>
<xsd:element name=“addressList” type=“AddressListType”/>
<xsd:complexType name=“AddressListType”>
xsd:sequence
<xsd:element name=“address” type=“AddressType” minOccurs=“0” maxOccurs=“50”/>
</xsd:sequence>
<xsd:attribute name=“Revision”>
xsd:simpleType
<xsd:restriction base=“xsd:date”>
<xsd:pattern value=“2003-\d{2}-\d{2}”/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name=“AddressType”>
xsd:choice
<xsd:element name=“person” type=“PersonType”/>
<xsd:element name=“firm” type=“FirmType”/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name=“PersonType”>
xsd:sequence
<xsd:element name=“pName” type=“PNameType”/>
<xsd:element name=“street” type=“NameType”/>
<xsd:element name=“number” type=“NrType”/>
<xsd:element name=“plz” type=“PlzType”/>
<xsd:element name=“city” type=“NameType”/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name=“FirmType”>
xsd:sequence
<xsd:element name=“fName” type=“xsd:string”/>
<xsd:element name=“street” type=“NameType”/>
<xsd:element name=“number” type=“NrType”/>
<xsd:element name=“plz” type=“PlzType”/>
<xsd:element name=“city” type=“NameType”/>
<xsd:element name=“pBox” type=“PbType”/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name=“PNameType”>
xsd:sequence
<xsd:element name=“first” type=“NameType” minOccurs=“1”/>
<xsd:element name=“last” type=“NameType” minOccurs=“1”/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name=“NameType”>
<xsd:restriction base=“xsd:string”>
<xsd:pattern value="[a-zA-Z
I guess you selected “addressList” as doctype before defining the schema to Tamino. For me the schema looks alright.
I will move this question to the XQuery thread, because the XQuery people are listening there.
P.S: Please attach your schema and instance and do not post it.