Top Description Fields Constructors Methods
org.dom4j.datatype

public Class DatatypeAttribute

extends AbstractAttribute
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, .QName, org.dom4j.tree.AbstractAttribute, org.relaxng.datatype.DatatypeException, .ValidationContext

DatatypeAttribute represents an Attribute 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

private Element
parent

The parent Element of the Attribute

private QName
qname

The QName for this element

private String
text

The text value of the Attribute

Constructor Summary

AccessConstructor and Description
public
public
DatatypeAttribute(QName qname, XSDatatype datatype, String text)

Method Summary

Modifier and TypeMethod and Description
protected Object
public String
getBaseUri()

Implements org.relaxng.datatype.ValidationContext.getBaseUri.

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

Overrides org.dom4j.tree.AbstractAttribute.getData.

Implements org.dom4j.Attribute.getData.

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

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

get namespace prefix for the given namespace URI.
public Element
getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

public QName
getQName()

Implements org.dom4j.Attribute.getQName.

Returns the QName of this attribute which represents the local name, the qualified name and the Namespace.
public String
getValue()

Implements org.dom4j.Attribute.getValue.

Returns the value of the attribute.
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
isReadOnly()

Overrides org.dom4j.tree.AbstractNode.isReadOnly.

Implements org.dom4j.Node.isReadOnly.

isReadOnly returns true if this node is read only and cannot be modified.

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
the attribute data
data
)

Overrides org.dom4j.tree.AbstractAttribute.setData.

Implements org.dom4j.Attribute.setData.

Sets the data value of this attribute if this element supports data binding or calls Node#setText(String)if it doesn't.
public void
setParent(Element
is the new parent of this node.
parent
)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

public void
setValue(String
is the new value of this attribute
value
)

Overrides org.dom4j.tree.AbstractAttribute.setValue.

Implements org.dom4j.Attribute.setValue.

Sets the value of this attribute or this method will throw an UnsupportedOperationException if it is read-only.
public boolean
supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

public String
toString()

Overrides org.dom4j.tree.AbstractAttribute.toString.

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

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

parentback to summary
private Element parent

The parent Element of the Attribute

qnameback to summary
private QName qname

The QName for this element

textback to summary
private String text

The text value of the Attribute

Constructor Detail

DatatypeAttributeback to summary
public DatatypeAttribute(QName qname, XSDatatype datatype)
DatatypeAttributeback to summary
public DatatypeAttribute(QName qname, XSDatatype datatype, String text)

Method Detail

convertToValueback to summary
protected Object convertToValue(String txt)
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.AbstractAttribute.getData.

Implements org.dom4j.Attribute.getData.

Doc from org.dom4j.Attribute.getData.

Accesses the data of this attribute which may implement data typing bindings such as XML Schema or Java Bean bindings or will return the same value as Node#getText().

Returns:Object

the attribute data

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).

getParentback to summary
public Element getParent()

Overrides org.dom4j.tree.AbstractNode.getParent.

Implements org.dom4j.Node.getParent.

Doc from org.dom4j.Node.getParent.

getParent returns the parent Element if this node supports the parent relationship or null if it is the root element or does not support the parent relationship.

This method is an optional feature and may not be supported for all Node implementations.

Returns:Element

the parent of this node or null if it is the root of the tree or the parent relationship is not supported.

getQNameback to summary
public QName getQName()

Implements org.dom4j.Attribute.getQName.

Doc from org.dom4j.Attribute.getQName.

Returns the QName of this attribute which represents the local name, the qualified name and the Namespace.

Returns:QName

the QName associated with this attribute

getValueback to summary
public String getValue()

Implements org.dom4j.Attribute.getValue.

Doc from org.dom4j.Attribute.getValue.

Returns the value of the attribute. This method returns the same value as the Node#getText()method.

Returns:String

the value of the attribute

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.

isReadOnlyback to summary
public boolean isReadOnly()

Overrides org.dom4j.tree.AbstractNode.isReadOnly.

Implements org.dom4j.Node.isReadOnly.

Doc from org.dom4j.Node.isReadOnly.

isReadOnly returns true if this node is read only and cannot be modified. Any attempt to modify a read-only Node will result in an UnsupportedOperationException being thrown.

Returns:boolean

true if this Node is read only and cannot be modified otherwise false.

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.AbstractAttribute.setData.

Implements org.dom4j.Attribute.setData.

Doc from org.dom4j.Attribute.setData.

Sets the data value of this attribute if this element supports data binding or calls Node#setText(String)if it doesn't.

Parameters
data:Object

the attribute data

setParentback to summary
public void setParent(Element parent)

Overrides org.dom4j.tree.AbstractNode.setParent.

Implements org.dom4j.Node.setParent.

Doc from org.dom4j.Node.setParent.

setParent sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.

This method should only be called from inside an Element implementation method and is not intended for general use.

Parameters
parent:Element

is the new parent of this node.

setValueback to summary
public void setValue(String value)

Overrides org.dom4j.tree.AbstractAttribute.setValue.

Implements org.dom4j.Attribute.setValue.

Doc from org.dom4j.Attribute.setValue.

Sets the value of this attribute or this method will throw an UnsupportedOperationException if it is read-only.

Parameters
value:String

is the new value of this attribute

supportsParentback to summary
public boolean supportsParent()

Overrides org.dom4j.tree.AbstractNode.supportsParent.

Implements org.dom4j.Node.supportsParent.

Doc from org.dom4j.Node.supportsParent.

supportsParent returns true if this node supports the parent relationship.

Some XML tree implementations are singly linked and only support downward navigation through children relationships. The default case is that both parent and children relationships are supported though for memory and performance reasons the parent relationship may not be supported.

Returns:boolean

true if this node supports the parent relationship or false it is not supported

toStringback to summary
public String toString()

Overrides org.dom4j.tree.AbstractAttribute.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 txt) throws IllegalArgumentException