| java.lang.Object org.purl.sword.base.XmlElement
All known Subclasses: org.w3.atom.Content, org.purl.sword.base.Service, org.purl.sword.base.Collection, org.w3.atom.Link, org.w3.atom.TextConstruct, org.purl.sword.base.Workspace, org.w3.atom.Source, org.w3.atom.Entry, org.w3.atom.Generator, org.w3.atom.Author,
XmlElement | public class XmlElement (Code) | | Parent class for all classes that represent an XML element. This provides
some common utility methods that are useful for marshalling and
unmarshalling data.
author: Neil Taylor |
Field Summary | |
final protected static String | DATE_FORMAT The Date format that is used to parse dates to and from the ISO format
in the XML data. | protected String | localName | protected String | prefix The name to use for the prefix. |
DATE_FORMAT | final protected static String DATE_FORMAT(Code) | | The Date format that is used to parse dates to and from the ISO format
in the XML data.
|
prefix | protected String prefix(Code) | | The name to use for the prefix.
|
XmlElement | public XmlElement(String localName)(Code) | | Parameters: localName - |
dateToString | protected String dateToString(Date date)(Code) | | Convert the date to a string. If the date is null,
the result will result to a default date of 1st January 1970.
FIXME - is this sensible?
Parameters: date - The Date object. The Date, expressed as a string in the format yyyy-MM-ddTHH:mm:ssZ. |
getQualifiedName | public String getQualifiedName()(Code) | | Retrieve the qualified name for this object. This uses the
prefix and local name stored in this object.
A string of the format 'prefix:localName' |
getQualifiedName | public String getQualifiedName(String name)(Code) | | Retrieve the qualified name. The prefix for this object is prepended
onto the specified local name.
Parameters: name - the specified local name. A string of the format 'prefix:name' |
isInstanceOf | protected boolean isInstanceOf(Element element, String localName, String namespaceURI)(Code) | | Determines if the specified element is an instance of the element name. If
you are checking the name title in the ATOM namespace, then the local name
should be 'title' and the namespaceURI is the URI for the ATOM namespace.
Parameters: element - The specified element. Parameters: localName - The local name for the element. Parameters: namespaceURI - The namespace for the element. True if the element matches the localname and namespace. Otherwise, false. |
stringToDate | protected Date stringToDate(String date) throws ParseException(Code) | | Convert the string into a Date object.
Parameters: date - The date, represented as a string. A Date. throws: ParseException - If the string does not match the format of yyyy-MM-ddTHH:mm:ssZ. |
unmarshallBoolean | protected boolean unmarshallBoolean(Element element) throws UnmarshallException(Code) | | Extract a boolean value from the specified element. The boolean value
is represented as the string 'true' or 'false' as the only child
of the specified element.
Parameters: element - The element that contains the boolean value. True or false, based on the string in the element's content. throws: UnmarshallException - If the element does not contain a single child, or ifthe child does not contain the value 'true' or 'false'. |
unmarshallDate | protected Date unmarshallDate(Element element) throws UnmarshallException(Code) | | Extract an date value from the specified element. The date value
is represented as a string in the only child of the element.
Parameters: element - The element that contains the date. The date. throws: UnmarshallException - If the element does not contain a single child, or ifthe child does not contain the valid date. |
unmarshallInteger | protected int unmarshallInteger(Element element) throws UnmarshallException(Code) | | Extract an integer value from the specified element. The integer value
is represented as a string in the only child
of the specified element.
Parameters: element - The element that contains the integer. The integer. throws: UnmarshallException - If the element does not contain a single child, or ifthe child does not contain the valid integer. |
unmarshallString | protected String unmarshallString(Element element) throws UnmarshallException(Code) | | Extract a string value from the specified element. The value
is the only child of the specified element.
Parameters: element - The element that contains the string value. The string. throws: UnmarshallException - If the element does not contain a single child. |
|
|