|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--uk.co.demon.ursus.dom.PMRDelegate
re-usable routines to support PMR* interfaces
| Constructor Summary | |
PMRDelegate()
|
|
| Method Summary | |
static void |
addAttributes(org.w3c.dom.Element element,
org.xml.sax.AttributeList attributeList)
|
static void |
copyAttributesFrom(org.w3c.dom.Element toElement,
org.w3c.dom.Element fromElement)
|
static org.w3c.dom.Node |
copyNode(org.w3c.dom.Document toDocument,
org.w3c.dom.Node fromNode,
boolean deep)
make a copy of the Node in a different document context. |
static void |
debug(org.w3c.dom.Node node)
|
static void |
deleteWhitespaceDecsendants(org.w3c.dom.Document document)
recursively removes all whitespace nodes |
static void |
deleteWhitespaceDescendants(org.w3c.dom.Element element)
recursively deletes all whitespace descendants |
static java.util.Enumeration |
depthFirstEnumeration(org.w3c.dom.Element element)
|
static java.util.Enumeration |
depthFirstEnumeration(org.w3c.dom.Node node)
iterate through whole tree |
static org.w3c.dom.Element |
getAncestor(org.w3c.dom.Element element,
java.lang.String tagName)
gets first ancestor of 'element' with tagName; [element is not its own ancestor] |
static java.util.Vector |
getAncestors(org.w3c.dom.Element element)
gets all ancestors of 'element' including the document Element but not Document. |
static org.w3c.dom.Element |
getAncestorWithClass(org.w3c.dom.Element element,
java.lang.Class theClass)
gets first ancestor of 'element' of given class (or superclass) [element is not its ancestor] |
static java.lang.String |
getAttributeString(org.w3c.dom.Attr att)
returns a string representing a single attribute in a start tag, e.g. |
static java.lang.String |
getAttributeString(org.w3c.dom.Element element)
returns the attributes in concatenated text form (suitable for insertion to start tags). |
static java.util.Vector |
getChild(org.w3c.dom.Element element,
java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue)
get children with combination of tagNames, attribute names and values. |
static org.w3c.dom.Element |
getChildElement(org.w3c.dom.Element element,
int index)
get the index'th Element child. |
static java.util.Hashtable |
getChildElementNameTable(org.w3c.dom.Element parentElement)
make a list of all child element names and the instances of each. |
static java.util.Vector |
getChildElements(org.w3c.dom.Element element)
get all Element children. |
static java.util.Vector |
getChildrenWithElementName(org.w3c.dom.Element element,
java.lang.String name)
gets vector of XNode children with given element name (ignored if name is null or bad value of sensitivity). |
static java.util.Vector |
getDescendants(org.w3c.dom.Element element,
int level,
java.lang.String tagName)
gets all children at given level. |
static java.util.Vector |
getDescendantsWithClass(org.w3c.dom.Node node,
java.lang.Class theClass)
gets descendants of 'element' of given class (or superclass) [element is not its descendant]. |
static org.w3c.dom.Element |
getFirstChildWithElementName(org.w3c.dom.Element element,
java.lang.String name)
gets first child with given element name (ignored if name is null). |
static org.w3c.dom.Text |
getPCDATAChildNode(org.w3c.dom.Element element)
if this has a single PCDATA child, returns it, else null |
static java.lang.String |
getPCDATAContent(org.w3c.dom.Element element)
if this has a single PCDATA child, returns its string value, else null |
static java.lang.String |
getValue(org.w3c.dom.Element element)
returns value of first child if this is Text else "" |
static boolean |
isEmptyAttribute(java.lang.String attributeValue)
UTILITIES |
static void |
outputChildContent(org.w3c.dom.Element element,
java.io.Writer w,
int type,
int level)
subclassed by specialist classes |
static void |
outputEndElement(org.w3c.dom.Element element,
java.io.Writer w,
int level)
for building the tree. |
static void |
outputEndTag(org.w3c.dom.Element element,
java.io.Writer w,
int type,
int level)
subclassed by specialist classes |
static java.lang.String |
outputEventStream(org.w3c.dom.Node node,
java.io.Writer w,
int type,
int level)
gets the event stream (as XML or text). |
static void |
outputHTML(org.w3c.dom.Element element,
java.io.Writer w)
output node as HTML - normally subclassed |
static void |
outputHTML(org.w3c.dom.Node node,
java.io.Writer w)
output node as HTML - normally subclassed |
static void |
outputStartElement(org.w3c.dom.Element element,
java.io.Writer w,
org.w3c.dom.Element parentNode,
int level)
for building the tree. |
static void |
outputStartTag(org.w3c.dom.Element element,
java.io.Writer w,
int type,
int level)
subclassed by specialist classes |
static java.util.Enumeration |
preorderEnumeration(org.w3c.dom.Element element)
iterate through whole tree. |
static java.util.Enumeration |
preorderEnumeration(org.w3c.dom.Node node)
iterate through whole tree. |
static void |
removeChildNodes(org.w3c.dom.Element element)
remove all child nodes |
static void |
removeNode(org.w3c.dom.Node node)
remove a node from its parent. |
void |
replace(org.w3c.dom.Element toElement,
org.w3c.dom.Element fromElement)
transfer children from fromElement to toElement; replace toElement by fromElement and copy attributes and children |
static void |
setPCDATAContent(org.w3c.dom.Element element,
java.lang.String s)
Sets a string to be the content of an existing single PCDATANode. |
static void |
testEdit(org.w3c.dom.Node node)
create a deep or shallow copy of an element, including correct classes; tag and owner document set to those from element. |
static void |
transfer(org.w3c.dom.Document toDocument,
org.w3c.dom.Document fromDocument)
transfers complete fromDocument, changing ownership and subsclassing |
static java.lang.String |
write(java.io.Writer w,
org.w3c.dom.Document document,
int type,
int level)
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public PMRDelegate()
| Method Detail |
public static void deleteWhitespaceDescendants(org.w3c.dom.Element element)
public static void removeNode(org.w3c.dom.Node node)
remove a node from its parent.
.public static void removeChildNodes(org.w3c.dom.Element element)
public void replace(org.w3c.dom.Element toElement,
org.w3c.dom.Element fromElement)
public static void transfer(org.w3c.dom.Document toDocument,
org.w3c.dom.Document fromDocument)
public static java.util.Enumeration depthFirstEnumeration(org.w3c.dom.Element element)
public static java.util.Enumeration preorderEnumeration(org.w3c.dom.Element element)
iterate through whole tree. Kludged to use dethFirst
.
public static void outputHTML(org.w3c.dom.Element element,
java.io.Writer w)
throws java.io.IOException
public static java.util.Vector getChildElements(org.w3c.dom.Element element)
public static java.util.Vector getDescendants(org.w3c.dom.Element element,
int level,
java.lang.String tagName)
public static org.w3c.dom.Element getChildElement(org.w3c.dom.Element element,
int index)
public static java.util.Hashtable getChildElementNameTable(org.w3c.dom.Element parentElement)
public static java.util.Vector getDescendantsWithClass(org.w3c.dom.Node node,
java.lang.Class theClass)
Element - element the element whose descendants are searchedClass - theClass class of element to find (includes subclasses)public static java.util.Vector getAncestors(org.w3c.dom.Element element)
Element - element to analyse
public static org.w3c.dom.Element getAncestor(org.w3c.dom.Element element,
java.lang.String tagName)
Element - element to analyseString - tagName the full element name
public static org.w3c.dom.Element getAncestorWithClass(org.w3c.dom.Element element,
java.lang.Class theClass)
public static java.lang.String getAttributeString(org.w3c.dom.Element element)
public static java.lang.String getAttributeString(org.w3c.dom.Attr att)
public static void addAttributes(org.w3c.dom.Element element,
org.xml.sax.AttributeList attributeList)
public static void copyAttributesFrom(org.w3c.dom.Element toElement,
org.w3c.dom.Element fromElement)
public static org.w3c.dom.Node copyNode(org.w3c.dom.Document toDocument,
org.w3c.dom.Node fromNode,
boolean deep)
public static java.util.Vector getChildrenWithElementName(org.w3c.dom.Element element,
java.lang.String name)
int - nameType LOCAL, QUALIFIED or UNIVERSALString - name the elementName (must match exactly other than case)int - sensitivity can take values CASE or IGNORECASE
public static org.w3c.dom.Element getFirstChildWithElementName(org.w3c.dom.Element element,
java.lang.String name)
String - name the elementNamepublic static java.lang.String getPCDATAContent(org.w3c.dom.Element element)
public static org.w3c.dom.Text getPCDATAChildNode(org.w3c.dom.Element element)
public static void setPCDATAContent(org.w3c.dom.Element element,
java.lang.String s)
String - s to be added to PCDATA content
public static java.lang.String write(java.io.Writer w,
org.w3c.dom.Document document,
int type,
int level)
throws java.io.IOException
public static java.lang.String outputEventStream(org.w3c.dom.Node node,
java.io.Writer w,
int type,
int level)
throws java.io.IOException
Writer - w outputs to this stream.int - type type chosen from list aboveint - level of indentation (normally set to 0 when called, and expanded
recursively internally);
public static void outputStartTag(org.w3c.dom.Element element,
java.io.Writer w,
int type,
int level)
throws java.io.IOException
public static void outputStartElement(org.w3c.dom.Element element,
java.io.Writer w,
org.w3c.dom.Element parentNode,
int level)
throws java.io.IOException
Element - parentNode the parentNode if not nullWriter - w if not null, output to writer rather than building tree
public static void outputChildContent(org.w3c.dom.Element element,
java.io.Writer w,
int type,
int level)
throws java.io.IOException
public static void outputEndTag(org.w3c.dom.Element element,
java.io.Writer w,
int type,
int level)
throws java.io.IOException
public static void outputEndElement(org.w3c.dom.Element element,
java.io.Writer w,
int level)
throws java.io.IOException
Writer - w if not null, output to writer rather than building treepublic static java.util.Enumeration depthFirstEnumeration(org.w3c.dom.Node node)
iterate through whole tree
.public static java.util.Enumeration preorderEnumeration(org.w3c.dom.Node node)
iterate through whole tree. Kludged to use dethFirst
.
public static void outputHTML(org.w3c.dom.Node node,
java.io.Writer w)
throws java.io.IOException
public static void deleteWhitespaceDecsendants(org.w3c.dom.Document document)
public static void debug(org.w3c.dom.Node node)
public static void testEdit(org.w3c.dom.Node node)
public static boolean isEmptyAttribute(java.lang.String attributeValue)
public static java.lang.String getValue(org.w3c.dom.Element element)
public static java.util.Vector getChild(org.w3c.dom.Element element,
java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||