Top Description Fields Constructors Methods
org.dom4j.datatype

public Class DatatypeElement

extends DefaultElement
implements SerializationContext, ValidationContext
Class Inheritance
All Implemented Interfaces
org.relaxng.datatype.ValidationContext, com.sun.msv.datatype.SerializationContext
Imports
com.sun.msv.datatype.DatabindableDatatype, .SerializationContext, com.sun.msv.datatype.xsd.XSDatatype, org.dom4j.Element, .Namespace, .Node, .QName, org.dom4j.tree.DefaultElement, org.relaxng.datatype.DatatypeException, .ValidationContext

DatatypeElement represents an Element which supports the XML Schema Data Types specification.

Author
James Strachan
Version
$Revision: 1.9 $

Field Summary

Modifier and TypeField and Description
private Object
data

The data (Object) value of the Attribute

private XSDatatype
datatype

The XSDatatype of the Attribute

Constructor Summary

AccessConstructor and Description
public
DatatypeElement(QName qname, XSDatatype datatype)

public
DatatypeElement(QName qname, int attributeCount, XSDatatype type)

Method Summary

Modifier and TypeMethod and Description
public Element
addText(String
is the text for the Text node.
text
)

Overrides org.dom4j.tree.AbstractElement.addText.

Implements org.dom4j.Element.addText.

Adds a new Text node with the given text to this element.
protected void
childAdded(Node
DOCUMENT ME!
node
)

Overrides org.dom4j.tree.AbstractElement.childAdded.

Override to force lazy recreation of data object
protected void
childRemoved(Node
DOCUMENT ME!
node
)

Overrides org.dom4j.tree.AbstractElement.childRemoved.

Override to force lazy recreation of data object
public String
getBaseUri()

Implements org.relaxng.datatype.ValidationContext.getBaseUri.

Returns the base URI of the context.
public Object
getData()

Overrides org.dom4j.tree.AbstractElement.getData.

Implements org.dom4j.Element.getData.

Accesses the data of this element which may implement data typing bindings such as XML Schema or Java Bean bindings or will return the same value as getText
public String
getNamespacePrefix(String uri)

Implements com.sun.msv.datatype.SerializationContext.getNamespacePrefix.

get namespace prefix for the given namespace URI.
public XSDatatype

Returns:

DOCUMENT ME!
getXSDatatype
()

Returns the MSV XSDatatype for this node

public boolean
isNotation(String notationName)

Implements org.relaxng.datatype.ValidationContext.isNotation.

Checks if a notation is declared with the specified name.
public boolean
isUnparsedEntity(String entityName)

Implements org.relaxng.datatype.ValidationContext.isUnparsedEntity.

Checks if an unparsed entity is declared with the specified name.
public String
resolveNamespacePrefix(String prefix)

Implements org.relaxng.datatype.ValidationContext.resolveNamespacePrefix.

Resolves a namespace prefix to the corresponding namespace URI.
public void
setData(Object
DOCUMENT ME!
data
)

Overrides org.dom4j.tree.AbstractElement.setData.

Implements org.dom4j.Element.setData.

Sets the data value of this element if this element supports data binding or calls setTextif it doesn't
public void
setText(String
is the new textual value of this node
text
)

Overrides org.dom4j.tree.AbstractElement.setText.

Implements org.dom4j.Node.setText.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

public String
toString()

Overrides org.dom4j.tree.AbstractElement.toString.

Returns a string representation of the object.
protected void
Inherited from org.dom4j.tree.DefaultElement:
addadditionalNamespacesadditionalNamespacesaddNewNodeattributeattributeattributeattributeattributeCountattributeIteratorattributeListattributeListattributesclearContentclonecontentListdeclaredNamespaceselementelementelementgetDocumentgetDocumentFactorygetNamespaceForPrefixgetNamespaceForURIgetParentgetQNamegetStringValuegetTextindexOfnodenodeCountnodeIteratorprocessingInstructionprocessingInstructionsprocessingInstructionsremoveremoveNoderemoveProcessingInstructionsetAttributeListsetAttributessetContentsetDocumentsetParentsetQNamesupportsParent

Field Detail

databack to summary
private Object data

The data (Object) value of the Attribute

datatypeback to summary
private XSDatatype datatype

The XSDatatype of the Attribute

Constructor Detail

DatatypeElementback to summary
public DatatypeElement(QName qname, XSDatatype datatype)
DatatypeElementback to summary
public DatatypeElement(QName qname, int attributeCount, XSDatatype type)

