Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Restricted element content

From: "Pete Cordell" <petexmldev@---------.--->
To: "Vity" <vitywap@------.-->, <xmlschema-dev@--.--->
Date: 3/12/2009 1:00:00 PM
Sadly the best you can do with this is define a complex type with complex 
content that is mixed.  You have no control over the type of TEXT data 
within the mixed content, or even where it is placed.

I've often thought it would be nice to have an xs:text element that was 
analogous to an xs:element, but didn't have start and end tags.  You could 
then do:

<xs:complexType name='fooType'>
    <xs:sequence>
        <xs:text type='xs:int'/>
        <xs:element name='bar1'/>
        <xs:element name='bar2'/>
    </xs:sequence>
    <xs:attribute name='atr1' type='xs:string'/>
</xs:complexType>

But I've never sat down and thought through the implications of this so have 
never formally proposed it.  I would be interested to hear whether anybody 
else has thought it through though.

Interestingly (or otherwise) a complex type with simple content could be 
expressed as:

<xs:complexType name='fooType'>
    <xs:sequence>
        <xs:text type='xs:int'/>
    </xs:sequence>
    <xs:attribute name='atr1' type='xs:string'/>
</xs:complexType>

and I wonder whether that could simplify the specs.

Anyway HTH,

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using XML C++
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ for more info

----- Original Message ----- 
From: "Vity" <vitywap@s...>
To: <xmlschema-dev@w...>
Sent: Wednesday, March 11, 2009 6:17 PM
Subject: Restricted element content


>
> Hello,
> I have very simple question, but I cannot find a solution for this.
> I would like to create XSD, which would describe following piece of XML:
> <foo atr1="some restricted attribute">
>  --limited string length (or eg. positive integer)-- 
>  <bar1 />
>  <bar2 />
> </foo>
>
> =element with an attribute which contains restricted content and other
> elements.
>
> I have no problem to describe the XML without "bar" elements, but it seems
> to have no solution with them.
>
> Thanks in advance.
>
> -Vity
>
>
>
> 



From mike@s... Thu Mar 12 13:25:19 2009
Received: from maggie.w3.org ([193.51.208.68])
	by frink.w3.org with 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent