[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsd:anyType and xsd:any
Shlomo Yona asks: > I was not able to fully understand the difference between an xsd:any > and an element with a type xsd:anyType. Very different. xsd:anyType is a type, like xsd:integer (though xsd:anyType is special in that it can act as a simple or complex type, and it places essentially no restrictions on the tree that it validates -- thing of it loosely as the Schema language's analog of java.lang.Object). A sample use would be: <xsd:element name="e" type="xsd:anyType"/> This would mean that elements named <e> can have any content, any attributes, etc. xs:any is a wildcard, usable as a term in a content model. For example: <xsd:complexType name="T"> <xsd:sequence> <xsd:element ref="A"/> <xsd:any /> <xsd:element ref="C"/> </xsd:sequence> </xsd:complexType> Elements of type T must have content <A/><???/><C/>, where <???> can be any named element. Now, if you look really closely there is an approximation to the definition of xsd:anytType given for reference in the Recommendation, and it uses an xsd:any wildcard as the means of saying that it allows any elements. I hope you'll see that most of your questions are answered once you get the above straight. I would encourage you to carefully read the schema primer [1], or some of the good books on W3C XML Schema (Priscilla Walmsley's is among the one's that's very well respected. [2]). Noah [1] http://www.w3.org/TR/xmlschema-0/ [2] http://www.amazon.com/Definitive-XML-Schema-Priscilla-Walmsley/dp/0130655678/ref=sr_1_1/103-2086530-8739813?ie=UTF8&s=books&qid=1174404823&sr=8-1 -------------------------------------- Noah Mendelsohn IBM Corporation One Rogers Street Cambridge, MA 02142 1-617-693-4036 -------------------------------------- "Shlomo Yona" <S.Yona@F...> 03/20/2007 11:08 AM To: <xml-dev@l...> cc: (bcc: Noah Mendelsohn/Cambridge/IBM) Subject: xsd:anyType and xsd:any Hello, I was not able to fully understand the difference between an xsd:any and an element with a type xsd:anyType. Is there any difference? Do both wildcard methods refer to any child element(s) or does one or both refer to a wildcard subtree? What should be the parse mode (parserContents) for processing xsd:anyType? Should is be same as xsd:anyâs âskipâ or âlaxâ or âstrictâ or perhaps to something else? The section 3.4.7 Built-in Complex Type Definition (in http://www.w3.org/TR/xmlschema-1/) says, if I understand correctly, that the subtree should be processed in âlaxâ. Is that so? Whatâs the difference, if any between the following wildcard definitions (with regards to the depth of subtree they refer to, the processing mode and any other issue): · xsd:any · element definition with type=âxsd:anyTypeâ · a complexContent that has a restriction base=âxsd:anyTypeâ with an xsd:anyAttribute namespace=â##otherâ and processorContents=âlaxâ · a complexContent that has a restriction base=âxsd:anyTypeâ with an xsd:anyAttribute namespace=â##otherâ and processorContents=âskipâ Thanks. Shlomo.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|