org.apache.xerces.dom

Class ASModelImpl

public class ASModelImpl extends Object implements ASModel

Deprecated:

To begin with, an abstract schema is a generic structure that could contain both internal and external subsets. An ASModel is an abstract object that could map to a DTD , an XML Schema , a database schema, etc. An ASModel could represent either an internal or an external subset; hence an abstract schema could be composed of an ASModel representing the internal subset and an ASModel representing the external subset. Note that the ASModel representing the external subset could consult the ASModel representing the internal subset. Furthermore, the ASModel representing the internal subset could be set to null by the setInternalAS method as a mechanism for "removal". In addition, only one ASModel representing the external subset can be specified as "active" and it is possible that none are "active". Finally, the ASModel contains the factory methods needed to create a various types of ASObjects like ASElementDeclaration, ASAttributeDeclaration, etc.

See also the Document Object Model (DOM) Level 3 Abstract Schemas and Load and Save Specification.

Version: $Id: ASModelImpl.java,v 1.6 2004/02/24 23:23:18 mrglavas Exp $

Author: Pavani Mukthipudi Neil Graham

Field Summary
protected VectorfASModels
protected SchemaGrammarfGrammar
Constructor Summary
ASModelImpl()
ASModelImpl(boolean isNamespaceAware)
Method Summary
voidaddASModel(ASModel abstractSchema)
This method will allow the nesting or "importation" of ASModels.
ASObjectcloneASObject(boolean deep)
Creates a copy of this ASObject.
ASAttributeDeclarationcreateASAttributeDeclaration(String namespaceURI, String name)
Creates an attribute declaration.
ASContentModelcreateASContentModel(int minOccurs, int maxOccurs, short operator)
Creates an object which describes part of an ASElementDeclaration's content model.
ASElementDeclarationcreateASElementDeclaration(String namespaceURI, String name)
Creates an element declaration for the element type specified.
ASEntityDeclarationcreateASEntityDeclaration(String name)
Creates an ASEntityDeclaration.
ASNotationDeclarationcreateASNotationDeclaration(String namespaceURI, String name, String systemId, String publicId)
Creates a new notation declaration.
StringgetAsHint()
The hint to locating an ASModel.
StringgetAsLocation()
The URI reference.
shortgetAsNodeType()
A code representing the underlying object as defined above.
ASObjectListgetASModels()
To retrieve a list of nested ASModels without reference to names.
ASNamedObjectMapgetAttributeDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global" attribute declarations.
booleangetContainer()
If usage is EXTERNAL_SUBSET or NOT_USED, and the ASModel is simply a container of other ASModels.
ASNamedObjectMapgetContentModelDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global content model declarations.
ASNamedObjectMapgetElementDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global" element declarations.
ASNamedObjectMapgetEntityDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global" entity declarations.
SchemaGrammargetGrammar()
VectorgetInternalASModels()
booleangetIsNamespaceAware()
true if this ASModel defines the document structure in terms of namespaces and local names ; false if the document structure is defined only in terms of QNames.
StringgetLocalName()
Returns the local part of the qualified name of this ASObject.
StringgetNamespaceURI()
The namespace URI of this node, or null if it is unspecified. defines how a namespace URI is attached to schema components.
StringgetNodeName()
The name of this ASObject depending on the ASObject type.
ASNamedObjectMapgetNotationDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global" notation declarations.
ASModelgetOwnerASModel()
The ASModel object associated with this ASObject.
StringgetPrefix()
The namespace prefix of this node, or null if it is unspecified.
shortgetUsageLocation()
0 if used internally, 1 if used externally, 2 if not all.
voidimportASObject(ASObject asobject)
Imports ASObject into ASModel.
voidinsertASObject(ASObject asobject)
Inserts ASObject into ASModel.
voidremoveAS(ASModel as)
Removes only the specified ASModel from the list of ASModels.
voidsetAsHint(String asHint)
The hint to locating an ASModel.
voidsetAsLocation(String asLocation)
The URI reference.
voidsetGrammar(SchemaGrammar grammar)
voidsetLocalName(String localName)
Returns the local part of the qualified name of this ASObject.
voidsetNamespaceURI(String namespaceURI)
The namespace URI of this node, or null if it is unspecified. defines how a namespace URI is attached to schema components.
voidsetNodeName(String nodeName)
The name of this ASObject depending on the ASObject type.
voidsetOwnerASModel(ASModel ownerASModel)
The ASModel object associated with this ASObject.
voidsetPrefix(String prefix)
The namespace prefix of this node, or null if it is unspecified.
booleanvalidate()
Determines if an ASModel itself is valid, i.e., confirming that it's well-formed and valid per its own formal grammar.

