| java.lang.Object org.apache.cocoon.forms.util.DomHelper
DomHelper | public class DomHelper (Code) | | Helper class to create and retrieve information from DOM-trees. It provides
some functionality comparable to what's found in Avalon's Configuration
objects. These lasts one could however not be used by Cocoon Forms because they
don't provide an accurate model of an XML file (no mixed content,
no namespaced attributes, no namespace declarations, ...).
This class depends specifically on the Xerces DOM implementation to be
able to provide information about the location of elements in their source
XML file. See the
DomHelper.getLocation(Element) method.
version: $Id: DomHelper.java 449149 2006-09-23 03:58:05Z crossley $ |
Method Summary | |
public static XMLizable | compileElementContent(Element element) Returns the content of the given Element as an object implementing the
XMLizable interface. | public static String | getAttribute(Element element, String attributeName) Returns the value of an element's attribute, but throws an exception
if the element has no such attribute. | public static String | getAttribute(Element element, String attributeName, String defaultValue) Returns the value of an element's attribute, or a default value if the
element has no such attribute. | public static boolean | getAttributeAsBoolean(Element element, String attributeName, boolean defaultValue) | public static int | getAttributeAsInteger(Element element, String attributeName) | public static int | getAttributeAsInteger(Element element, String attributeName, int defaultValue) | public static Element | getChildElement(Element element, String namespace, String localName) Returns the first child element with the given namespace and localName,
or null if there is no such element. | public static Element | getChildElement(Element element, String namespace, String localName, boolean required) Returns the first child element with the given namespace and localName,
or null if there is no such element and required flag is unset or
throws an Exception if the "required" flag is set. | public static Element[] | getChildElements(Element element, String namespace) Returns all Element children of an Element that belong to the given
namespace. | public static Element[] | getChildElements(Element element, String namespace, String localName) Returns all Element children of an Element that belong to the given
namespace and have the given local name. | public static int | getColumnLocation(Element element) | public static String | getElementText(Element element) | public static Map | getInheritedNSDeclarations(Element elm) | public static int | getLineLocation(Element element) | public static Map | getLocalNSDeclarations(Element elm) | public static String | getLocation(Element element) Retrieves the location of an element node in the source file from which
the Document was created. | public static Location | getLocationObject(Element element) | public static String | getSystemIdLocation(Element element) | public static Document | parse(InputSource inputSource, ServiceManager manager) Creates a W3C Document that remembers the location of each element in
the source file. |
compileElementContent | public static XMLizable compileElementContent(Element element)(Code) | | Returns the content of the given Element as an object implementing the
XMLizable interface. Practically speaking, the implementation uses the
SaxBuffer class. The XMLizable object will be a standalone blurb
of SAX events, not producing start/endDocument calls and containing all
necessary namespace declarations.
|
getAttribute | public static String getAttribute(Element element, String attributeName) throws FormsException(Code) | | Returns the value of an element's attribute, but throws an exception
if the element has no such attribute.
|
getAttribute | public static String getAttribute(Element element, String attributeName, String defaultValue)(Code) | | Returns the value of an element's attribute, or a default value if the
element has no such attribute.
|
getAttributeAsBoolean | public static boolean getAttributeAsBoolean(Element element, String attributeName, boolean defaultValue)(Code) | | |
getChildElement | public static Element getChildElement(Element element, String namespace, String localName)(Code) | | Returns the first child element with the given namespace and localName,
or null if there is no such element.
|
getChildElement | public static Element getChildElement(Element element, String namespace, String localName, boolean required) throws FormsException(Code) | | Returns the first child element with the given namespace and localName,
or null if there is no such element and required flag is unset or
throws an Exception if the "required" flag is set.
|
getChildElements | public static Element[] getChildElements(Element element, String namespace)(Code) | | Returns all Element children of an Element that belong to the given
namespace.
|
getChildElements | public static Element[] getChildElements(Element element, String namespace, String localName)(Code) | | Returns all Element children of an Element that belong to the given
namespace and have the given local name.
|
getColumnLocation | public static int getColumnLocation(Element element)(Code) | | |
getInheritedNSDeclarations | public static Map getInheritedNSDeclarations(Element elm)(Code) | | |
getLineLocation | public static int getLineLocation(Element element)(Code) | | |
getLocalNSDeclarations | public static Map getLocalNSDeclarations(Element elm)(Code) | | |
|
|