OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] XML Schema: Getting lookup tables from DB

[ Lists Home | Date Index | Thread Index ]

Hi Craig,

Long, Craig Z wrote:

>I have a schema file that will validate large lookup tables.  I'm wanting to
>include another .XSD in my main .XSD that will grab the lookup table
>information.  For example: States are identified by two characters i.e. HI =
>Hawaii,  instead of enumerating these state codes I want to get them from a
>data base.  The state codes are easy, my issue would be codes that identify
>many organizations that may change often -- can this be done using XML
>Schema?
>
Interesting question. One answer might be  the  use of URL addressable 
(REST-compatible) web services. You could pick up a dynamically 
generated enum at schema-load time by having, for example,

    <xs:include 
schemaLocation="http://myServer/lookups.dll?trans=states&typeName=statesType&format=schemaEnum"; 
/>

If you don't want to use enums at all (maybe the dataset is too large) 
then you could use a schematron assertion to individually check fields 
online at runtime, for example:

<sch:schema xmlns:sch="http://www.ascc.net/xml/schematron";>
    <sch:ns prefix="cdyne" uri="http://ws.cdyne.com/"; />
    <sch:title>Schematron Validator for cardlist</sch:title>
    <sch:pattern name="valid card number">
        <sch:rule context="card">
            <sch:assert 
test="document(concat('https://secure.cdyne.com/creditcardverify/luhnchecker.asmx/CheckCC?CardNumber=', 
@number))/cdyne:ReturnIndicator/cdyne:CardValid = 'true'">Invalid card 
number</sch:assert>
        </sch:rule>
    </sch:pattern>
</sch:schema>

(this actually works - apologies to cdyne.com if the service starts 
getting hammered)

Obviously the choice between schema build time, schema load time and 
field validation time calls involves performance, server workload and 
versional integrity issues which should be considered carefully.

Francis.





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS