[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A Systematic Approach to using Simple XML Vocabularies to


example of invoice

On Dec 14, 2004, at 4:16 PM, Roger L. Costello wrote:

> My goal is for us (the xml-dev group) to collectively define a 
> systematic
> approach to using simple XML vocabularies to implement large (complex)
> systems.

I don't understand the goal... Implement what in a large complex system?

>
> Here is an example of an Invoice:
>
> <Invoice>
>     <PostalAddress id="RLC">
>         <Addressee>Roger L. Costello</Addressee>
>         <Street>38 Boylston St.</Street>
>         <City>Boston</City>
>         <State>MA</State>
>         <Zipcode>01320</Zipcode>
>     </PostalAddress>
>     <Book id="Bach">
>         <Title>Illusions</Title>
>         <Author>Richard Bach</Author>
>         <Date>1977</Date>
>         <ISBN>0-440-34319-4</ISBN>
>         <Publisher>Dell Publishing Co.</Publisher>
>     </Book>
> </Invoice>

Well, what's wrong with using that? or, at least, staying as close to 
it as possible? From the user's, analyst's and application programmer's 
points of view this is pretty comprehensible.

I'd like to show you how we'd do this at my company -- we implement 
complex systems, some would say large, though I understand both terms 
are relative. This is just to emphasise some of the possibilities that 
I haven't seen discussed in this thread yet (Len's model is almost the 
same but I've not noticed anyone discussing it). It also may illustrate 
why I'm asking what the purpose of this exercise is.

I'd probably write it like:

<Invoice pid="invoice 001" xmlns="http://example.com/invoice">
     <PostalAddress pid="RLC" xmlns="http://example.com/postal">
         <Addressee>Roger L. Costello</Addressee>
         <Street>38 Boylston St.</Street>
         <City>Boston</City>
         <State>MA</State>
         <Zipcode>01320</Zipcode>
     </PostalAddress>
     <Book pid="Bach" xmlns="http://example.com/book">
         <Title>Illusions</Title>
         <Author>Richard Bach</Author>
         <Date>1977</Date>
         <ISBN>0-440-34319-4</ISBN>
         <Publisher>Dell Publishing Co.</Publisher>
     </Book>
</Invoice>

This just adds a few namespace specifications. It also changes 'id' to 
'pid' which is in accordance with my company's normal practice. The 'p' 
in 'pid' stands for 'persistent'.

This is, in our system, exactly the same thing as writing:

<PostalAddress pid="RLC" xmlns="http://example.com/postal">
     <Addressee>Roger L. Costello</Addressee>
     <Street>38 Boylston St.</Street>
     <City>Boston</City>
     <State>MA</State>
     <Zipcode>01320</Zipcode>
</PostalAddress>

<Book pid="Bach" xmlns="http://example.com/book">
     <Title>Illusions</Title>
     <Author>Richard Bach</Author>
     <Date>1977</Date>
     <ISBN>0-440-34319-4</ISBN>
     <Publisher>Dell Publishing Co.</Publisher>
</Book>

<Invoice pid="invoice 001" xmlns="http://example.com/invoice">
    <PostalAddress pid="RLC" xmlns="http://example.com/postal"/>
    <Book pid="Bach" xmlns="http://example.com/book"/>
</Invoice>

With the possibility of using the same postal address and book any 
place we want.

We generally show humans the first form (and talk about the first form, 
though usually ignoring the namespaces) and show computers the second 
form.

We could just as well have used URLs for the pid (which would probably 
have been something like: <http://example.com/postal/RLC>).

We also could have used 'href' rather than 'pid' which would make this 
practically identical to what Len proposed (but 'href' is a bit too 
popular in existing XML vocabularies and we get conflicts -- yes, I 
know, we could have used namespaces on attributes, and we may do so 
sometime in the future, but there are difficulties with this that I 
won't go into here).

Note that this example says *nothing* about how the XML is stored. I 
can tell you that, so far, the advantages of storing the pieces in 
coherent chunks of XML are overwhelming. I find it interesting that the 
various "semantic net" like models that this thread seems to be 
discussing in detail only come up in discussions at my company when we 
talk about how to store the data -- nobody wants to actually *use* it 
like that.

----

I should also say that we have a tool that scans XML definitions like 
the one above and builds from it a Java framework (for lack of a better 
word) that supports the manipulation of those XML definitions. For 
three years I've been using this tool, or one of several ancestors 
since about 1998 (whenever it was that I first got my hands on David 
Megginson's Java SAX parser).

Cheers,
Bob


----
Bob Hutchison          -- blogs at <http://www.recursive.ca/hutch/>
Recursive Design Inc.  -- <http://www.recursive.ca/>


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.