|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.schema.SOMObject
com.bea.schema.SOMSchema
<schema> The SOMSchema object is the building block for the Schema Object Model, SOM. The top level <schema> element is represented by the SOMSchema object and all sub-elements are linked underneath this object.
A schema is represented in XML by one or more schema documents, that is, one or more schema element information items. A schema document contains representations for a collection of schema components, e.g. type definitions and element declarations, which have a common {target namespace}.
The SOM allows the output of XML but is represented internally by a hierarchy of objects known as the Schema Object Model. SOMSchema is the object that represents the top level schema element to which everything must be added.
Field Summary | |
static String |
NAMESPACE_2001
|
static String |
NAMESPACE_OCT2000
|
Constructor Summary | |
SOMSchema()
Create an empty top schema level object |
|
SOMSchema(InputSource inputSource,
boolean canonical,
boolean debugMessages)
Load a schema from an XML instance document in a file. |
|
SOMSchema(Reader xml)
Load a schema from stringified XML using the default SAX parser. |
|
SOMSchema(String xmlString)
Load a schema from serialized XML using the default SAX parser. |
|
SOMSchema(String xmlString,
boolean canonical,
boolean debugMessages)
Load a schema from stringified XML using the default SAX parser. |
|
SOMSchema(String xmlString,
String encoding)
Load a schema from stringified XML using the default SAX parser. |
|
SOMSchema(XMLReader parser,
InputSource inputSource,
boolean canonical,
boolean debugMessages)
Load a schema from an XML instance document in a file. |
Method Summary | |
SOMAnnotation |
addAnnotation()
create a new empty annotation element within this schema. |
SOMAnnotation |
addAnnotation(SOMAnnotation annotation)
add an annotation to the schema tree. |
void |
addAttribute(String name,
String value)
add attributes to the <schema> element. |
SOMAttribute |
addAttributeElement(SOMAttribute child)
Adds a previously created <attribute> object to the root of the schema object model. |
SOMAttribute |
addAttributeElement(String name)
Creates a SOMAttribute object with the given name and adds the <attribute> to the root level of this schema. |
SOMAttributeGroup |
addAttributeGroup(SOMAttributeGroup child)
Adds a previously created <attributeGroup> object to the root of the schema object model. |
SOMAttributeGroup |
addAttributeGroup(String name)
Creates a SOMAttributeGroup object with the given name and adds the <attributeGroup> to the root level of this schema. |
SOMComplexType |
addComplexType(SOMComplexType child)
Adds the complexType to the root level of this schema. |
SOMComplexType |
addComplexType(String name)
Creates a SOMComplexType object with the given name and adds the |
SOMDocumentation |
addDocumentation(String info)
adds a documentation element to a new annotation element for this schema. |
SOMElement |
addElement(SOMElement child)
Adds a previously created <element> object to the root of the schema object model. |
SOMElement |
addElement(String name)
Creates a SOMElement object with the given name and adds the <element> to the root level of this schema. |
SOMGroup |
addGroup(SOMGroup child)
Adds a previously created <roup> object to the root of the schema object model. |
SOMGroup |
addGroup(String name)
Creates a SOMGroup object with the given name and adds the <group> to the root level of this schema. |
SOMSimpleType |
addSimpleType(SOMSimpleType child)
Adds the simpleType to the root level of this schema. |
SOMSimpleType |
addSimpleType(String name)
Creates a SOMSimpleType object with the given name and adds the object to the root level of this schema. |
void |
addUnresolvedType(SOMUnresolvedType type)
|
IDocument |
createDefaultDocument(DefaultDocumentOptions options)
create an XML instance document template based on this schema model. |
Iterator |
getAnnotations()
Returns an Iterator over all the annotations contained at the root level of this schema. |
Iterator |
getAttributeElements()
Returns an Iterator over all the attributes contained at the root level of this schema. |
String |
getAttributeFormDefault()
get the attributeFormDefault for this schema, or null if no attributeFormDefault was specified. |
Iterator |
getAttributeGroups()
Returns an Iterator over all the attributeGroups contained at the root level of this schema. |
Iterator |
getAttributes()
Returns an Iterator over all the attributes in the schema element. |
Iterator |
getComplexTypes()
Returns an Iterator over all the complexTypes contained at the root level of this schema. |
String |
getDefaultNameSpace()
get the schema xmlns:xsd attribute. |
SOMElement |
getElement(String locationString)
Lookup an element within this schema. |
String |
getElementFormDefault()
get the elementFormDefault for this schema, or null if no elementFormDefault was specified. |
Iterator |
getElements()
Returns an Iterator over all the elements contained at the root level of this schema. |
Iterator |
getGroups()
Returns an Iterator over all the groups contained at the root level of this schema. |
String |
getID()
Returns a printable element tag for this Schema Object |
static String |
getLocalName(Node node)
return the local part of the name for the given node. |
static String |
getLocalPartFromName(String name)
return the local name portion of a qualified name. |
static String |
getPrefixFromName(String name)
return the prefix portion of a qualified name, or null if the given name is not qualified. |
Iterator |
getSimpleTypes()
Returns an Iterator over all the simpleTypes contained at the root level of this schema. |
String |
getTargetNamespace()
get the targetNamespace for this schema, or null if no targetNamespace was specified. |
boolean |
hasUnresolvedReferences()
|
boolean |
hasUnresolvedTypes()
|
boolean |
isAttributeFormDefaultQualified()
Is attributeFormDefault == 'qualified' |
boolean |
isElementFormDefaultQualified()
Is elementFormDefault == 'qualified' |
boolean |
isValid(Document doc,
List errorList)
Validates an XML Document against an XML Schema. |
boolean |
isValid(IDocument doc,
List errorList)
Validates an XML Document against an XML Schema. |
boolean |
isValid(Node rootElement,
List errorList)
Validates an XML Document against an XML Schema. |
boolean |
isValidatingContent()
current content validation setting. |
SOMAttributeGroup |
lookupAttrGrpReference(String registeredName)
Returns a reference to an attributeGroup previously added to this schema object. |
SOMElement |
lookupElement(String registeredName)
Returns a reference to an SOMElement previously added to this schema object. |
SOMReference |
lookupReference(String registeredName)
Returns a reference to an element previously added to this schema object. |
SOMType |
lookupTypeReference(String registeredTypeName)
Returns a reference to a type previously added to this schema object. |
static void |
main(String[] args)
|
SOMAnnotation |
removeAnnotation(SOMAnnotation note)
remove an annotation and all of its children from the root level of this schema |
SOMAttribute |
removeAttribute(String name)
remove an attribute from the root level of this schema |
SOMComplexType |
removeComplexType(String name)
remove a complexType from the root level of this schema |
SOMElement |
removeElement(String name)
remove an element from the root level of this schema |
SOMGroup |
removeGroup(String name)
remove an group from the root level of this schema |
SOMSimpleType |
removeSimpleType(String name)
remove a simpleType from the root level of this schema |
void |
resolveReferences()
Resolve unresolved elements in this schema. |
void |
resolveTypes()
Resolve unresolved element types in this schema. |
void |
setAttributeFormDefault(String value)
set the attributeFormDefault for this schema,. |
void |
setContentValidation(boolean value)
toggle element and attribute content validation. |
void |
setDefaultNamespace(String xmlns_xsd)
manually override the XMLSchema namespace - NOT RECOMMENDED. |
void |
setElementFormDefault(String value)
set the elementFormDefault for this schema. |
void |
setTargetNamespace(String targetNamespace)
set the targetNamespace for this schema. |
void |
toXML(Writer rtn,
int indent)
For debugging, display, and printing purposes, the XML Schema Object model can be represented as a character string. |
Methods inherited from class com.bea.schema.SOMObject |
addPrefixMapping, getContainmentXPath, getEffectivePrefixMappings, getID_UQ, getParent, getParentName, getParentSchema, getPrefixForTargetNamespace, getPrefixMapping, getURIForPrefix, isCircularReference, isSchemaChild, msg, msg, removeNamespaceQualifier, removePrefixMapping, setIndent, setParent, toString, toXML, toXML, toXML |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String NAMESPACE_OCT2000
public static final String NAMESPACE_2001
Constructor Detail |
public SOMSchema()
public SOMSchema(String xmlString) throws SAXException
xmlString
- the XML in parsable string format
SAXException
public SOMSchema(String xmlString, String encoding) throws SAXException, UnsupportedEncodingException
xmlString
- the XML in parsable string formatencoding
-
SAXException
UnsupportedEncodingException
public SOMSchema(String xmlString, boolean canonical, boolean debugMessages) throws SAXException
xmlString
- the XML in parsable string formatcanonical
- for future usedebugMessages
- print debug messages for loading InputSource to SOMSchema to stdoutpublic SOMSchema(Reader xml) throws SAXException
public SOMSchema(InputSource inputSource, boolean canonical, boolean debugMessages) throws SAXException
SOMSchema mySchema = null; java.io.Reader myInput; ... org.xml.sax.InputSource myInputSource = new org.xml.sax.InputSource(myInput); try { mySchema = new SOMSchema(myInputSource, false, false); } catch (org.xml.sax.SAXException se) { System.err.println(se.getMessage()); } catch ( Exception e ) { e.printStackTrace(); }
inputSource
- the input source to parsecanonical
- for future usedebugMessages
- print debug messages for loading InputSource to SOMSchema to stdoutpublic SOMSchema(XMLReader parser, InputSource inputSource, boolean canonical, boolean debugMessages) throws SAXException
parser
- a SAX parserinputSource
- the input source to parsecanonical
- for future usedebugMessages
- print debug messages for loading InputSource to SOMSchema to stdoutMethod Detail |
public static void main(String[] args)
public void addAttribute(String name, String value)
name
- attribute namevalue
- attribute valuepublic SOMAttribute addAttributeElement(String name)
name
- The name attribute for the created <attribute>
public SOMAttribute addAttributeElement(SOMAttribute child)
child
-
public SOMAttributeGroup addAttributeGroup(String name)
name
- The name attribute for the created <attributeGroup>
public SOMAttributeGroup addAttributeGroup(SOMAttributeGroup child)
child
-
public SOMGroup addGroup(String name)
name
- The name attribute for the created <group>
public SOMGroup addGroup(SOMGroup child)
child
-
public SOMElement addElement(String name)
name
- The name attribute for the created <element>
public SOMElement addElement(SOMElement child)
child
-
public SOMComplexType addComplexType(String name)
name
- public SOMComplexType addComplexType(SOMComplexType child)
child
- the complexType to add
public SOMSimpleType addSimpleType(String name)
name
- public SOMSimpleType addSimpleType(SOMSimpleType child)
child
- the simpleType to add
public SOMDocumentation addDocumentation(String info)
SOMSchema mySchema ... ... SOMAnnotation note = mySchema.addAnnotation(); note.addDocumentation(info);
info
- The documentation string to be added
public SOMAnnotation addAnnotation()
public SOMAnnotation addAnnotation(SOMAnnotation annotation)
annotation
- a previously created annotation
public String getID()
SOMObject
getID
in class SOMObject
public String getDefaultNameSpace()
public void setDefaultNamespace(String xmlns_xsd)
xmlns_xsd
- namespace URLpublic Iterator getComplexTypes()
public Iterator getSimpleTypes()
public Iterator getElements()
public SOMElement getElement(String locationString)
Virtual Path nodes must be separated by the forward slash, "/"
locationString
- a virtual element path where nodes are separated by the forward slash, "/"
public Iterator getAttributeGroups()
public Iterator getGroups()
public Iterator getAttributeElements()
public Iterator getAttributes()
public boolean hasUnresolvedReferences()
public boolean hasUnresolvedTypes()
public void addUnresolvedType(SOMUnresolvedType type)
public void resolveReferences()
public void resolveTypes()
public Iterator getAnnotations()
public String getTargetNamespace()
getTargetNamespace
in class SOMObject
public void setTargetNamespace(String targetNamespace)
setTargetNamespace
in class SOMObject
public String getElementFormDefault()
public void setElementFormDefault(String value)
public String getAttributeFormDefault()
public void setAttributeFormDefault(String value)
public boolean isElementFormDefaultQualified()
public boolean isAttributeFormDefaultQualified()
public SOMComplexType removeComplexType(String name)
name
- name the complexType
public SOMSimpleType removeSimpleType(String name)
name
- name the simpleType
public SOMElement removeElement(String name)
name
- name the element
public SOMGroup removeGroup(String name)
name
- name the group
public SOMAttribute removeAttribute(String name)
name
- name the attribute
public SOMAnnotation removeAnnotation(SOMAnnotation note)
note
- The annotation object to be removed
public SOMType lookupTypeReference(String registeredTypeName)
registeredTypeName
- The value of the "name" attribute for the registered type.
public SOMReference lookupReference(String registeredName)
registeredName
- The value of the "name" attribute for the registered element.
public SOMElement lookupElement(String registeredName)
registeredName
- The value of the "name" attribute for the registered attributeGroup element.
public static String getLocalName(Node node)
public static String getPrefixFromName(String name)
public static String getLocalPartFromName(String name)
public SOMAttributeGroup lookupAttrGrpReference(String registeredName)
registeredName
- The value of the "name" attribute for the registered attributeGroup element.
public boolean isValidatingContent()
public void setContentValidation(boolean value)
value
- use false to ignore document contentpublic boolean isValid(Document doc, List errorList)
The error list is cleared before beginning the validation. The List implementation used must support the clear() method.
Elements of the list are instances of the class SOMValidationException.
doc
- the document instance to be validatederrorList
- A list of SOMValidationException
public boolean isValid(IDocument doc, List errorList)
The error list is cleared before beginning the validation. The List implementation used must support the clear() method.
Elements of the list are instances of the class SOMValidationException.
doc
- the document instance to be validatederrorList
- A list of SOMValidationException
public boolean isValid(Node rootElement, List errorList)
The error list is cleared before beginning the validation. The List implementation used must support the clear() method.
Elements of the list are instances of the class SOMValidationException.
rootElement
- the document element to be validatederrorList
- A list of SOMValidationException
public void toXML(Writer rtn, int indent) throws IOException
toXML
in class SOMObject
indent
- Indent levelrtn
- printable XML Schema
IOException
- if IOExcpetion is thrown by underlying java.io.Writerpublic IDocument createDefaultDocument(DefaultDocumentOptions options)
options
- options must include a root element name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |