|
Data Request Broker 2-3-release |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfr.gael.drb.DrbDefaultNodesChangeProducer
fr.gael.drb.DrbAbstractNode
fr.gael.drb.impl.DrbNodeImpl
fr.gael.drb.impl.xml.XmlNode
public class XmlNode
XML node implementation. This implementation uses the DOM API provided by W3C to comply the DrbNode interface. It allows to browse the XML documents with the Data Request Broker API.
Note: the main difference between DRB API and the DOM provided by the W3C is that the children of a node cannot be notations, PI, ENTITY, attributes, etc. All the nodes corresponds to the XML markups and their content the text embedded between the markups. Attributes are supported but processing instructions, ENTITY, notation, etc. are discarded by the DRB.
| Field Summary | |
|---|---|
static String |
XML_NAMESPACE
XML Namespace |
static String |
XML_PREFIX
XML Prefix |
static String |
XMLNS_NAMESPACE
XMLNS Namespace |
static String |
XMLNS_PREFIX
XMLNS Prefix |
| Fields inherited from interface fr.gael.drb.DrbItem |
|---|
ATTRIBUTE_ITEM, NODE_ITEM, UNDEFINED_ITEM, VALUE_ITEM |
| Constructor Summary | |
|---|---|
XmlNode(InputStream input_stream,
DrbNode base_node)
Deprecated. As of DRB 2.2, added the XmlDocument class. |
|
XmlNode(Node node)
Deprecated. As of DRB 2.2, added the XmlDocument class. |
|
XmlNode(Node node,
DrbNode base_node)
Deprecated. As of DRB 2.2, added the XmlDocument class. |
|
XmlNode(Reader reader,
DrbNode base_node)
Deprecated. As of DRB 2.2, added the XmlDocument class. |
|
XmlNode(String xml_string)
Deprecated. As of DRB 2.2, added the XmlDocument class. |
|
| Method Summary | |
|---|---|
boolean |
allowsMultiOccurrence()
Check if this node may have multiple occurrence |
DrbNode |
appendChild(DrbNode nodes)
Appends a child at the end of the children list. |
boolean |
equals(Object obj)
Indicates whether this node is "equal to" to another node. |
void |
flush()
Performs any pending changes. |
DrbAttributeList |
getAttributes()
The attributes of the current node. |
DrbNode |
getChildAt(int index)
The child located at a specific position. |
DrbNodeList |
getChildren()
The children of the current node. |
int |
getChildrenCount()
Number of children. |
DrbSequence |
getContent()
The content of the current node. |
DrbNode |
getFirstChild()
The first child of the current node. |
int |
getIndex()
The index of the node in the parent children list. |
DrbNode |
getLastChild()
The last child of the curren node. |
String |
getName()
The name of the node. |
DrbNode |
getNamedChild(String name,
int occurence)
Returns an occurence of child matching a specific name. |
Namespace |
getNamespaceBindings()
Get the namespace bindings. |
String |
getNamespaceURI()
The namespace URI of the XML node. |
DrbNode |
getNextSibling()
The next sibling of the current node. |
int |
getOccurrence()
Occurrence of the node. |
DrbNode |
getParent()
The parent of the current node. |
DrbNode |
getPreviousSibling()
The previous sibling of the current node. |
DrbNode |
getRoot()
The root node of the XML node. |
Value |
getValue()
The contents of the current node. |
int |
getValueType()
The content type of the node. |
boolean |
hasChild()
Tests if the current node has any child. |
DrbNode |
insertChild(DrbNode new_node,
int index)
Inserts a child at a given position. |
void |
removeChild(int index)
Removes an existing child. |
void |
rename(String name)
Changes the name of the node. |
DrbNode |
replaceChild(int index,
DrbNode new_node)
Replaces a child of the current node. |
void |
setAttributes(DrbAttributeList attributes)
Set the attribute list of a node. |
void |
setNamespaceURI(String namespace_uri)
Sets a namespace resource identifier. |
Value |
setValue(Value value)
Changes the value of the node. |
String |
toString()
String representqtion of the object. |
static String |
toXML(String str)
Format an XML string. |
| Methods inherited from class fr.gael.drb.impl.DrbNodeImpl |
|---|
close, createAttribute, createNode, getImpl, getProvider, hasImpl |
| Methods inherited from class fr.gael.drb.DrbAbstractNode |
|---|
appendReference, getAttribute, getItemType, getPath, getXPathName, getXPathName, setNamespaceBindings |
| Methods inherited from class fr.gael.drb.DrbDefaultNodesChangeProducer |
|---|
addNodesChangeListener, getListenerList, nodesChanged, nodesInserted, nodesRemoved, removeNodesChangeListener, setListenerList, structureChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String XML_NAMESPACE
public static final String XML_PREFIX
public static final String XMLNS_NAMESPACE
public static final String XMLNS_PREFIX
| Constructor Detail |
|---|
public XmlNode(Node node)
node - The DOM element to be wrapped. This parameter shall never be
null.XmlDocument
public XmlNode(InputStream input_stream,
DrbNode base_node)
input_stream - The InputStream to build the DOM node.base_node - A reference to a the base node of an external
implementation.XmlDocument.XmlDocument(java.io.InputStream)
public XmlNode(Reader reader,
DrbNode base_node)
reader - The reader to build the DOM node.base_node - A reference to a the base node of an external
implementation.XmlDocument.XmlDocument(java.io.Reader)public XmlNode(String xml_string)
xml_string - The XML string. This parameter shall never be null.XmlDocument.XmlDocument(java.lang.String)
public XmlNode(Node node,
DrbNode base_node)
node - The DOM node to be wrapped. This parameter shall never be
null.base_node - A reference to a the base node of an external
implementation.XmlDocument| Method Detail |
|---|
public boolean equals(Object obj)
equals in class DrbAbstractNodeobj - another value.
public String getName()
getName in class DrbAbstractNodepublic int getIndex()
getIndex in class DrbAbstractNodepublic DrbNode getRoot()
getRoot in class DrbAbstractNodepublic int getOccurrence()
getOccurrence in class DrbAbstractNodepublic boolean allowsMultiOccurrence()
allowsMultiOccurrence in class DrbAbstractNodepublic String getNamespaceURI()
getNamespaceURI in class DrbAbstractNodepublic int getValueType()
getValueType in class DrbAbstractNodepublic Value getValue()
getValue in class DrbAbstractNodepublic Namespace getNamespaceBindings()
getNamespaceBindings in class DrbAbstractNodepublic final DrbAttributeList getAttributes()
getAttributes in class DrbAbstractNodepublic DrbNode getParent()
getParent in class DrbAbstractNodepublic DrbNodeList getChildren()
getChildren in class DrbAbstractNodepublic DrbSequence getContent()
getContent in class DrbAbstractNodepublic boolean hasChild()
hasChild in class DrbAbstractNode
public DrbNode getNamedChild(String name,
int occurence)
getNamedChild in class DrbAbstractNodename - The name to match.occurence - The occurence number of the desired child.
public DrbNode getFirstChild()
getFirstChild in class DrbAbstractNodepublic DrbNode getLastChild()
getLastChild in class DrbAbstractNodepublic DrbNode getChildAt(int index)
getChildAt in class DrbAbstractNodeindex - the index of the child node to find
public int getChildrenCount()
getChildrenCount in class DrbAbstractNodepublic DrbNode getPreviousSibling()
getPreviousSibling in class DrbAbstractNodepublic DrbNode getNextSibling()
getNextSibling in class DrbAbstractNodepublic void flush()
flush in class DrbNodeImplpublic String toString()
toString in class DrbAbstractNode
public Value setValue(Value value)
throws NullPointerException,
ClassCastException,
UnsupportedOperationException
Important note: The implementation will rewrite the entire file with the default XmlWritter. Some formatting may be lost depending on the capabilties of the encoder. It will support at least: Element, Attribute, Text and Namespace information. The whitespace and data not exposed in DrbNode will be definitly lost.
Events: This operation fires a node changed event when the implementation is a node change producer. The node affected by the change is the current node as well as the source node. The called operation is the nodesChanged() of the listeners.
setValue in interface DrbNodesetValue in class DrbAbstractNodevalue - The new value of the node.
NullPointerException - This exception is raised when the passed
reference to the value is null. This exception may be overriden
by an UnsupportedOperationException.
ClassCastException - This exception is raised when the
implementation has not succeeded to cast the input value in a
type compatible with the current node.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested assignment for
any reason.
public void setAttributes(DrbAttributeList attributes)
throws NullPointerException,
UnsupportedOperationException
Warning: The input attributes may be duplicated or re-instanciated according to the targetted implementation. References to the effectively inserted attributes can be reteived from the getAttributes() operation of the DrbNode. It is highly recommended to discard the references to the input attribuets if not mandatory.
Important note: The implementation of the node is not supposed to accept attribute changes. For instance it may not be possible to change the size attribute of a file through this operation with would meant a effective file resize that is not really relevant without additional data.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the current node as well as the source node.The called operation is the nodesChanged() of the listeners.
setAttributes in interface DrbNodesetAttributes in class DrbAbstractNodeattributes - A reference to the new attribute list.
NullPointerException - This exception is raised when the passed
reference to the attribute list is null. This exception may be
overriden by an UnsupportedOperationException.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested attribute changes
for any reason.
public void rename(String name)
throws NullPointerException,
UnsupportedOperationException
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the current standing also as the source of the event. The called opetation is the nodesChanged() of the listeners.
rename in class DrbAbstractNodename - Reference to the new name.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested rename for any
reason (e.g. specific case or general incapability).
NullPointerException - This exception is raised when the passed name
is a null reference.This exception may be overriden by an
UnsupportedOperationException.
public void setNamespaceURI(String namespace_uri)
throws NullPointerException,
UnsupportedOperationException
Important note: The implementation of the node is not supposed to accept namespace changes. For instance it may not be possible to change the namespace of a file that is basically fixed.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the current node as well as the source node.The called operation is the nodesChanged() of the listeners.
setNamespaceURI in interface DrbNodesetNamespaceURI in class DrbAbstractNodenamespace_uri - A reference to the new namespace identifier.
NullPointerException - This exception is raised when the passed
reference to the new namespace identifier is null.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested namespace change
for any reason (e.g. by definition or in the specific case).
public DrbNode replaceChild(int index,
DrbNode new_node)
throws NullPointerException,
IndexOutOfBoundsException,
UnsupportedOperationException
Warning: The replacing node may be duplicated or re-instanciated according to the targetted implementation.A reference to the effectively replacing node is returned by the operation. It is highly recommended to discard the reference to the input node if not mandatory and to reference the returned one.
Important note: The implementation of the node is not supposed to accept any kind of node For instance it may not be possible to insert a node wrapping a file in an XML document. The documentation of the implementation shall describe its specific strategy.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the new node and the source is the current node. The called operation is the structureChanged() of the listeners.
replaceChild in interface DrbNodereplaceChild in class DrbAbstractNodeindex - Index of the node to be replaced. This index starts at 0 and
shall be less than the number of children.new_node - A reference to the node that replaces the old one.
NullPointerException - This exception is raised when the reference
to the new node is null. This exception may be overriden by a
UnsupportedOperationException.
IndexOutOfBoundsException - This exception is raised when the passed
index is less than zero or greater or equal to the current
number of children.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested replace for any
reason. In addition if the old_node is not retreived in the
current children list, this exception is also raised.public static String toXML(String str)
str - the string to format
public void removeChild(int index)
throws IndexOutOfBoundsException,
UnsupportedOperationException
This operation takes into account the removal by updating the sibling associations of the children nodes prior and next to the removed one. The indicies of the nodes next to the removed one are decresed of one. Their parents as well as their contents are left unchanged.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the removed node and the source is the current node.The called operation is the nodesRemoved() of the listeners.
removeChild in interface DrbNoderemoveChild in class DrbAbstractNodeindex - Index of the child to be removed.
IndexOutOfBoundsException - This exception is raised when the passed
index is less than zero or greater or equal to the current
number of children.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested removal for any
reason.
public DrbNode insertChild(DrbNode new_node,
int index)
throws NullPointerException,
UnsupportedOperationException,
IndexOutOfBoundsException
If the node has been inserted within the children list, the next sibling indicies are increased of one. In addition the assiociations between the inserted node and it previous and next siblings are updated (if any).
Warning: The inserted node may be duplicated or re-instanciated according to the targetted implementation. A reference to the effectively inserted node is returned by the operation. It is highly recommended to discard the reference to the input node if not mandatory and to reference the returned node.
Important note: The implementation of the node is not supposed to accept any kind of node For instance it may not be possible to insert a node wrapping a file in an XML document. The documentation of the implementation shall describe its specific strategy.
Case of unordered or specifically ordered implementations: If the implementation does not support ordered children or has specific ordering rules, the node is inserted without taking into account the requested index passed in parameter. For instance it may not be possible to impose the file order in a directory: it generally depends on the lexicographical order of the node names or their creation date.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the inserted node and the source is the current node. The called operation is the nodesInserted() of the listeners.
insertChild in interface DrbNodeinsertChild in class DrbAbstractNodenew_node - A reference to the node to be inserted.index - The expected index of the node after the insertion.
NullPointerException - This exception is raised when the passed node
a null reference. This exception may be overriden by an
UnsupportedOperationException.
IndexOutOfBoundsException - This exception is raised when the passe
index is less than zero or if it is greater or equal to the
number of children in the number of children prior the call
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested insertion for any
reason (e.g. impossible in this current specific case or in
general).
public DrbNode appendChild(DrbNode nodes)
throws NullPointerException,
UnsupportedOperationException
Warning: The appended node may be duplicated or re-instanciated according to the targetted implementation. A reference to the effectively appended node is returned by the operation. It is highly recommended to discard the reference to the input node if not mandatory and to reference the returned node.
Important note: The implementation of the node is not supposed to accept any kind of node For instance it may not be possible to append a node wrapping a file in an XML document. The documentation of the implementation shall describe its specific strategy.
Case of unordered or specifically ordered implementations: If the implementation does not support ordered children or has specific ordering rules, the node may not be appended but only inserted according to these rules. For instance it may not be possible to impose the file order in a directory: it generally depends on the lexicographical order of the node names or their creation date.
Events: This operation fires a node change event when the implementation is a node change producer. The node affected by the change is the appended node and the source is the current node. The called operation is the nodesInserted() of the listeners.
appendChild in interface DrbNodeappendChild in class DrbAbstractNodenodes - A reference to the node to be appended.
NullPointerException - This exception is raised when the passed node
a null reference.This exception may be overriden by an
UnsupportedOperationException.
UnsupportedOperationException - This exception is raised when the
implementation does not support the requested append for any
reason (e.g. impossible in this current specific case or in
general).
|
Data Request Broker - DRB API® 2-3-release |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||