net.sf.webmancer.util.xml.dom
Class DOMUtils

java.lang.Object
  extended by net.sf.webmancer.util.xml.dom.DOMUtils

public class DOMUtils
extends java.lang.Object

Author:
michal

Method Summary
static void addAttributes(org.w3c.dom.Element parent, java.util.Map<java.lang.String,java.lang.String> attributes)
           
static void expect(boolean what, java.lang.String message)
           
static org.w3c.dom.Attr expectAttribute(org.w3c.dom.Element element, javax.xml.namespace.QName attributeQName)
           
static double expectDoubleAttributeValue(org.w3c.dom.Element element, javax.xml.namespace.QName attributeQName)
           
static double expectDoubleElementValue(org.w3c.dom.Element element)
           
static float expectFloatAttributeValue(org.w3c.dom.Element element, javax.xml.namespace.QName attributeQName)
           
static float expectFloatElementValue(org.w3c.dom.Element element)
           
static org.w3c.dom.NodeList expectChildElements(org.w3c.dom.Element element, javax.xml.namespace.QName childQName)
           
static int expectIntAttributeValue(org.w3c.dom.Element element, javax.xml.namespace.QName attributeQName)
           
static int expectIntElementValue(org.w3c.dom.Element element)
           
static long expectLongAttributeValue(org.w3c.dom.Element element, javax.xml.namespace.QName attributeQName)
           
static long expectLongElementValue(org.w3c.dom.Element element)
           
static void expectQName(org.w3c.dom.Element element, javax.xml.namespace.QName qName)
           
static org.w3c.dom.Element expectUniqueChildElement(org.w3c.dom.Element element, javax.xml.namespace.QName childQName)
           
static java.lang.String expectUniqueChildElementNonEmptyTextContent(org.w3c.dom.Element element, javax.xml.namespace.QName childQName)
           
static java.lang.String expectUniqueChildElementTextContent(org.w3c.dom.Element element, javax.xml.namespace.QName childQName)
           
static javax.xml.namespace.QName getQName(org.w3c.dom.Element element)
           
static org.w3c.dom.Attr tryAttribute(org.w3c.dom.Element element, javax.xml.namespace.QName attributeQName)
           
static org.w3c.dom.NodeList tryChildElements(org.w3c.dom.Element element, javax.xml.namespace.QName childQName)
           
static boolean tryQName(org.w3c.dom.Element element, javax.xml.namespace.QName qName)
           
static org.w3c.dom.Element tryUniqueChildElement(org.w3c.dom.Element element, javax.xml.namespace.QName childQName)
           
static java.lang.String tryUniqueChildElementNonEmptyTextContent(org.w3c.dom.Element element, javax.xml.namespace.QName childQName)
           