Field Detail

fASModels

protected Vector fASModels

fGrammar

protected SchemaGrammar fGrammar

Constructor Detail

ASModelImpl

public ASModelImpl()

ASModelImpl

public ASModelImpl(boolean isNamespaceAware)

Method Detail

addASModel

public void addASModel(ASModel abstractSchema)
This method will allow the nesting or "importation" of ASModels.

Parameters: abstractSchema ASModel to be set. Subsequent calls will nest the ASModels within the specified ownerASModel.

cloneASObject

public ASObject cloneASObject(boolean deep)
Creates a copy of this ASObject. See text for cloneNode off of Node but substitute AS functionality.

Parameters: deep Setting the deep flag on, causes the whole subtree to be duplicated. Setting it to false only duplicates its immediate child nodes.

Returns: Cloned ASObject.

createASAttributeDeclaration

public ASAttributeDeclaration createASAttributeDeclaration(String namespaceURI, String name)
Creates an attribute declaration.

Parameters: namespaceURI The namespace URI of the attribute being declared. name The name of the attribute. The format of the name could be an NCName as defined by XML Namespaces or a Name as defined by XML 1.0; it's ASModel-dependent.

Returns: A new ASAttributeDeclaration object with appropriate attributes set by input parameters.

Throws: DOMException INVALID_CHARACTER_ERR: Raised if the input name parameter contains an illegal character.

createASContentModel

public ASContentModel createASContentModel(int minOccurs, int maxOccurs, short operator)
Creates an object which describes part of an ASElementDeclaration's content model.

Parameters: minOccurs The minimum occurrence for the subModels of this ASContentModel. maxOccurs The maximum occurrence for the subModels of this ASContentModel. operator operator of type AS_CHOICE, AS_SEQUENCE, AS_ALL or AS_NONE.

Returns: A new ASContentModel object.

Throws: DOMASException A DOMASException, e.g., minOccurs > maxOccurs.

createASElementDeclaration

public ASElementDeclaration createASElementDeclaration(String namespaceURI, String name)
Creates an element declaration for the element type specified.

Parameters: namespaceURI The namespace URI of the element type being declared. name The name of the element. The format of the name could be an NCName as defined by XML Namespaces or a Name as defined by XML 1.0; it's ASModel-dependent.

Returns: A new ASElementDeclaration object with name attribute set to tagname and namespaceURI set to systemId. Other attributes of the element declaration are set through ASElementDeclaration interface methods.

Throws: DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

createASEntityDeclaration

public ASEntityDeclaration createASEntityDeclaration(String name)
Creates an ASEntityDeclaration.

Parameters: name The name of the entity being declared.

Returns: A new ASEntityDeclaration object with entityName attribute set to name.

Throws: DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

createASNotationDeclaration

public ASNotationDeclaration createASNotationDeclaration(String namespaceURI, String name, String systemId, String publicId)
Creates a new notation declaration.

Parameters: namespaceURI The namespace URI of the notation being declared. name The name of the notation. The format of the name could be an NCName as defined by XML Namespaces or a Name as defined by XML 1.0; it's ASModel-dependent. systemId The system identifier for the notation declaration. publicId The public identifier for the notation declaration.

Returns: A new ASNotationDeclaration object with notationName attribute set to name and publicId and systemId set to the corresponding fields.

Throws: DOMException INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

getAsHint

public String getAsHint()
The hint to locating an ASModel.

getAsLocation

