
The xs:openContent provides an mechanism for making XSD's extensible.
The xs:openContent node tells the validator the containing element (in the instance document) can contain additional XML elements that are not defined within this schema. Prior to XSD 1.1 the only way to do with was via the xs:any node, however xs:openContent allows a greater level of control and freedom.
The xs:openContent node can be added to an xs:element or xs:complexType by right clicking on it and selecting the Open Content menu item, or selecting the () item from the toolbar.
The xs:schema element can also have a xs:defaultOpenContent node which works the same as the xs:openContent node, but is applied to all elements defined within the schema.
Id | user defined ID to uniquely identify the entity within the schema |
Mode |
Valid values
|
The xs:openContent node can have a child xs:any which defines the rules that additional elements must comply with.
The following XSD code
XSD Sample Code |
Copy Code
|
---|---|
<element name="Book"> <complexType> <openContent mode="interleave"> <any namespace="http://www.book.org" processContents="strict" /> </openContent> <sequence> <element name="Title" type="string" /> <element name="Author" type="string" /> <element name="Date" type="gYear" /> <element name="ISBN" type="string" /> <element name="Publisher" type="string" /> </sequence> </complexType> </element> |
Will be represented like this
Resulting XML Document |
Copy Code
|
---|---|
<Book xmlns:bk="http://www.book.org"> <bk:Binding>Hardcover</bk:Binding> <Title>My Life and Times</Title> <bk:Size>5 x 7</bk:Size> <Author>Paul McCartney</Author> <bk:InStock>true</bk:InStock> <Date>1998</Date> <bk:Category>Non-fiction</bk:Category> <ISBN>1-56592-235-2</ISBN> <bk:NumPages>299</bk:NumPages> <Publisher>McMillin Publishing</Publisher> <bk:AvailableOnTape>false</bk:AvailableOnTape> </Book> |
Properties that apply to a type are shown inline at the bottom of the items container.
Values that are inherited from the base types are shown in brackets, values specifically set against the item are shown without brackets.
If a facet is not valid for a given type (typically because of its data type), then its value is shown in red.