net.jxta.document
Class StructuredDocumentUtils
java.lang.Object
|
+--net.jxta.document.StructuredDocumentUtils
- public final class StructuredDocumentUtils
- extends java.lang.Object
Provides a number of static utility members which are helpful in
manipluating StructuredDocuments.
- Since:
- JXTA 1.0
- Version:
- $Revision: 1.10 $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StructuredDocumentUtils
public StructuredDocumentUtils()
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,
java.lang.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 given element or document into a standalone document of
same encoding, using the element's name as the document type and
recursively copying all elements textValues and children to the new
document.
The copy of the given element is the root of the new document.
- Parameters:
from - the root element from which to begin copying.- Returns:
- StructuredDocument the copy