| |
Element declarations | page 1 of 6 |
The <element> element is the tag name that will be used within
the XML instance document.
Element declarations can be global, local, or references, and are used
for:
- Local validation of element information item values
using a type definition
- Specifying default or fixed values for element
information items
- Establishing uniqueness and reference constraint
relationships among the values of related elements and attributes
- Controlling the substitutability of elements
through the mechanism of element substitution groups
The <element> element contains attributes, which are described by
XML Schema Part 1: Structures of the standard.
The XML Schema model java interface for a <element> is
org.eclipse.xsd.XSDElementDeclaration and
can be created by calling
org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDElementDeclaration().
Particles
Local element declarations and element references can repeat by
changing
the particles minOccurs and maxOccurs attributes.
If an element is local or a reference, it can contain minOccurs and/or
maxOccurs attributes, which
are described by
http://www.w3.org/TR/xmlschema-1/#cParticles.
Referencing a global element declaration
If you declare a global element declaration, you can reference this
element in the remainder of the schema
using the ref attribute. This is done by calling the following method
on
the XML Schema model:
org.eclipse.xsd.XSDElementDeclaration.setResolvedElementDeclaration(XSDElementDeclaration).
Any element
The <any> element enables us to extend the XML instance document
with
elements not specified by the schema.
The <any> element contain attributes, which are described by
http://www.w3.org/TR/xmlschema-1/#Wildcards.
The XML Schema model java interface for a <any> is
org.eclipse.xsd.XSDWildCard and
can be created by calling
org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDWildCard().
|