| java.lang.Object org.apache.lenya.xml.DocumentHelper
DocumentHelper | public class DocumentHelper (Code) | | Various utility methods to work with JAXP.
version: $Id: DocumentHelper.java 510066 2007-02-21 15:55:43Z andreas $ |
Method Summary | |
public static DocumentBuilder | createBuilder() Creates a non-validating and namespace-aware DocumentBuilder. | public static Document | createDocument(String namespaceUri, String qualifiedName, DocumentType documentType) Creates a document. | public DocumentType | createDocumentType(String qualifiedName, String publicId, String systemId) Creates a document type.
Parameters: qualifiedName - The qualified name of the document type. Parameters: publicId - The public identifier. Parameters: systemId - The system identifier. | public static Element[] | getChildren(Element element) Returns all child elements of an element, regardless of the namespace.
Parameters: element - The parent element. | public static Element[] | getChildren(Element element, String namespaceUri) Returns all child elements of an element that belong to a certain
namespace.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. | public static Element[] | getChildren(Element element, String namespaceUri, String localName) Returns all child elements of an element that belong to a certain
namespace and have a certain local name.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. Parameters: localName - The local name of the children. | public static Element | getFirstChild(Element element, String namespaceUri) Returns the first child element of an element that belong to a certain
namespace or null if none exists.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. | public static Element | getFirstChild(Element element, String namespaceUri, String localName) Returns the first child element of an element that belongs to a certain
namespace and has a certain local name or null if none
exists.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. Parameters: localName - The local name of the children. | public static Element[] | getNextSiblings(Element element, String namespaceUri) Returns all following sibling elements of an element that belong to a
certain namespace.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. | public static Element[] | getNextSiblings(Element element, String namespaceUri, String localName) Returns all following sibling elements of an element that belong to a
certain namespace. | public static Element[] | getPrecedingSiblings(Element element, String namespaceUri) Returns all preceding sibling elements of an element that belong to a
certain namespace.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. | public static Element[] | getPrecedingSiblings(Element element, String namespaceUri, String localName) Returns all preceding sibling elements of an element that belong to a
certain namespace. | public static String | getSimpleElementText(Element element) Returns the text inside an element. | protected static Transformer | getTransformer(DocumentType documentType) Get the transformer. | public static Document | readDocument(File file) Reads a document from a file. | public static Document | readDocument(URL url) Reads a document from a URL. | public static Document | readDocument(URI uri) Reads a document from a URI. | public static Document | readDocument(String string, String encoding) Reads a document from a string. | public static Document | readDocument(InputStream stream) Reads a document from an input stream. | public static void | setSimpleElementText(Element element, String text) Replaces all child nodes of an element by a single text node. | public static void | writeDocument(Document document, File file) Writes a document to a file. | public static void | writeDocument(Document document, Writer writer) Writes a document to a writer. | public static void | writeDocument(Document document, OutputStream outputStream) Writes a document to an output stream. |
getChildren | public static Element[] getChildren(Element element)(Code) | | Returns all child elements of an element, regardless of the namespace.
Parameters: element - The parent element. The child elements. |
getChildren | public static Element[] getChildren(Element element, String namespaceUri)(Code) | | Returns all child elements of an element that belong to a certain
namespace.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. The child elements. |
getChildren | public static Element[] getChildren(Element element, String namespaceUri, String localName)(Code) | | Returns all child elements of an element that belong to a certain
namespace and have a certain local name.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. Parameters: localName - The local name of the children. The child elements. |
getFirstChild | public static Element getFirstChild(Element element, String namespaceUri)(Code) | | Returns the first child element of an element that belong to a certain
namespace or null if none exists.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. The first child element or null if none exists. |
getFirstChild | public static Element getFirstChild(Element element, String namespaceUri, String localName)(Code) | | Returns the first child element of an element that belongs to a certain
namespace and has a certain local name or null if none
exists.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. Parameters: localName - The local name of the children. The child element or null if none exists. |
getNextSiblings | public static Element[] getNextSiblings(Element element, String namespaceUri)(Code) | | Returns all following sibling elements of an element that belong to a
certain namespace.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. The following sibling elements. |
getNextSiblings | public static Element[] getNextSiblings(Element element, String namespaceUri, String localName)(Code) | | Returns all following sibling elements of an element that belong to a
certain namespace. and have a certain local name.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. Parameters: localName - The local name of the children. The following sibling elements. |
getPrecedingSiblings | public static Element[] getPrecedingSiblings(Element element, String namespaceUri)(Code) | | Returns all preceding sibling elements of an element that belong to a
certain namespace.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. The preceding sibling elements. |
getPrecedingSiblings | public static Element[] getPrecedingSiblings(Element element, String namespaceUri, String localName)(Code) | | Returns all preceding sibling elements of an element that belong to a
certain namespace. and have a certain local name.
Parameters: element - The parent element. Parameters: namespaceUri - The namespace that the childen must belong to. Parameters: localName - The local name of the children. The preceding sibling elements. |
getSimpleElementText | public static String getSimpleElementText(Element element)(Code) | | Returns the text inside an element. Only the child text nodes of this
element are collected.
Parameters: element - The element. The text inside the element. |
setSimpleElementText | public static void setSimpleElementText(Element element, String text)(Code) | | Replaces all child nodes of an element by a single text node.
Parameters: element - The element. Parameters: text - The text to insert. |
|
|