|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.purl.xnode.XNode
public abstract class XNode
XNode is an abstract class for an object acting as a container for XML content. XNode provides an envelope element and an extensible metadata container (in an <xnode:Header> element) for attributes such as a node ID, creation and modification timestamps, etc., with the document content stored in an <xnode:Body> element.
The XNode API (the package org.purl.xnode.*, both its source code and documentation), are released under the Apache 2.0 License. For more details, check the LICENSE file contained with the distribution, or see The Ceryle Project for more information. It is distributed with no warranty.
The following example shows an XNode wrapper around an XHTML document:
<xnode:Envelope xmlns:xnode="http://www.purl.org/xnode/1.2/"
xnode:id="n3892">
<xnode:Header
xnode:created="2001-10-22T18:33:56"
xnode:modified="2003-08-19T12:23:37">
<xnode:Property
xnode:name="DC.format"
xnode:value="application/xhtml+xml"/>
</xnode:Header>
<xnode:Body>
<html xmlns="http://www.w3.org/1999/xhtml">
[document content]
</html>
</xnode:Body>
<xnode:Repository/>
</xnode:Envelope>
The current XNode version is indicated by the XML Namespace value
found in XMLNS_xnode12.
XMLNS_xnode).
XNode 1.1 now includes event-handling methods to track changes
to the XNodeStore, and also allows for embedded XML content as
XNode metadata.
| Field Summary | |
|---|---|
static String |
ATTR_created
The local name of the created attribute. |
static String |
ATTR_id
The local name of the id attribute. |
static String |
ATTR_index
The local name of the index attribute. |
static String |
ATTR_modified
The local name of the modified attribute. |
static String |
ATTR_name
The local name of the name attribute. |
static String |
ATTR_size
The local name of the size attribute. |
static String |
ATTR_value
The local name of the value attribute. |
static String |
ATTR_version
The local name of the version attribute. |
static String |
ATTR_weight
The local name of the weight attribute. |
static String |
ELT_body
The local name of the <xnode:Body> element. |
static String |
ELT_collection
The local name of the <xnode:Collection> element. |
static String |
ELT_envelope
The local name of the <xnode:Envelope> element. |
static String |
ELT_header
The local name of the <xnode:Header> element. |
static String |
ELT_link
The local name of the <xnode:Link> element. |
static String |
ELT_property
The local name of the <xnode:Property> element. |
static String |
ELT_repository
The local name of the <xnode:Repository> element. |
static String |
ELT_revision
The local name of the <xnode:Revision> element. |
static String |
ELT_text
The local name of the <xnode:Text> element. |
static String |
VERSION_10
A String containing the XNode 1.0 version string. |
static String |
VERSION_11
A String containing the XNode 1.1 version string. |
static String |
VERSION_12
A String containing the XNode 1.2 version string. |
static String |
VERSION_13
A String containing the XNode 1.3 version string. |
static String |
XMLNS_base
A String containing a URI identifying the base XNode XML Namespace. |
static String |
XMLNS_pfx
The default XML Namespace prefix for XNode 1.x. |
static String |
XMLNS_xnode
The XML namespace identifier set to the most recent version of the XNode API. |
static String |
XMLNS_xnode10
A String containing a URI identifying the deprecated XNode 1.0 XML Namespace. |
static String |
XMLNS_xnode11
A String containing a URI identifying the deprecated XNode 1.1 XML Namespace. |
static String |
XMLNS_xnode12
A String containing a URI identifying the XNode 1.2 XML Namespace. |
static String |
XMLNS_xnode13
A String containing a URI identifying the XNode 1.3 XML Namespace. |
| Constructor Summary | |
|---|---|
protected |
XNode(String nid)
Constructor with a required ID nid. |
protected |
XNode(String nid,
Node content)
Constructor with a required ID nid and a DOM Node content. |
| Method Summary | |
|---|---|
abstract Node |
getContent()
Return a DOM Node containing this XNode's embedded content (exclusive of the XNode envelope), null if not set. |
abstract String |
getCreated()
Return the creation date of this XNode as a String. |
String |
getID()
Return the ID of this XNode as a String. |
abstract String |
getModified()
Return the modification date of this XNode as a String. |
abstract Set |
getProperties()
Return a Set containing all named properties of this XNode, an empty Set (not null) if none have been set. |
abstract Object |
getProperty(String name)
Return the named property name as an Object, null if it has not been set. |
abstract List |
getRepository()
Returns the List backing this XNode's repository (i.e., the List of individual XNodeRevision objects). |
abstract void |
modifyContent(Node content)
Modifies this XNode by setting its content to the DOM Node content. |
protected abstract void |
setContent(Node content)
Set the content of this XNode to the DOM Node content. |
abstract void |
setCreated(String timestamp)
Set the creation date of this XNode to the String timestamp. |
protected void |
setID(String nid)
Set the ID of this XNode to the String nid. |
abstract void |
setModified(String timestamp)
Set the modification date of this XNode to the String timestamp. |
abstract void |
setProperty(String name,
Object value)
Set the named property name to the Object value. |
abstract String |
toString()
Return a String representation of this XNode, including the XNode envelope. |
abstract String |
toString(boolean includeEnvelope)
Return a String representation of this XNode, including the envelope if includeEnvelope is true. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String XMLNS_base
http://purl.org/xnode/
public static final String VERSION_13
public static final String XMLNS_xnode13
http://purl.org/xnode/1.3/
public static final String VERSION_12
public static final String XMLNS_xnode12
http://purl.org/xnode/1.2/
public static final String VERSION_11
public static final String XMLNS_xnode11
http://purl.org/xnode/1.1/
public static final String VERSION_10
public static final String XMLNS_xnode10
http://purl.org/xnode/1.0/
public static final String XMLNS_xnode
This is the place where the version string for XNode is set.
public static String XMLNS_pfx
public static final String ELT_envelope
public static final String ELT_header
public static final String ELT_body
public static final String ELT_text
public static final String ELT_property
public static final String ELT_link
public static final String ELT_repository
public static final String ELT_revision
public static final String ELT_collection
public static final String ATTR_id
public static final String ATTR_created
public static final String ATTR_modified
public static final String ATTR_name
public static final String ATTR_value
public static final String ATTR_version
public static final String ATTR_size
public static final String ATTR_index
public static final String ATTR_weight
| Constructor Detail |
|---|
protected XNode(String nid)
throws XNodeException
nid - the XNode ID.
XNodeException - if the ID value is not an XML Name.
protected XNode(String nid,
Node content)
throws XNodeException
nid - the XNode ID.content - the DOM Node used as XNode content.
XNodeException - if the ID value is not an XML Name.| Method Detail |
|---|
protected void setID(String nid)
throws XNodeException
nid - the XNode ID.
XNodeException - if already set, or is not an XML Name.public String getID()
public abstract void setCreated(String timestamp)
throws XNodeException
See Note.
timestamp - the creation timestamp as a String.
XNodeException - if already set or an error occurs (such as the
timestamp being in an unrecognizable format).public abstract String getCreated()
See Note.
public abstract void setModified(String timestamp)
throws XNodeException
See Note.
timestamp - the modification timestamp as a String.
XNodeException - if an error occurs (such as the timestamp
being in an unrecognizable format).public abstract String getModified()
See Note.
public abstract void setProperty(String name,
Object value)
throws XNodeException,
NullPointerException
The provided value must be a String or a DOM Node, otherwise an XNodeException is thrown.
Modified from XNode 1.0
name - the property name.value - the property value, a String or DOM Node.
XNodeException - if the property value is invalid.
NullPointerException - if either name or value parameter is null.
public abstract Object getProperty(String name)
throws NullPointerException
Modified from XNode 1.0
name - the property name.
NullPointerException - if the name parameter is null.public abstract Set getProperties()
protected abstract void setContent(Node content)
throws XNodeException
content - the Node to set as the content of this XNode.
XNodeException - if there is existing content.
public abstract void modifyContent(Node content)
throws XNodeException
content - the Node to set as the content of this XNode.
XNodeException - if any problem occurs during modification.
public abstract Node getContent()
throws XNodeException
XNodeException
public abstract List getRepository()
throws XNodeException
XNodeRevision objects).
This will return an empty List rather than null if there are no
revisions. Note that while creation of the List is the responsibility
of the XNode, its population and management is handled entirely by
the XNodeRevisionManager.
XNodeExceptionpublic abstract String toString()
Serializations of XNodes are more efficient using the
XNodeFactory.serializeXNode(XNode,Writer,boolean) method than
using either toString() method, since implementations may find
it necessary to create an XML parser instance for each method call.
If toString() is unimplemented, it is appropriate to throw
a UnsupportedOperationException rather than return
an incorrect XML serialization.
toString in class Objectpublic abstract String toString(boolean includeEnvelope)
toString() for notes
regarding use of this method.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||