|
|||||||||
| Home >> All >> org >> jdaemon >> util >> data >> [ xml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.jdaemon.util.data.xml
Class XMLDataRepresentation

java.lang.Objectorg.jdaemon.util.data.xml.XMLDataRepresentation
- All Implemented Interfaces:
- org.jdaemon.util.data.DataRepresentation
- public class XMLDataRepresentation
- extends java.lang.Object
- implements org.jdaemon.util.data.DataRepresentation
- extends java.lang.Object
XMLDataRepresentation provides simplified access to data held in an XML file. A XMLDataRepresentation object represents an XML element
- Version:
| Field Summary | |
private org.w3c.dom.Element |
element
element represented by this node |
private java.util.Map |
index
index for child elements |
| Constructor Summary | |
|
XMLDataRepresentation()
Create a new XML Data Representation with a new underlying XML document |
|
XMLDataRepresentation(org.w3c.dom.Document document)
Creates a new XMLDataRepresentation object from an DOM document |
|
XMLDataRepresentation(org.w3c.dom.Document document,
org.jdaemon.util.data.DataRepresentation data)
Create a new XML Data Representation from some other data representation |
protected |
XMLDataRepresentation(org.w3c.dom.Document document,
java.lang.String type,
java.lang.Object key)
Creates a new XMLDataRepresentation object representing an new element in the given document |
|
XMLDataRepresentation(org.w3c.dom.Element element)
Creates new XMLDataRepresentation from an XML element. |
|
XMLDataRepresentation(java.io.InputStream stream)
Creates a new XMLDataRepresentation object from an XML-formatted input stream |
| Method Summary | |
private void |
_setAttribute(org.w3c.dom.Document document,
java.lang.Object key,
java.lang.String value)
Set an attribute in the underlying XML element |
java.lang.Object |
clone()
Create a deep copy of this XML data representation |
private static org.w3c.dom.Document |
createDocument(java.io.InputStream stream)
Create document from input stream |
private static org.w3c.dom.Document |
createEmptyDocument()
Create an empty XML document |
private static java.util.Map |
createIndex(org.jdaemon.util.xml.ElementIterator elements)
Create index of child elements |
java.lang.String |
getAttribute(java.lang.Object key)
Return an attribute of this DataRepresentation |
java.util.Iterator |
getAttributeKeys()
Return all the valid attribute keys within this DataRepresentation |
org.w3c.dom.Document |
getDocument()
Get the document which contains this DataRepresentation. |
org.jdaemon.util.data.DataRepresentation |
getElement(java.lang.Object key)
Return a sub-collection of this DataRepresentation |
java.util.Iterator |
getElementKeys()
Return all the valid element keys within this representation |
java.lang.String |
getElementType()
Return the type of this DataRepresentation returns the tag name of the underlying element |
boolean |
isFragment()
check if this XMLDataRepresentation is a Fragment (i.e. |
org.jdaemon.util.data.DataRepresentation |
newElement(java.lang.String type)
Create a new, empty element (not a member of this or any parent representation) |
void |
setAttribute(java.lang.Object key,
java.lang.String value)
Set an attriubute of this representation |
void |
setElement(java.lang.Object key,
org.jdaemon.util.data.DataRepresentation child)
Add an element to this representation with the given key. |
void |
setElement(java.lang.Object key,
XMLDataRepresentation child)
Add an element to this representation with the given key |
void |
setElementType(java.lang.String type)
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
index
private java.util.Map index
- index for child elements
element
private org.w3c.dom.Element element
- element represented by this node
| Constructor Detail |
XMLDataRepresentation
public XMLDataRepresentation(org.w3c.dom.Element element)
- Creates new XMLDataRepresentation from an XML element.
XMLDataRepresentation
public XMLDataRepresentation(org.w3c.dom.Document document, org.jdaemon.util.data.DataRepresentation data) throws org.jdaemon.util.data.ReadError, org.jdaemon.util.data.WriteError
- Create a new XML Data Representation from some other data representation
XMLDataRepresentation
public XMLDataRepresentation()
- Create a new XML Data Representation with a new underlying XML document
XMLDataRepresentation
public XMLDataRepresentation(org.w3c.dom.Document document)
- Creates a new XMLDataRepresentation object from an DOM document
XMLDataRepresentation
protected XMLDataRepresentation(org.w3c.dom.Document document, java.lang.String type, java.lang.Object key)
- Creates a new XMLDataRepresentation object representing an new element in the given document
XMLDataRepresentation
public XMLDataRepresentation(java.io.InputStream stream) throws org.jdaemon.util.data.ReadError
- Creates a new XMLDataRepresentation object from an XML-formatted input stream
| Method Detail |
createIndex
private static java.util.Map createIndex(org.jdaemon.util.xml.ElementIterator elements)
- Create index of child elements
createDocument
private static org.w3c.dom.Document createDocument(java.io.InputStream stream) throws org.jdaemon.util.data.ReadError
- Create document from input stream
_setAttribute
private void _setAttribute(org.w3c.dom.Document document, java.lang.Object key, java.lang.String value)
- Set an attribute in the underlying XML element
createEmptyDocument
private static org.w3c.dom.Document createEmptyDocument()
- Create an empty XML document
getDocument
public org.w3c.dom.Document getDocument()
- Get the document which contains this DataRepresentation.
getElement
public org.jdaemon.util.data.DataRepresentation getElement(java.lang.Object key)
- Return a sub-collection of this DataRepresentation
- Specified by:
getElementin interfaceorg.jdaemon.util.data.DataRepresentation
getElementType
public java.lang.String getElementType()
- Return the type of this DataRepresentation
returns the tag name of the underlying element
- Specified by:
getElementTypein interfaceorg.jdaemon.util.data.DataRepresentation
setElementType
public void setElementType(java.lang.String type)
getAttribute
public java.lang.String getAttribute(java.lang.Object key) throws org.jdaemon.util.data.ReadError
- Return an attribute of this DataRepresentation
- Specified by:
getAttributein interfaceorg.jdaemon.util.data.DataRepresentation
getAttributeKeys
public java.util.Iterator getAttributeKeys() throws org.jdaemon.util.data.ReadError
- Return all the valid attribute keys within this DataRepresentation
- Specified by:
getAttributeKeysin interfaceorg.jdaemon.util.data.DataRepresentation
getElementKeys
public java.util.Iterator getElementKeys() throws org.jdaemon.util.data.ReadError
- Return all the valid element keys within this representation
- Specified by:
getElementKeysin interfaceorg.jdaemon.util.data.DataRepresentation
isFragment
public boolean isFragment()
- check if this XMLDataRepresentation is a Fragment (i.e. has no parent node in the XML document)
clone
public java.lang.Object clone()
- Create a deep copy of this XML data representation
setElement
public void setElement(java.lang.Object key, XMLDataRepresentation child)
- Add an element to this representation with the given key
setElement
public void setElement(java.lang.Object key, org.jdaemon.util.data.DataRepresentation child) throws org.jdaemon.util.data.ReadError, org.jdaemon.util.data.WriteError
- Description copied from interface:
org.jdaemon.util.data.DataRepresentation - Add an element to this representation with the given key.
Creates a new child DataRepresentation with the given key and copies data from the given 'other' representation into it. If an element already exists, with the given key the entire old element is first deleted.
Note that we exlicity allow the given 'other' DataRepresentation to be a different class to this DataRepresentation. For example, it should be possible to use this method to copy data from an XML file to a JNDI directory.
- Specified by:
setElementin interfaceorg.jdaemon.util.data.DataRepresentation
setAttribute
public void setAttribute(java.lang.Object key, java.lang.String value) throws org.jdaemon.util.data.WriteError
- Set an attriubute of this representation
- Specified by:
setAttributein interfaceorg.jdaemon.util.data.DataRepresentation
newElement
public org.jdaemon.util.data.DataRepresentation newElement(java.lang.String type)
- Create a new, empty element (not a member of this or any parent representation)
- Specified by:
newElementin interfaceorg.jdaemon.util.data.DataRepresentation
|
|||||||||
| Home >> All >> org >> jdaemon >> util >> data >> [ xml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.jdaemon.util.data.xml.XMLDataRepresentation