|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.charlesames.utility.entity.XmlNode
net.charlesames.utility.entity.XmlAttribute
public abstract class XmlAttribute
An XmlAttribute instance is a component of an XmlSpec that maps object properties
to XML attributes. Each XmlAttribute instance is created as an anonymous class which defines
two particular methods.
getData(WriteableEntity, org.w3c.dom.Node) implements the code which
reads data from an XML attribute into a property of a WriteableEntity instance.
XmlNode.putData(WriteableEntity, org.w3c.dom.Element) implements the code which writes data from a
WriteableEntity property into an XML attribute. Here is an example:
xmlSpec.addAttribute(new XmlAttribute("version") {
@Override
public void putData(WriteableEntity entity, Element element) {
Form form = (Form) entity;
String version = form.getVersion();
element.setAttribute(getName(), version);
}
@Override
public void getData(WriteableEntity entity, Node attribute) {
Form form = (Form) entity;
String version = attribute.getNodeValue();
form.setVersion(version);
}
});
| Constructor Summary | |
|---|---|
XmlAttribute(XmlSpec xmlSpec,
java.lang.String tag,
XmlType valueType,
java.lang.String valueUse)
Constructor for XmlAttribute instances. |
|
| Method Summary | |
|---|---|
void |
addRestrictionValue(java.lang.String restrictionValue)
Add a text string to the set of acceptable values. |
abstract void |
getData(WriteableEntity entity,
org.w3c.dom.Node attribute)
Reads data from an XML attribute Node into an WriteableEntity instance. |
java.util.Set<java.lang.String> |
getRestrictionValues()
Get the list of restricted-to values. |
XmlType |
getValueType()
Get the value for the type attribute. |
java.lang.String |
getValueUse()
Get the value for the use attribute. |
java.lang.String |
getXsdTag()
Get the tag identifying this node in an XML schema document. |
boolean |
isIncludedInSchema()
Check if this node should be visible in the schema. |
void |
setEnumValues(java.util.EnumSet<?> enumValues)
Set the enumeration of restricted-to values. |
void |
setValueUse(java.lang.String valueUse)
Set the value for the use attribute. |
org.w3c.dom.Element |
toXsdElement(org.w3c.dom.Node parent)
Convert the XML specification node to a node description in an XML schema document |
| Methods inherited from class net.charlesames.utility.entity.XmlNode |
|---|
getDescription, getTag, getXmlSpec, putData, setDescription, setIncludedInSchema |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlAttribute(XmlSpec xmlSpec,
java.lang.String tag,
XmlType valueType,
java.lang.String valueUse)
XmlAttribute instances.
xmlSpec - The XML specification that contains this attribute.tag - The XML attribute name.valueType - The XSD value type, e.g. "xs:string"valueUse - The XSD use attribute, e.g. "optional", "required".| Method Detail |
|---|
public XmlType getValueType()
type attribute.
type attribute.public java.lang.String getValueUse()
use attribute.
use attribute.public void setValueUse(java.lang.String valueUse)
use attribute.
valueUse - The intended value for the use attribute.public boolean isIncludedInSchema()
XmlNode
isIncludedInSchema in class XmlNode
public abstract void getData(WriteableEntity entity,
org.w3c.dom.Node attribute)
Node into an WriteableEntity instance.
entity - The target WriteableEntity instance.attribute - The source attribute Node.public java.lang.String getXsdTag()
XmlNode
getXsdTag in class XmlNodepublic java.util.Set<java.lang.String> getRestrictionValues()
String instances..public void addRestrictionValue(java.lang.String restrictionValue)
restrictionValue - public void setEnumValues(java.util.EnumSet<?> enumValues)
enumValues - The intended enumeration of restricted-to values. Null if not restricted.public org.w3c.dom.Element toXsdElement(org.w3c.dom.Node parent)
XmlNode
toXsdElement in class XmlNodeparent - The parent node.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||