Subject Re: [Firebird-Architect] Firebird and XML
Author Lester Caine
Milan Babuskov wrote:

> Anyway, I'd like to add XML support to my open source FBExport tool, that
> already exports Firebird data as CSV, Insert statements, and fbx format. I wish
> to add fixed-length and XML as options, so I'd like to know if a format similar
> to that used by the above mentioned FIXMLExport tool would be acceptable.

Just how you format the XML is academic, and not a lot of use. In the
real world, the format of the 'fields' required by an XML inquiry are
already defined, and the database engine is expected to populate them
with real data and return an answer. If all you are providing is a dumb
dump in XML format, then simply wrapping the CSV or fixed length record
in XML tags is just as valid - as long as that is how you define your
schema.

<long example - apology for noise, but I need to give real example />

*THIS* is a small sample of a real schema - just covering the address!
----------------------------------------------------------------------
<!-- Basic BS7666 Compliant Address Element -->
<xsd:complexType name="BSaddressStructure">
<xsd:sequence>
<xsd:element name="SAON" type="SAONtype" minOccurs="0">
<xsd:annotation>
<xsd:documentation>Secondary Addressable Object</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="PAON" type="PAONtype">
<xsd:annotation>
<xsd:documentation>Primary Addressable Object</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:sequence>
<xsd:element name="StreetDescription" type="StreetDescriptorType"/>
<xsd:element name="UniqueStreetReferenceNumber" type="USRNtype"
minOccurs="0"/>
</xsd:sequence>
<xsd:choice>
<xsd:sequence>
<xsd:element ref="Locality"/>
<xsd:choice minOccurs="0">
<xsd:sequence>
<xsd:element ref="Town"/>
<xsd:element ref="AdministrativeArea" minOccurs="0"/>
</xsd:sequence>
<xsd:element ref="AdministrativeArea"/>
</xsd:choice>
</xsd:sequence>
<xsd:sequence>
<xsd:element ref="Town"/>
<xsd:element ref="AdministrativeArea" minOccurs="0"/>
</xsd:sequence>
<xsd:element ref="AdministrativeArea"/>
</xsd:choice>
<xsd:element name="PostTown" type="PostTownType" minOccurs="0"/>
<xsd:element name="PostCode" type="PostCodeType" minOccurs="0"/>
<xsd:element name="UniquePropertyReferenceNumber" type="UPRNtype"
minOccurs="0"/>
</xsd:sequence>

--------------------------------------
And each element is defined like this
--------------------------------------
<!-- PostCode Definition -->
<xsd:simpleType name="PostCodeType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(GIR
0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVX]][0-9][A-HJKSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY]))))
[0-9][A-Z-[CIKMOV]]{2})"/>
</xsd:restriction>
</xsd:simpleType>

<!-- PAON Definition as 2000-->
<xsd:simpleType name="PAONtype">
<xsd:restriction base="xsd:string">
<xsd:minLength value="4"/>
<xsd:pattern value="[0-9 ]{4}[A-Z ]([0-9 ]{4}[A-Z ][0-Z%-+a-z
]{0,90})?"/>
</xsd:restriction>
</xsd:simpleType>
-------------------------------------
With another 40 or 50 element definitions following.

I *STILL* have not worked out what I should be sending when I receive an
XML request for a BS7666 address, but THIS is the sort of thing that
other XML interfaces are expecting to deal with.

So *WHAT* level of XML are you looking to support ;)

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services