public String getAsLocation()
The URI reference.

getAsNodeType

public short getAsNodeType()
A code representing the underlying object as defined above.

getASModels

public ASObjectList getASModels()
To retrieve a list of nested ASModels without reference to names.

Returns: A list of ASModels.

getAttributeDeclarations

public ASNamedObjectMap getAttributeDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global" attribute declarations. If one attempts to add, set, or remove a node type other than the intended one, a hierarchy exception (or equivalent is thrown).

getContainer

public boolean getContainer()
If usage is EXTERNAL_SUBSET or NOT_USED, and the ASModel is simply a container of other ASModels.

getContentModelDeclarations

public ASNamedObjectMap getContentModelDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global content model declarations. If one attempts to add, set, or remove a node type other than the intended one, a hierarchy exception (or equivalent is thrown).

getElementDeclarations

public ASNamedObjectMap getElementDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global" element declarations. If one attempts to add, set, or remove a node type other than the intended one, a hierarchy exception (or equivalent is thrown).

getEntityDeclarations

public ASNamedObjectMap getEntityDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global" entity declarations. If one attempts to add, set, or remove a node type other than the intended one, a hierarchy exception (or equivalent is thrown).

getGrammar

public SchemaGrammar getGrammar()

getInternalASModels

public Vector getInternalASModels()

getIsNamespaceAware

public boolean getIsNamespaceAware()
true if this ASModel defines the document structure in terms of namespaces and local names ; false if the document structure is defined only in terms of QNames.

getLocalName

public String getLocalName()
Returns the local part of the qualified name of this ASObject.

getNamespaceURI

public String getNamespaceURI()
The namespace URI of this node, or null if it is unspecified. defines how a namespace URI is attached to schema components.

getNodeName

public String getNodeName()
The name of this ASObject depending on the ASObject type.

getNotationDeclarations

public ASNamedObjectMap getNotationDeclarations()
Instead of returning an all-in-one ASObject with ASModel methods, have discernible top-level/"global" notation declarations. If one attempts to add, set, or remove a node type other than the intended one, a hierarchy exception (or equivalent is thrown).

getOwnerASModel

public ASModel getOwnerASModel()
The ASModel object associated with this ASObject. For a node of type AS_MODEL, this is null.

getPrefix

public String getPrefix()
The namespace prefix of this node, or null if it is unspecified.

getUsageLocation

public short getUsageLocation()
0 if used internally, 1 if used externally, 2 if not all. An exception will be raised if it is incompatibly shared or in use as an internal subset.

importASObject

public void importASObject(ASObject asobject)
Imports ASObject into ASModel.

Parameters: asobject ASObject to be imported.

insertASObject

public void insertASObject(ASObject asobject)
Inserts ASObject into ASModel.

Parameters: asobject ASObject to be inserted.

removeAS

public void removeAS(ASModel as)
Removes only the specified ASModel from the list of ASModels.

Parameters: as AS to be removed.

setAsHint

public void setAsHint(String asHint)
The hint to locating an ASModel.

setAsLocation

public void setAsLocation(String asLocation)
The URI reference.

setGrammar

public void setGrammar(SchemaGrammar grammar)

setLocalName

public void setLocalName(String localName)
Returns the local part of the qualified name of this ASObject.

setNamespaceURI

public void setNamespaceURI(String namespaceURI)
The namespace URI of this node, or null if it is unspecified. defines how a namespace URI is attached to schema components.

setNodeName

public void setNodeName(String nodeName)
The name of this ASObject depending on the ASObject type.

setOwnerASModel

public void setOwnerASModel(ASModel ownerASModel)
The ASModel object associated with this ASObject. For a node of type AS_MODEL, this is null.

setPrefix

public void setPrefix(String prefix)
The namespace prefix of this node, or null if it is unspecified.

validate

public boolean validate()
Determines if an ASModel itself is valid, i.e., confirming that it's well-formed and valid per its own formal grammar.

Returns: true if the ASModel is valid, false otherwise.

Copyright © 1999-2005 Apache XML Project. All Rights Reserved.