static java.lang.String tryUniqueChildElementTextContent(org.w3c.dom.Element element, javax.xml.namespace.QName childQName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

expect

public static void expect(boolean what,
                          java.lang.String message)
                   throws DOMSemanticException
Parameters:
what -
message -
Throws:
DOMSemanticException

getQName

public static javax.xml.namespace.QName getQName(org.w3c.dom.Element element)
Parameters:
element -
Returns:

tryQName

public static boolean tryQName(org.w3c.dom.Element element,
                               javax.xml.namespace.QName qName)
Parameters:
element -
qName -
Returns:

expectQName

public static void expectQName(org.w3c.dom.Element element,
                               javax.xml.namespace.QName qName)
                        throws DOMSemanticException
Parameters:
element -
qName -
Throws:
DOMSemanticException

tryChildElements

public static org.w3c.dom.NodeList tryChildElements(org.w3c.dom.Element element,
                                                    javax.xml.namespace.QName childQName)
Parameters:
element -
childQName -
Returns:

expectChildElements

public static org.w3c.dom.NodeList expectChildElements(org.w3c.dom.Element element,
                                                       javax.xml.namespace.QName childQName)
                                                throws DOMSemanticException
Parameters:
element -
childQName -
Returns:
Throws:
DOMSemanticException

tryUniqueChildElement

public static org.w3c.dom.Element tryUniqueChildElement(org.w3c.dom.Element element,
                                                        javax.xml.namespace.QName childQName)
                                                 throws DOMSemanticException
Parameters:
element -
childQName -
Returns:
Throws:
DOMSemanticException

expectUniqueChildElement

public static org.w3c.dom.Element expectUniqueChildElement(org.w3c.dom.Element element,
                                                           javax.xml.namespace.QName childQName)
                                                    throws DOMSemanticException
Parameters:
element -
childQName -
Returns:
Throws:
DOMSemanticException

tryUniqueChildElementTextContent

public static java.lang.String tryUniqueChildElementTextContent(org.w3c.dom.Element element,
                                                                javax.xml.namespace.QName childQName)
                                                         throws DOMSemanticException
Parameters:
element -
childQName -
Returns:
Throws:
DOMSemanticException

expectUniqueChildElementTextContent

public static java.lang.String expectUniqueChildElementTextContent(org.w3c.dom.Element element,
                                                                   javax.xml.namespace.QName childQName)
                                                            throws DOMSemanticException
Parameters:
element -
childQName -
Returns:
Throws:
DOMSemanticException

tryUniqueChildElementNonEmptyTextContent

public static java.lang.String tryUniqueChildElementNonEmptyTextContent(org.w3c.dom.Element element,
                                                                        javax.xml.namespace.QName childQName)
                                                                 throws DOMSemanticException
Parameters:
element -
childQName -
Returns:
Throws:
DOMSemanticException

expectUniqueChildElementNonEmptyTextContent

public static java.lang.String expectUniqueChildElementNonEmptyTextContent(org.w3c.dom.Element element,
                                                                           javax.xml.namespace.QName childQName)
                                                                    throws DOMSemanticException
Parameters:
element -
childQName -
Returns:
Throws:
DOMSemanticException

tryAttribute

public static org.w3c.dom.Attr tryAttribute(org.w3c.dom.Element element,
                                            javax.xml.namespace.QName attributeQName)
Parameters:
element -
attributeQName -
Returns:

expectAttribute

public static org.w3c.dom.Attr expectAttribute(org.w3c.dom.Element element,
                                               javax.xml.namespace.QName attributeQName)
                                        throws DOMSemanticException
Parameters:
element -
attributeQName -
Returns:
Throws:
DOMSemanticException

expectIntAttributeValue

public static int expectIntAttributeValue(org.w3c.dom.Element element,
                                          javax.xml.namespace.QName attributeQName)
                                   throws DOMSemanticException
Parameters:
element -
attributeQName -
Returns:
Throws:
DOMSemanticException

expectLongAttributeValue

public static long expectLongAttributeValue(org.w3c.dom.Element element,
                                            javax.xml.namespace.QName attributeQName)
                                     throws DOMSemanticException
Parameters:
element -
attributeQName -
Returns:
Throws:
DOMSemanticException

expectFloatAttributeValue

public static float expectFloatAttributeValue(org.w3c.dom.Element element,
                                              javax.xml.namespace.QName attributeQName)
                                       throws DOMSemanticException
Parameters:
element -
attributeQName -
Returns:
Throws:
DOMSemanticException

expectDoubleAttributeValue

public static double expectDoubleAttributeValue(org.w3c.dom.Element element,
                                                javax.xml.namespace.QName attributeQName)
                                         throws DOMSemanticException
Parameters:
element -
attributeQName -
Returns:
Throws:
DOMSemanticException

expectIntElementValue

public static int expectIntElementValue(org.w3c.dom.Element element)
                                 throws DOMSemanticException
Parameters:
element -
Returns:
Throws:
DOMSemanticException

expectLongElementValue

public static long expectLongElementValue(org.w3c.dom.Element element)
                                   throws DOMSemanticException
Parameters:
element -
Returns:
Throws:
DOMSemanticException

expectFloatElementValue

public static float expectFloatElementValue(org.w3c.dom.Element element)
                                     throws DOMSemanticException
Parameters:
element -
Returns:
Throws:
DOMSemanticException

expectDoubleElementValue

public static double expectDoubleElementValue(org.w3c.dom.Element element)
                                       throws DOMSemanticException
Parameters:
element -
Returns:
Throws:
DOMSemanticException

addAttributes

public static void addAttributes(org.w3c.dom.Element parent,
                                 java.util.Map<java.lang.String,java.lang.String> attributes)
Parameters:
parent -
attributes -


Copyright © 2006-2007. All Rights Reserved.