Method Detail

addTextback to summary
public Element addText(String text)

Overrides org.dom4j.tree.AbstractElement.addText.

Implements org.dom4j.Element.addText.

Doc from org.dom4j.Element.addText.

Adds a new Text node with the given text to this element.

Parameters
text:String

is the text for the Text node.

Returns:Element

this Element instance.

childAddedback to summary
protected void childAdded(Node node)

Overrides org.dom4j.tree.AbstractElement.childAdded.

Override to force lazy recreation of data object

Parameters
node:Node

DOCUMENT ME!

childRemovedback to summary
protected void childRemoved(Node node)

Overrides org.dom4j.tree.AbstractElement.childRemoved.

Override to force lazy recreation of data object

Parameters
node:Node

DOCUMENT ME!

getBaseUriback to summary
public String getBaseUri()

Implements org.relaxng.datatype.ValidationContext.getBaseUri.

Doc from org.relaxng.datatype.ValidationContext.getBaseUri.

Returns the base URI of the context. The null string may be returned if no base URI is known.

getDataback to summary
public Object getData()

Overrides org.dom4j.tree.AbstractElement.getData.

Implements org.dom4j.Element.getData.

Doc from org.dom4j.Element.getData.

Accesses the data of this element which may implement data typing bindings such as XML Schema or Java Bean bindings or will return the same value as getText

Returns:Object

DOCUMENT ME!

getNamespacePrefixback to summary
public String getNamespacePrefix(String uri)

Implements com.sun.msv.datatype.SerializationContext.getNamespacePrefix.

Doc from com.sun.msv.datatype.SerializationContext.getNamespacePrefix.

get namespace prefix for the given namespace URI. this method is used to convert QName. It is a responsibility of the callee to ensure that the returned prefix is properly declared.

Returns:String

prefix for this namespace URI. return null to indicate that this namespace URI is the default name space. In this case, QNames are converted into unqualified names (just the local names only as NCNames).

getXSDatatypeback to summary
public XSDatatype getXSDatatype()

Returns the MSV XSDatatype for this node

Returns:XSDatatype

DOCUMENT ME!

isNotationback to summary
public boolean isNotation(String notationName)

Implements org.relaxng.datatype.ValidationContext.isNotation.

Doc from org.relaxng.datatype.ValidationContext.isNotation.

Checks if a notation is declared with the specified name.

Returns:boolean

true if the DTD has a notation declaration for the specified name. false otherwise.

isUnparsedEntityback to summary
public boolean isUnparsedEntity(String entityName)

Implements org.relaxng.datatype.ValidationContext.isUnparsedEntity.

Doc from org.relaxng.datatype.ValidationContext.isUnparsedEntity.

Checks if an unparsed entity is declared with the specified name.

Returns:boolean

true if the DTD has an unparsed entity declaration for the specified name. false otherwise.

resolveNamespacePrefixback to summary
public String resolveNamespacePrefix(String prefix)

Implements org.relaxng.datatype.ValidationContext.resolveNamespacePrefix.

Doc from org.relaxng.datatype.ValidationContext.resolveNamespacePrefix.

Resolves a namespace prefix to the corresponding namespace URI. This method is used for validating the QName type, for example.

If the prefix is "" (empty string), it indicates an unprefixed value. The callee should resolve it as for an unprefixed element, rather than for an unprefixed attribute.

If the prefix is "xml", then the callee must resolve this prefix into "http://www.w3.org/XML/1998/namespace", as defined in the XML Namespaces Recommendation.

Returns:String

namespace URI of this prefix. If the specified prefix is not declared, the implementation must return null.

setDataback to summary
public void setData(Object data)

Overrides org.dom4j.tree.AbstractElement.setData.

Implements org.dom4j.Element.setData.

Doc from org.dom4j.Element.setData.

Sets the data value of this element if this element supports data binding or calls setTextif it doesn't

Parameters
data:Object

DOCUMENT ME!

setTextback to summary
public void setText(String text)

Overrides org.dom4j.tree.AbstractElement.setText.

Implements org.dom4j.Node.setText.

Doc from org.dom4j.Node.setText.

Sets the text data of this node or this method will throw an UnsupportedOperationException if it is read-only.

Parameters
text:String

is the new textual value of this node

toStringback to summary
public String toString()

Overrides org.dom4j.tree.AbstractElement.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

validateback to summary
protected void validate(String text) throws IllegalArgumentException