|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.charlesames.utility.entity.XmlSpec
public class XmlSpec
Each subclass of WriteableEntity has a static XmlSpec instance that explains how data
should be either saved to an XML data element or recovered from an XML data element.
The XmlSpec class contains two component collections: A collection of XmlAttribute instances
and a separate collection of XmlElement instances. XmlAttributes map object properties to
XML attributes. XmlAttributes map object references to XML child elements.
| Constructor Summary | |
|---|---|
XmlSpec(java.lang.Class<? extends WriteableEntity> entityClass,
java.lang.String tag,
java.lang.String description)
Constructor for XmlSpec instances. |
|
| Method Summary | |
|---|---|
void |
addAttribute(XmlAttribute attribute)
Add a new XmlAttribute instance to the specification. |
void |
addElement(XmlElement element)
Add a new XmlElement instance to the specification. |
void |
appendTypeToElement(org.w3c.dom.Element xsdElement)
Append a type attribute to an XSD element and create the type declaration, if necessary. |
org.w3c.dom.Element |
createComplexTypeElement(org.w3c.dom.Element parent,
java.lang.String description)
Create complex type element for this specification. |
org.w3c.dom.Document |
createSchemaDocument()
Create an XML schema document |
org.w3c.dom.Element |
createTypeDefinition(org.w3c.dom.Document document)
Create an explicit complex type definition for this specification. |
XmlAttribute |
getAttribute(java.lang.String tag)
Get the XmlAttribute instance with the indicated NodeName. |
java.util.List<XmlAttribute> |
getAttributes()
Get all attributes. |
java.util.SortedMap<java.lang.String,XmlAttribute> |
getAttributesByTag()
Get all attributes. |
XmlSpec |
getBaseXmlSpec()
Get the base XmlSpec instance, if any. |
XmlContent |
getContent()
Get the XmlContent instance. |
XmlElement |
getElement(java.lang.String tag)
Get the XmlElement instance with the indicated Tag. |
java.util.List<XmlElement> |
getElements()
Get all elements. |
java.util.SortedMap<java.lang.String,XmlElement> |
getElementsByTag()
Get all elements in Tag order. |
java.lang.Class<? extends WriteableEntity> |
getEntityClass()
Get the entity class. |
java.lang.String |
getNoNamespaceSchemaLocation()
Get the no-namespace XML schema location. |
java.lang.String |
getTag()
Get the XML tag associated with this specification. |
java.lang.String |
getTargetNamespace()
Get the target namespace for the XML schema. |
java.lang.String |
getTypeName()
Get the type name used for explicit complexType definitions. |
boolean |
isUsed()
Check if this XmlSpec has been used in an XML schema. |
void |
removeAttribute(java.lang.String tag)
Remove the XmlAttribute instance with the indicated NodeName. |
void |
removeElement(java.lang.String tag)
Remove the XmlElement instance with the indicated NodeName. |
void |
setBaseXmlSpec(XmlSpec baseXmlSpec)
Set the base XmlSpec instance. |
void |
setContent(XmlContent content)
Set the XmlContent instance. |
void |
setNoNamespaceSchemaLocation(java.lang.String noNamespaceSchemaLocation)
Set the no-namespace XML schema location. |
void |
setTargetNamespace(java.lang.String targetNamespace)
Set the target namespace for the XML schema. |
void |
setTypeName(java.lang.String typeName)
Set the type name used for explicit complexType definitions. |
void |
setUsed(boolean used)
Indicate if this XmlSpec has been used in an XML schema. |
void |
validateTag(WriteableEntity entity,
org.w3c.dom.Element element)
Verify that the Tag name of a WriteableEntity is consistent with the node name of an XML Element. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlSpec(java.lang.Class<? extends WriteableEntity> entityClass,
java.lang.String tag,
java.lang.String description)
XmlSpec instances.
entityClass - The entity class.description - Text description for the XSD element.tag - The XML tag.| Method Detail |
|---|
public java.lang.String getTypeName()
public void setTypeName(java.lang.String typeName)
typeName - The type name intended to be used used for explicit complexType definitions.public XmlSpec getBaseXmlSpec()
XmlSpec instance, if any.
XmlSpec instance. Null if no base spec.public void setBaseXmlSpec(XmlSpec baseXmlSpec)
XmlSpec instance.
baseXmlSpec - public java.lang.String getNoNamespaceSchemaLocation()
public void setNoNamespaceSchemaLocation(java.lang.String noNamespaceSchemaLocation)
noNamespaceSchemaLocation - The intended no-namespace XML schema location.public java.lang.String getTargetNamespace()
public void setTargetNamespace(java.lang.String targetNamespace)
targetNamespace - The intended target namespace for the XML schema.public java.lang.Class<? extends WriteableEntity> getEntityClass()
public java.util.SortedMap<java.lang.String,XmlAttribute> getAttributesByTag()
XmlAttribute instances, indexed by attribute NodeName.public java.lang.String getTag()
NoSuchObjectException - when the tag is undefined.public XmlContent getContent()
XmlContent instance.
XmlContent instance. Null if undefined.public void setContent(XmlContent content)
XmlContent instance.
content - The intended XmlContent instance.
ObjectAlreadyExistsException - when this XmlSpec already has a XmlContent.
ObjectAlreadyExistsException - when this XmlSpec already has one or more child XmlElement instances.public java.util.List<XmlAttribute> getAttributes()
XmlAttribute instances, presented in output order.public void addAttribute(XmlAttribute attribute)
XmlAttribute instance to the specification.
attribute - The new XmlAttribute.
java.lang.IllegalArgumentException - when an attribute with the same NodeName is already present.public XmlAttribute getAttribute(java.lang.String tag)
XmlAttribute instance with the indicated NodeName.
tag - The indicated NodeName.
XmlAttribute instance with the indicated NodeName.public void removeAttribute(java.lang.String tag)
XmlAttribute instance with the indicated NodeName.
tag - The indicated NodeName.public java.util.SortedMap<java.lang.String,XmlElement> getElementsByTag()
Tag order.
XmlElement instances, indexed by Tag.public java.util.List<XmlElement> getElements()
XmlElement instances, presented in output order.public void addElement(XmlElement element)
XmlElement instance to the specification.
element - The new XmlElement.
java.lang.IllegalArgumentException - when an element with the same Tag is already present.public void removeElement(java.lang.String tag)
XmlElement instance with the indicated NodeName.
tag - The indicated NodeName.public XmlElement getElement(java.lang.String tag)
XmlElement instance with the indicated Tag.
tag - The indicated Tag.
XmlElement instance with the indicated Tag.
public void validateTag(WriteableEntity entity,
org.w3c.dom.Element element)
WriteableEntity is consistent with the node name of an XML Element.
entity - A WriteableEntity instance.element - An XML Element instance.public boolean isUsed()
XmlSpec has been used in an XML schema.
XmlSpec has been used in an XML schema; false otherwise.public void setUsed(boolean used)
XmlSpec has been used in an XML schema.
used - True if this XmlSpec has been used in an XML schema; false otherwise.public void appendTypeToElement(org.w3c.dom.Element xsdElement)
xsdElement - The XSD element.public org.w3c.dom.Element createTypeDefinition(org.w3c.dom.Document document)
document - A Document instance.
public org.w3c.dom.Element createComplexTypeElement(org.w3c.dom.Element parent,
java.lang.String description)
parent - The parent element, which should be Xsd.Tags.ELEMENT for inline complex types
and Xsd.Tags.SCHEMA for explicit complex type definitions.description - Text description for the XSD element.
public org.w3c.dom.Document createSchemaDocument()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||