Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Schema question

Reply
Thread Tools

Schema question

 
 
Robert Dailey
Guest
Posts: n/a
 
      07-16-2007
Take the following XML:


<Frame type="Image" id="frame1">
<Draw/>
</Frame>

<Frame type="Text" id="frame2">
<Print/>
</Frame>


Is there a way in Schema to specify that the "Frame" element is
different (and thus requires different child elements) depending on
the value of an attribute (specifically the "type" attribute)?

 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      07-16-2007
Robert Dailey wrote:
> Is there a way in Schema to specify that the "Frame" element is
> different (and thus requires different child elements) depending on
> the value of an attribute (specifically the "type" attribute)?


Presence or absence, maybe. Value, I don't think so. Some of the other
schema(-like) languages do support that, or you can enforce that
constrating in the application code...


--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
 
Robert Dailey
Guest
Posts: n/a
 
      07-16-2007
On Jul 16, 1:05 pm, Joseph Kesselman <(E-Mail Removed)>
wrote:
> Robert Dailey wrote:
> > Is there a way in Schema to specify that the "Frame" element is
> > different (and thus requires different child elements) depending on
> > the value of an attribute (specifically the "type" attribute)?

>
> Presence or absence, maybe. Value, I don't think so. Some of the other
> schema(-like) languages do support that, or you can enforce that
> constrating in the application code...
>
> --
> Joe Kesselman / Beware the fury of a patient man. -- John Dryden


Thank you for your reply, it was the answer I was looking for.

I would also like to ask if it's possible to make a schema accept
either of the following attribute combinations for a single element:

<Offset x="0" y="0"/>
<Offset var="myvar"/>

Is this possible?

 
Reply With Quote
 
usenet@tech-know-ware.com
Guest
Posts: n/a
 
      07-18-2007
On 16 Jul, 20:36, Robert Dailey <(E-Mail Removed)> wrote:
> On Jul 16, 1:05 pm, Joseph Kesselman <(E-Mail Removed)>
> wrote:
>
> > Robert Dailey wrote:
> > > Is there a way in Schema to specify that the "Frame" element is
> > > different (and thus requires different child elements) depending on
> > > the value of an attribute (specifically the "type" attribute)?

>
> > Presence or absence, maybe. Value, I don't think so. Some of the other
> > schema(-like) languages do support that, or you can enforce that
> > constrating in the application code...

>
> > --
> > Joe Kesselman / Beware the fury of a patient man. -- John Dryden

>
> Thank you for your reply, it was the answer I was looking for.
>
> I would also like to ask if it's possible to make a schema accept
> either of the following attribute combinations for a single element:
>
> <Offset x="0" y="0"/>
> <Offset var="myvar"/>
>
> Is this possible?


In schema you can effectively only specify the union of the two
types. As a result things like <Offsett x="0" var="myvar"/> would
also validate. You could apply additional constraints at the
application level. XSD1.1 is due to improve onthis and Relax-NG
supports what you want.

HTH,

Pete.
--
=============================================
Pete Cordell
Codalogic Ltd
for XML Schema to C++ data binding visit
http://www.codalogic.com/lmx/
=============================================


 
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
Problem with schema-validation and property "http://apache.org/xml/properties/schema/external-schemaLocation" Markus Java 1 11-23-2005 02:41 PM
[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
XML schema regular expressions question and recommended XML Schema book Fred Smith XML 1 02-05-2004 11:12 AM
Schema Metadata not a Metadata Schema Brett Selleck XML 1 09-04-2003 05:02 PM
Re: Convert DB2 schema to XML Schema Klaus Johannes Rusch XML 0 08-06-2003 11:23 AM



Advertisments