- From: Vity <vitywap@seznam.cz>
- Date: Thu, 12 Mar 2009 15:25:17 +0100
- To: <xmlschema-dev@w3.org>
I thought that. Thank you Pete and Michael for your expert answers. -Vity > -----Original Message----- > From: Pete Cordell [mailto:petexmldev@codalogic.com] > Sent: Thursday, March 12, 2009 2:00 PM > To: Vity; xmlschema-dev@w3.org > Subject: Re: Restricted element content > > 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@seznam.cz> > To: <xmlschema-dev@w3.org> > 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 > > > > > > > > > >
Received on Thursday, 12 March 2009 14:27:01 UTC