ariba.ui.widgets
Class XMLUtil

java.lang.Object
  extended by ariba.ui.widgets.XMLUtil

public final class XMLUtil
extends java.lang.Object


Nested Class Summary
static class XMLUtil.DefaultResolver
           
static class XMLUtil.FieldValue_XMLNode
           
static interface XMLUtil.Resolver
          This interface is used by demoshell to do lookups on elements that specify references to nodes in other files.
 
Field Summary
static XMLUtil.DefaultResolver defaultResolver
           
 
Constructor Summary
XMLUtil()
           
 
Method Summary
static org.w3c.dom.Document document(org.xml.sax.InputSource content, boolean validate, boolean removeWhitespace, org.xml.sax.EntityResolver resolver)
          Creates a Document object based on the given URL
static org.w3c.dom.Document document(java.lang.String content, boolean validate, boolean removeWhitespace, org.xml.sax.EntityResolver resolver)
          Creates a Document object based on the given URL
static org.w3c.dom.Document document(java.net.URL url, boolean validate, boolean removeWhitespace, org.xml.sax.EntityResolver resolver)
           
static org.w3c.dom.Element expectElement(org.w3c.dom.Node node)
           
static void expectTag(org.w3c.dom.Element elem, java.lang.String tag)
          Raise an exception if the current element is not the expected tag - namespaces are not supported.
static org.w3c.dom.Element[] getAllChildren(org.w3c.dom.Element parent, java.lang.String tag)
          Return an array of all the children of PARENT that are TAG elements.
static javax.xml.parsers.DocumentBuilder getDOMParser(boolean validating)
           
static javax.xml.parsers.DocumentBuilder getDOMParser(boolean validating, boolean enableDeferNodeExpantion, boolean enableContinueAfterFatalError)
           
static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Element parent)
          Returns first child element of the specified parent element.
static org.w3c.dom.Element getOneChildMaybe(org.w3c.dom.Element parent, java.lang.String tag)
           
static java.lang.String getText(org.w3c.dom.Element parent, java.lang.String theDefault)
           
static boolean isElement(org.w3c.dom.Node e)
           
static void registerXMLNodeFieldValueClassExtension()
           
static org.w3c.dom.Element resolveReferences(org.w3c.dom.Element e)
           
static org.w3c.dom.Element[] resolveReferences(org.w3c.dom.Element[] e)
           
static void serializeDocument(org.w3c.dom.Document doc, java.io.OutputStream output)
          Serialize an XML Document using a stream.
static void setResolver(XMLUtil.Resolver r)
           
static java.lang.String stringAttribute(org.w3c.dom.Element element, java.lang.String attrName, java.lang.String theDefault)
          Assume ELEMENT had attribute ATTRNAME, get its value and return it as a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultResolver

public static final XMLUtil.DefaultResolver defaultResolver
Constructor Detail

XMLUtil

public XMLUtil()
Method Detail

registerXMLNodeFieldValueClassExtension

public static void registerXMLNodeFieldValueClassExtension()

document

public static org.w3c.dom.Document document(java.net.URL url,
                                            boolean validate,
                                            boolean removeWhitespace,
                                            org.xml.sax.EntityResolver resolver)

document

public static org.w3c.dom.Document document(org.xml.sax.InputSource content,
                                            boolean validate,
                                            boolean removeWhitespace,
                                            org.xml.sax.EntityResolver resolver)
Creates a Document object based on the given URL


document

public static org.w3c.dom.Document document(java.lang.String content,
                                            boolean validate,
                                            boolean removeWhitespace,
                                            org.xml.sax.EntityResolver resolver)
Creates a Document object based on the given URL


getDOMParser

public static javax.xml.parsers.DocumentBuilder getDOMParser(boolean validating)

getDOMParser

public static javax.xml.parsers.DocumentBuilder getDOMParser(boolean validating,
                                                             boolean enableDeferNodeExpantion,
                                                             boolean enableContinueAfterFatalError)

isElement

public static boolean isElement(org.w3c.dom.Node e)

getAllChildren

public static org.w3c.dom.Element[] getAllChildren(org.w3c.dom.Element parent,
                                                   java.lang.String tag)
Return an array of all the children of PARENT that are TAG elements.

Returns:
all children with matching tag; is not null

getOneChildMaybe

public static org.w3c.dom.Element getOneChildMaybe(org.w3c.dom.Element parent,
                                                   java.lang.String tag)

getFirstChildElement

public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Element parent)
Returns first child element of the specified parent element. Throws an XMLParseException is a child container element is not found.


serializeDocument

public static void serializeDocument(org.w3c.dom.Document doc,
                                     java.io.OutputStream output)
Serialize an XML Document using a stream. The document pretty prints by default - if you didn't remove whitespace then it should retain structure - DTD path will be fully resolved assumes that this util was used to get document


expectElement

public static org.w3c.dom.Element expectElement(org.w3c.dom.Node node)

expectTag

public static void expectTag(org.w3c.dom.Element elem,
                             java.lang.String tag)
Raise an exception if the current element is not the expected tag - namespaces are not supported.


stringAttribute

public static java.lang.String stringAttribute(org.w3c.dom.Element element,
                                               java.lang.String attrName,
                                               java.lang.String theDefault)
Assume ELEMENT had attribute ATTRNAME, get its value and return it as a string. If there is no attribute return the default.


getText

public static java.lang.String getText(org.w3c.dom.Element parent,
                                       java.lang.String theDefault)

setResolver

public static void setResolver(XMLUtil.Resolver r)

resolveReferences

public static org.w3c.dom.Element resolveReferences(org.w3c.dom.Element e)

resolveReferences

public static org.w3c.dom.Element[] resolveReferences(org.w3c.dom.Element[] e)


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.