Project JXTA

net.jxta.document
Class StructuredDocumentUtils

java.lang.Object
  extended bynet.jxta.document.StructuredDocumentUtils

public final class StructuredDocumentUtils
extends Object

Provides a number of static utility members which are helpful in manipluating StructuredDocuments.


Method Summary
static StructuredDocument copyAsDocument(Element from)
          Copies the specified element or document into a standalone document of same type.
static void copyChildren(StructuredDocument intoDoc, Element intoElement, Element from)
          Recursively copy children elements of from into the the element intoElement of document intoDoc.
static void copyElements(StructuredDocument intoDoc, Element intoElement, Element from)
          Recursively copy elements beginnging with from into the document identified by intoDoc.
static void copyElements(StructuredDocument intoDoc, Element intoElement, Element from, Object newName)
          Recursively copy elements beginnging with from into the document identified by intoDoc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyChildren

public static void copyChildren(StructuredDocument intoDoc,
                                Element intoElement,
                                Element from)
Recursively copy children elements of from into the the element intoElement of document intoDoc.

BEWARE that this does NOT copy the TEXTVALUE (if any) of the fromParent element, ONLY CHILDREN. All other elements are fully copied, including their textValue.

It is not possible to copy a textValue in an existing element.

Parameters:
intoDoc - the document into which the elements will be copied.
intoElement - the element which will serve as the parent for the elements being copied.
from - the parent element of the elements which will be copied.

copyElements

public static void copyElements(StructuredDocument intoDoc,
                                Element intoElement,
                                Element from,
                                Object newName)
Recursively copy elements beginnging with from into the document identified by intoDoc.

Parameters:
intoDoc - the document into which the elements which will be copied.
intoElement - the element which will serve as the parent for the elements being copied.
from - the root element of the hierarchy which will be copied.
newName - the root element being copied is renamed newName.

copyElements

public static void copyElements(StructuredDocument intoDoc,
                                Element intoElement,
                                Element from)
Recursively copy elements beginnging with from into the document identified by intoDoc.

Parameters:
intoDoc - the document into which the elements which will be copied.
intoElement - the element which will serve as the parent for the elements being copied.
from - the root element of the hierarchy which will be copied.

copyAsDocument

public static StructuredDocument copyAsDocument(Element from)
Copies the specified element or document into a standalone document of same type. The from
Parameters:
from - the root element from which to begin copying.
Returns:
StructuredDocument the copy

JXTA J2SE