|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.purl.xnode.XNode
org.ceryle.xnode.XNodeImpl
public class XNodeImpl
An implementation of the XNode API, which acts as a container
for XML content by providing an envelope element and metadata
attributes such as a node ID, a creation timestamp, etc.
XNode extensions included here use a Ceryle PSI identifier
whose base is http://purl.org/ceryle/xnode/
(see PROPERTY_EXTENSION).
The XNode Implementation (the package org.ceryle.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.
XNode| Field Summary | |
|---|---|
protected Node |
m_content
|
protected Document |
m_document
|
static boolean |
PERMIT_XML_CONTENT
When true, permit arbitrary XML as XNode content rather than restricting it to <xnode:Text> or <xnode:Collection> elements. |
static String |
PFX_ATTR_created
A String containing the attribute name "xnode:created". |
static String |
PFX_ATTR_modified
A String containing the attribute name "xnode:modified". |
static String |
PFX_ATTR_xmlns
A String containing "xmlns:xnode". |
static String |
PFX_ELT_link
A String containing the element name "xnode:Link". |
static String |
PFX_ELT_property
A String containing the element name "xnode:Property". |
static boolean |
PRESERVE_WS
When true, XNode content will preemptively add an xml:space="preserve" attribute to the document element so that whitespace will be preserved for later serialization. |
static String |
PROPERTY_DOCTYPE_NAME
A String containing the name of the XNode document type name property, an XNode extension to store the document root name, i.e., the string following the "DOCTYPE" of the DOCTYPE declaration of the source document. |
static String |
PROPERTY_EXTENSION
Base URI for Ceryle XNode implementation metadata extensions. |
static String |
PROPERTY_PUBLIC_ID
A String containing the name of the XNode public ID property, an XNode extension to store the PUBLIC identifier of the DOCTYPE declaration of the source document. |
static String |
PROPERTY_SYSTEM_ID
A String containing the name of the XNode system ID property, an XNode extension to store the SYSTEM identifier of the DOCTYPE declaration of the source document. |
static boolean |
VALUE_STORED_AS_ATTRIBUTE
When true, XNode properties are stored as attribute values. |
| Fields inherited from class org.purl.xnode.XNode |
|---|
ATTR_created, ATTR_id, ATTR_index, ATTR_modified, ATTR_name, ATTR_size, ATTR_value, ATTR_version, ATTR_weight, ELT_body, ELT_collection, ELT_envelope, ELT_header, ELT_link, ELT_property, ELT_repository, ELT_revision, ELT_text, VERSION_10, VERSION_11, VERSION_12, VERSION_13, XMLNS_base, XMLNS_pfx, XMLNS_xnode, XMLNS_xnode10, XMLNS_xnode11, XMLNS_xnode12, XMLNS_xnode13 |
| Constructor Summary | |
|---|---|
protected |
XNodeImpl(String id,
String created,
Node node)
Constructor with a required String ID id, required creation timestamp created, and an XML DOM Node node. |
| Method Summary | |
|---|---|
Element |
getBodyElement()
Returns a DOM Element representation of this XNode's body, or null if unavailable. |
Node |
getContent()
Returns a DOM Node representation of this XNode's content. |
String |
getCreated()
Returns the creation date of this XNode as a String. |
Document |
getDocument()
|
Element |
getEnvelopeElement()
Returns a DOM Element representation of this XNode's envelope. |
Element |
getHeaderElement()
Returns a DOM Element representation of this XNode's header. |
String |
getID()
Returns the ID of this XNode. |
String |
getModified()
Returns the modification date of this XNode as a String, null if has not been set. |
Set |
getProperties()
Returns a Set containing the named properties of this XNode (as Strings), an empty Set (not null) if none have been set. |
Object |
getProperty(String name)
Returns the named property name of this XNode as a Object, null if it has not been set. |
List |
getRepository()
Returns the List backing this XNode's repository (i.e., the List of individual XNodeRevision objects). |
protected Element |
getRepositoryElement()
Returns the DOM Element representation of this XNode's repository. |
boolean |
hasRepository()
Returns true if the repository for this XNode has been generated. |
void |
modifyContent(Node node)
Modifies the content of this XNode to the DOM Node node. |
void |
setContent(Node node)
Sets the content of this XNode to the Node node (which can be a DOM Document or Element node), throwing an XNodeException if the content is already set. |
void |
setCreated(String timestamp)
Sets the creation date of this XNode to the String timestamp. |
void |
setID(String id)
Sets the ID of this XNode to the String id, throwing an XNodeException if the value is not an XML Name. |
void |
setModified(String timestamp)
Sets the modification date of this XNode to the String timestamp. |
void |
setProperty(String name,
Object value)
Sets the named property name of this XNode to the Object value. |
String |
toString()
Returns a String representation of this XNode, including the XNode markup envelope. |
String |
toString(boolean includeEnvelope)
Returns a String representation of this XNode. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String PROPERTY_EXTENSION
Value: http://purl.org/ceryle/xnode/
public static String PROPERTY_PUBLIC_ID
Property name: http://purl.org/ceryle/xnode/publicId
public static String PROPERTY_SYSTEM_ID
Property name: http://purl.org/ceryle/xnode/systemId
public static String PROPERTY_DOCTYPE_NAME
Property name: http://purl.org/ceryle/xnode/doctypeName
public static final boolean PRESERVE_WS
public static final boolean VALUE_STORED_AS_ATTRIBUTE
public static final boolean PERMIT_XML_CONTENT
public static final String PFX_ATTR_xmlns
public static final String PFX_ELT_property
public static final String PFX_ELT_link
public static final String PFX_ATTR_created
public static final String PFX_ATTR_modified
protected Document m_document
protected Node m_content
| Constructor Detail |
|---|
protected XNodeImpl(String id,
String created,
Node node)
throws XNodeException
XNodeException| Method Detail |
|---|
public void setID(String id)
throws XNodeException
setID in class XNodeid - the XNode ID.
XNodeException - if not an XML Name.public String getID()
getID in class XNode
public void setContent(Node node)
throws XNodeException
setContent in class XNodenode - the Node to set as the content of this XNode.
XNodeException - if there is existing content.public Document getDocument()
public Node getContent()
throws XNodeException
getContent in class XNodeXNodeException
public void modifyContent(Node node)
throws XNodeException
modifyContent in class XNodenode - the Node to set as the content of this XNode.
XNodeException - if any problem occurs during modification.
public Element getEnvelopeElement()
throws XNodeException
This is not an API method.
XNodeException
public Element getHeaderElement()
throws XNodeException
This is not an API method.
XNodeException
public Element getBodyElement()
throws XNodeException
This is not an API method.
XNodeException
protected Element getRepositoryElement()
throws XNodeException
This is not an API method.
XNodeExceptionpublic boolean hasRepository()
This is not an XNode API method.
public 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.
This is an XNode API method.
getRepository in class XNodeXNodeException
public void setCreated(String timestamp)
throws XNodeException
setCreated in class XNodetimestamp - the creation timestamp as a String.
XNodeException - if already set or an error occurs (such as the
timestamp being in an unrecognizable format).public String getCreated()
getCreated in class XNode
public void setModified(String timestamp)
throws XNodeException
setModified in class XNodetimestamp - the modification timestamp as a String.
XNodeException - if an error occurs (such as the timestamp
being in an unrecognizable format).public String getModified()
getModified in class XNode
public void setProperty(String name,
Object value)
throws XNodeException,
NullPointerException
Note: This is the extension mechanism for XNode, storing each property as a <xnode:Property> child element of the <xnode:Header> element.
Note that this method currently only supports String and List (of XNodeLinks) property values.
setProperty in class XNodename - 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 Object getProperty(String name)
getProperty in class XNodename - the property name.
public Set getProperties()
getProperties in class XNodepublic String toString()
Unimplemented.
toString in class XNodepublic String toString(boolean includeEnvelope)
Unimplemented. This current just returns some basic information about the XNode, faked as a single XML element.
toString in class XNode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||