Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Re: Restricted element content [Thread Next] RE: Restricted element contentTo: <xmlschema-dev@--.---> Date: 3/12/2009 4:25:00 PM I thought that. Thank you Pete and Michael for your expert answers. -Vity > -----Original Message----- > From: Pete Cordell [mailto:petexmldev@c...] > Sent: Thursday, March 12, 2009 2:00 PM > To: Vity; xmlschema-dev@w... > 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@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 erwin.kloeck@b... Thu Mar 12 17:11:16 2009 Received: from bart.w3.org ([128.30.52.63]) by frink.w3.org with esmtp (Exim 4.63) | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
