Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Schema definition for a generic XML structure

Reply
Thread Tools

Schema definition for a generic XML structure

 
 
Ben
Guest
Posts: n/a
 
      07-30-2003
Due to my unfamiliarity with schemas, I am unable to figure out how to
accomplish the same type of processing that I have currently working
under a dtd. We have a pre-defined generic message header that must
appear on all XML messages in our shop. We have several processes
that just need to process the generic header to determine how to route
the message and which service needs to process the message. So we
have an XML structure that at a high level looks like this:

<Message>
<MessageHeader appID="" action=""></MessageHeader>
<MessageBody></MessageBody>
</Message>

The MessageBody gets redefined with application specific data. The
generic process does not need to know about the contents of the
MessageBody. The specific application reparses the message,
validating the contents and getting at its information. This a
relatively straight forward process but for the life of me I can't
seem figure out how to define this relationship properly in a schema.
With my current level of schema knowledge and using the above XML
example I would think I would start with the following as a base:

<xsd:schema xmlnssd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Message">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="MessageHeader"/>
<xsd:element ref="MessageBody"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MessageBody">
<xsd:complexType/>
</xsd:element>
<xsd:element name="MessageHeader">
<xsd:complexType>
<xsd:attribute name="action" type="xsd:string" use="optional"/>
<xsd:attribute name="appID" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

1) Is how I am defining this base schema (schema #1) wrong?
2) If I define this generic structure(schema #1) as my base, how do a
change this base to flesh out the MessageBody in another schema
(schema #2)? NOTE: I would still need to be able to parse/validate the
resulting XML defined by schema#2 using the schema #1 definition.

Thanks,
Ben
 
Reply With Quote
 
 
 
 
C. M. Sperberg-McQueen
Guest
Posts: n/a
 
      07-31-2003
(Ben) writes:

> Due to my unfamiliarity with schemas, I am unable to figure out how to
> accomplish the same type of processing that I have currently working
> under a dtd.


Can you show us the part of the DTD that makes it work. I would
be surprised if there is anything much you can do with XML DTDs
that you cannot do with XML Schema documents (or Relax NG, or
most other languages for XML schemas). [There are, to be sure,
some parameter-entity tricks which cannot be replicated using
XML Schema constructs -- but if you really find your back to the wall,
you can always replicate those parameter-entity tricks
using general entities.]

-C. M. Sperberg-McQueen
World Wide Web Consortium
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web.xml / XML schema issue, why do some XML schema attributes disappear asciz@starmail.com Java 3 02-20-2007 09:56 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
Schema - Definition for checking part of schema ? Abhinav XML 6 08-16-2004 06:24 PM
XML schema regular expressions question and recommended XML Schema book Fred Smith XML 1 02-05-2004 11:12 AM
Type definition in XML page with XML Schema chobin XML 0 12-10-2003 06:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57