Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impact of XSD Element defined with no type

Tags:

xml

xsd

Hopefully a simple knowledge question, but I can't seem to find an answer elsewhere.

What would be the impacts of having an element defined within a schema that was the following

<xs:element name"FooBar" />

Would it allow any data type or nothing at all?

like image 629
Mike Avatar asked Dec 21 '16 10:12

Mike


1 Answers

To quote the standard, regarding how the type is resolved for an element (bolding added for clarity):

The type definition corresponding to the <simpleType> or <complexType> element information item in the children, if either is present, otherwise the type definition resolved to by the actual value of the type attribute, otherwise the type definition of the element declaration resolved to by the actual value of the substitutionGroup attribute, if present, otherwise the ur-type definition

In your example, the element would resolve to the ur-type, i.e. xs:anyType. This allows any children, possibly mixed with text content, as long as it is well-formed XML.

Related: XML Schema: what's the default type of an xsd:attribute?

like image 92
Meyer Avatar answered Nov 07 '22 10:11

Meyer