|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1.5.0) E10653-06 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.adf.model.adapter.dataformat.xml.XMLSchemaDef
public class XMLSchemaDef
The XMLSchemaDef
class parses an XML Schema definition document and provide helper methods to query the schema's structure.
Input must be set using any of the addSchema
methods. The method build
must be called after adding the required schema documents. This method initialises the member variables and sets up the object for use. Otherwise, all the helper methods return null
.
A lookup table of all the global elements against its namespace is maintained as AccessorDef
objects. The method getType
may be used to obtain an element by name and namespace.
We then build a list of all the top-level elements in buildElementSet
. The method buildSchemaTree
descends into the top-level elements and creates a tree representing the schema's structure.
The getXSDTree
method returns the tree representation of the input schema document/s.
On the resolution of each global element, it is added to a lookup table of elements against its namespace. This allows the method getType
to quickly lookup a type by name and namespace and return its AccessorDef
representation. The member variable mTypesSet
encloses the lookup table against each namespace declared in the schema document.
The tree structure is in accordance with JSR227 specification. An item of data (<element>
) is represented by a StructureDef
. The <element>
's attributes can be obtained calling StructureDef
's getAttribute
method. If the <element>
has child elements, they can be obtained by calling the getAccessors
method. This returns a container of AccessorDef
objects. It's getStructure
method returns a StructureDef
which represents the parent's child element. XML specific information against <element>
such as maxOccurs
, nillable
and other such Annotations and Facets can be obtained by calling AttributeDef
'sgetProperty
or getProperties
method.
Field Summary | |
---|---|
static java.lang.String |
ENUMERATION |
static java.lang.String |
MAX_OCCURS |
static java.lang.String |
MIN_OCCURS |
static java.lang.String |
NAMESPACE |
static java.lang.String |
NILLABLE |
static java.lang.String |
TYPE A set of constants that are retrieved from a type and stored in its 'properties'. |
Constructor Summary | |
---|---|
XMLSchemaDef() |
|
XMLSchemaDef(java.lang.String rootName) Initialises the XML Data Structure with a name. |
Method Summary | |
---|---|
void |
addSchema(java.io.InputStream xsdStream) Add a schema definition specified by its InputStream to the pipeline. |
void |
addSchema(Node node) Add a schema defintion specified by the Node . |
void |
addSchema(java.io.Reader xsdReader) Add a schema defintion specified by its Reader to the pipeline. |
void |
addSchema(java.lang.String xsdLocation) Add a schema defintion specified by its URL location to the pipeline. |
void |
addSchema(java.net.URL xsdURL) Add a schema defintion specified by its URL to the pipeline. |
void |
build() Builds the object and initialises the member variables for use. |
java.lang.String |
getSchemaProperty(java.lang.String targetNamespace, java.lang.String name) Returns the property value of the schema given its namespace and name. |
StructureDefinition |
getSchemaTree() Returns the XSD tree in the form of StructureDefinition . |
java.lang.Object |
getType(java.lang.String namespace, java.lang.String typeName) Returns the AccessorDef or a AttributeDef representation of a type given its namespace. |
boolean |
isAttributeFormDefault(java.lang.String targetNamespace) Determines if the attributes in the given namespace is qualified. |
boolean |
isElementFormDefault(java.lang.String targetNamespace) Determines if the elements in the given namespace is qualified. |
boolean |
isNamespaceDefined(java.lang.String namespace) Determines if the given namespace is defined in the current schema. |
static void |
main(java.lang.String[] args) |
void |
printAllTypes() |
void |
printProperties(java.util.Map props, java.lang.String padding) |
void |
printSchemaMetadata() |
void |
printTree(StructureDefinition struct, int indent) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TYPE
public static final java.lang.String ENUMERATION
public static final java.lang.String MIN_OCCURS
public static final java.lang.String MAX_OCCURS
public static final java.lang.String NILLABLE
public static final java.lang.String NAMESPACE
Constructor Detail |
---|
public XMLSchemaDef()
public XMLSchemaDef(java.lang.String rootName)
rootName
- Name for the XML data structureMethod Detail |
---|
public void addSchema(java.lang.String xsdLocation) throws AdapterException
xsdLocation
- URL location of the schema defintion.AdapterException
- If error occurs while adding this defintion to the list. The URL location might be invalid or inaccessible.public void addSchema(java.net.URL xsdURL) throws AdapterException
xsdURL
- URL of the schema definition.AdapterException
- If error occus while adding this definition to the list. The URL might be invalid or inaccessible.public void addSchema(java.io.Reader xsdReader)
xsdReader
- Reader
object containing the schema definition.public void addSchema(java.io.InputStream xsdStream)
xsdStream
- InputStream
object containing the schema definition.public void addSchema(Node node)
Node
.node
- Root node of the schema defintion.public void build() throws AdapterException
This method must be called after setting up the input using any of the addSchema
methods and before calling any of the helper methods.
AdapterException
- If error occurs while parsing the schema.public StructureDefinition getSchemaTree()
StructureDefinition
.StructureDefinition
object representing the structure of top-level elements of the XML Schema document.public java.lang.Object getType(java.lang.String namespace, java.lang.String typeName)
AccessorDef
or a AttributeDef
representation of a type given its namespace. To obtain the underlying data structure of a AccessorDef
, call it's getStructure
method.namespace
- Namespace to which the type
belongs.typeName
- Name of the type
.AccessorDef
or a AttributeDef
object if the type
is found, otherwise returns null
.public boolean isElementFormDefault(java.lang.String targetNamespace)
targetNamespace
- Namespace whose property needs to be queried.true
if the elements in the given namespace are qualified. Returns false
if the elements are unqualified or the given namespace does not exist.public boolean isAttributeFormDefault(java.lang.String targetNamespace)
targetNamespace
- Namespace whose property needs to be queried.true
if the attributes in the given namespace are qualified. Returns false
if the attributes are unqualified or the given namespace does not exist.public java.lang.String getSchemaProperty(java.lang.String targetNamespace, java.lang.String name)
targetNamespace
- Namespace whose property needs to be queried.name
- Name of the property whose value is to be fetched.null
.public boolean isNamespaceDefined(java.lang.String namespace)
namespace
- Name of the namespace.true
if this namespace is defined in this schema, otherwise returns false
.public void printTree(StructureDefinition struct, int indent)
public void printProperties(java.util.Map props, java.lang.String padding)
public void printAllTypes()
public void printSchemaMetadata()
public static void main(java.lang.String[] args)
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Model 11g Release 1 (11.1.1.5.0) E10653-06 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |