|
||||||||||
| 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.XmlElement
net.charlesames.utility.entity.XmlSimpleElement
public abstract class XmlSimpleElement
An XmlSimpleElement instance is a component of an XmlSpec that maps object properties,
object references, and child objects to XML child elements.
Each XmlSimpleElement instance is created as an anonymous class which defines two particular methods.
XmlElement.getData(WriteableEntity, Element) implements the code which reads data from an XML element into a WriteableEntity instance.
XmlNode.putData(WriteableEntity, Element) implements the code which writes data from a WriteableEntity property into an XML attribute.
Here is an example:
xmlSpec.addElement(new XmlElement("seed") {
@Override
public void putData(WriteableEntity entity, Element element) {
Stage stage = (Stage) entity;
Xml.appendContentElement(element, getTag(), Long.toString(stage.seed));
}
@Override
public void getData(WriteableEntity entity, Element element) {
Stage stage = (Stage) entity;
try {
stage.seed = Xml.getLongContent(element);
}
catch (IllegalArgumentException e) {
stage.logLoadError(element, e.getMessage());
} catch (Exception e) {
stage.logLoadError(element, e.getMessage());
}
}
});
| Constructor Summary | |
|---|---|
XmlSimpleElement(XmlSpec xmlSpec,
java.lang.String tag,
XmlType valueType)
Constructor for XmlSimpleElement instances. |
|
| Method Summary | |
|---|---|
void |
addRestrictionValue(java.lang.String restrictionValue)
Add a text string to the set of acceptable values. |
java.util.Set<java.lang.String> |
getRestrictionValues()
Get the list of restricted-to values. |
void |
setEnumValues(java.util.EnumSet<?> enumValues)
Set the enumeration of restricted-to values. |
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.XmlElement |
|---|
getData, getMaxOccurs, getMinOccurs, getXsdTag, isIncludedInSchema, setMaxOccurs, setMinOccurs |
| 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 XmlSimpleElement(XmlSpec xmlSpec,
java.lang.String tag,
XmlType valueType)
XmlSimpleElement instances.
xmlSpec - The parent XML specification.tag - The XML Node name.valueType - The XSD value type, e.g. "xs:string"| Method Detail |
|---|
public 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 XmlElementparent - The parent node.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||