Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - RE: Empty complexType with mixed="true" [Thread Next] Re: Empty complexType with mixed="true"To: "Michael Kay" <mike@--------.---> Date: 3/18/2008 2:53:00 PM On 18/03/2008, Michael Kay <mike@s...> wrote: > > > What's the best way to model "element with text content and > > attributes"? For example: > > > > <foo bar="b" baz="b"> only text allowed </foo> > > > > I've used this before, but it seems bulky: > > > > <xs:complexType name="foo"> > > <xs:simpleContent> > > <xs:extension base="xs:string"> > > <xs:attribute name="bar" type="xs:string"/> > > <xs:attribute name="baz" type="xs:string"/> > > </xs:extension> > > </xs:simpleContent> > > </xs:complexType> > > > > > > This thread has suggested you can do this: > > > > <xs:complexType name="foo" mixed="true"> > > <xs:attribute name="bar" type="xs:string"/> > > <xs:attribute name="baz" type="xs:string"/> </xs:complexType> > > > > Is that right? If so, is that shorthand for the above? > > > They are two types that will validate the same set of instances, but they > are not equivalent. For example, the first one can be restricted to create > another type with a pattern or enumeration facet, the second one can't. They > will also generate a different PSVI, and have different behaviour in > schema-aware queries and stylesheets (one will atomize to xs:string, the > other to xs:untypedAtomic). > > I would avoid using mixed content except where both child elements and child > text nodes are allowed. Ahh ok, thanks. The "official" way is the former version - worth checking because its a long way from intuitive. -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ From jobsqeu@y... Thu Mar 20 04:20:35 2008 Received: from farnsworth.w3.org ([128.30.52.43]) | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
