org.opensaml
Class XML

java.lang.Object
  extended byorg.opensaml.XML

public class XML
extends java.lang.Object

Utility classes for XML constants and optimizations

Author:
Scott Cantor

Nested Class Summary
static class XML.ParserPool
          Nested class that provides XML parsers as a pooled resource
 
Field Summary
static java.lang.String OPENSAML_NS
          OpenSAML XML namespace
static XML.ParserPool parserPool
          A global object to manage a pool of custom DOM parsers
static java.lang.String SAML_NS
          SAML XML namespace
protected static byte[] SAML_schema
          Cached copy of SAML schema
static java.lang.String SAML_SCHEMA_ID
          SAML XML Schema Identifier
protected static byte[] SAML11_schema
          Cached copy of SAML 1.1 schema
static java.lang.String SAML11_SCHEMA_ID
          SAML 1.1 XML Schema Identifier
static java.lang.String SAMLP_NS
          SAML protocol XML namespace
protected static byte[] SAMLP_schema
          Cached copy of SAML protocol schema
static java.lang.String SAMLP_SCHEMA_ID
          SAML protocol XML Schema Identifier
protected static byte[] SAMLP11_schema
          Cached copy of SAML 1.1 protocol schema
static java.lang.String SAMLP11_SCHEMA_ID
          SAML 1.1 protocol XML Schema Identifier
static java.lang.String SOAP11ENV_NS
          SOAP 1.1 Envelope XML namespace
protected static byte[] SOAP11Env_schema
          Cached copy of SOAP 1.1 Envelope schema
static java.lang.String SOAP11ENV_SCHEMA_ID
          SOAP 1.1 Envelope Schema Identifier
static java.lang.String XML_NS
          XML core namespace
protected static byte[] XML_schema
          Cached copy of XML core schema
static java.lang.String XML_SCHEMA_ID
          XML core schema identifier
static java.lang.String XMLNS_NS
          XML namespace for xmlns attributes
static java.lang.String XMLSIG_NS
          XML Signature namespace
protected static byte[] XMLSig_schema
          Cached copy of XML Signature schema
static java.lang.String XMLSIG_SCHEMA_ID
          XML Signature Schema Identifier
static java.lang.String XPATH2_NS
          XPath Filter 2 namespace
protected static byte[] XPath2_schema
          Cached copy of XPath Filter2 schema
static java.lang.String XPATH2_SCHEMA_ID
          XPath Filter 2 Schema Identifier
static java.lang.String XSD_NS
          XML Schema Instance namespace
static java.lang.String XSI_NS
          XML Schema Instance namespace
 
Constructor Summary
XML()
           
 
Method Summary
static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node n)
          Gets the first child Element of the node, skipping any Text nodes such as whitespace.
static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node n, java.lang.String ns, java.lang.String localName)
          Gets the first child Element of the node of the given name, skipping any Text nodes such as whitespace.
static org.w3c.dom.Element getLastChildElement(org.w3c.dom.Node n)
          Gets the last child Element of the node, skipping any Text nodes such as whitespace.
static org.w3c.dom.Element getLastChildElement(org.w3c.dom.Node n, java.lang.String ns, java.lang.String localName)
          Gets the last child Element of the node of the given name, skipping any Text nodes such as whitespace.
static org.w3c.dom.Element getNextSiblingElement(org.w3c.dom.Node n)
          Gets the next sibling Element of the node, skipping any Text nodes such as whitespace.
static org.w3c.dom.Element getNextSiblingElement(org.w3c.dom.Node n, java.lang.String ns, java.lang.String localName)
          Gets the next sibling Element of the node of the given name, skipping any Text nodes such as whitespace.
static org.w3c.dom.Element getPreviousSiblingElement(org.w3c.dom.Node n)
          Gets the previous sibling Element of the node, skipping any Text nodes such as whitespace.
static org.w3c.dom.Element getPreviousSiblingElement(org.w3c.dom.Node n, java.lang.String ns, java.lang.String localName)
          Gets the previous sibling Element of the node of the given name, skipping any Text nodes such as whitespace.
static boolean isElementNamed(org.w3c.dom.Element e, java.lang.String ns, java.lang.String localName)
          Shortcut for checking a DOM element node's namespace and local name
static boolean isEmpty(java.lang.String s)
          A "safe" null/empty check for strings.
static boolean safeCompare(java.lang.String s1, java.lang.String s2)
          Compares two strings for equality, allowing for nulls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_NS

public static final java.lang.String XML_NS
XML core namespace

See Also:
Constant Field Values

XMLNS_NS

public static final java.lang.String XMLNS_NS
XML namespace for xmlns attributes

See Also:
Constant Field Values

XSI_NS

public static final java.lang.String XSI_NS
XML Schema Instance namespace

See Also:
Constant Field Values

XSD_NS

public static final java.lang.String XSD_NS
XML Schema Instance namespace

See Also:
Constant Field Values

OPENSAML_NS

public static final java.lang.String OPENSAML_NS
OpenSAML XML namespace

See Also:
Constant Field Values

SAML_NS

public static final java.lang.String SAML_NS
SAML XML namespace

See Also:
Constant Field Values

SAMLP_NS

public static final java.lang.String SAMLP_NS
SAML protocol XML namespace

See Also:
Constant Field Values

XMLSIG_NS

public static final java.lang.String XMLSIG_NS
XML Signature namespace

See Also:
Constant Field Values

XPATH2_NS

public static final java.lang.String XPATH2_NS
XPath Filter 2 namespace

See Also:
Constant Field Values

SOAP11ENV_NS

public static final java.lang.String SOAP11ENV_NS
SOAP 1.1 Envelope XML namespace

See Also:
Constant Field Values

XML_SCHEMA_ID

public static final java.lang.String XML_SCHEMA_ID
XML core schema identifier

See Also:
Constant Field Values

SAML_SCHEMA_ID

public static final java.lang.String SAML_SCHEMA_ID
SAML XML Schema Identifier

See Also:
Constant Field Values

SAMLP_SCHEMA_ID

public static final java.lang.String SAMLP_SCHEMA_ID
SAML protocol XML Schema Identifier

See Also:
Constant Field Values

SAML11_SCHEMA_ID

public static final java.lang.String SAML11_SCHEMA_ID
SAML 1.1 XML Schema Identifier

See Also:
Constant Field Values

SAMLP11_SCHEMA_ID

public static final java.lang.String SAMLP11_SCHEMA_ID
SAML 1.1 protocol XML Schema Identifier

See Also:
Constant Field Values

XMLSIG_SCHEMA_ID

public static final java.lang.String XMLSIG_SCHEMA_ID
XML Signature Schema Identifier

See Also:
Constant Field Values

XPATH2_SCHEMA_ID

public static final java.lang.String XPATH2_SCHEMA_ID
XPath Filter 2 Schema Identifier

See Also:
Constant Field Values

SOAP11ENV_SCHEMA_ID

public static final java.lang.String SOAP11ENV_SCHEMA_ID
SOAP 1.1 Envelope Schema Identifier

See Also:
Constant Field Values

XML_schema

protected static byte[] XML_schema
Cached copy of XML core schema


SAML_schema

protected static byte[] SAML_schema
Cached copy of SAML schema


SAMLP_schema

protected static byte[] SAMLP_schema
Cached copy of SAML protocol schema


SAML11_schema

protected static byte[] SAML11_schema
Cached copy of SAML 1.1 schema


SAMLP11_schema

protected static byte[] SAMLP11_schema
Cached copy of SAML 1.1 protocol schema


XMLSig_schema

protected static byte[] XMLSig_schema
Cached copy of XML Signature schema


XPath2_schema

protected static byte[] XPath2_schema
Cached copy of XPath Filter2 schema


SOAP11Env_schema

protected static byte[] SOAP11Env_schema
Cached copy of SOAP 1.1 Envelope schema


parserPool

public static XML.ParserPool parserPool
A global object to manage a pool of custom DOM parsers

Constructor Detail

XML

public XML()
Method Detail

isEmpty

public static boolean isEmpty(java.lang.String s)
A "safe" null/empty check for strings.

Parameters:
s - The string to check
Returns:
true iff the string is null or length zero

safeCompare

public static boolean safeCompare(java.lang.String s1,
                                  java.lang.String s2)
Compares two strings for equality, allowing for nulls

Parameters:
s1 - The first operand
s2 - The second operand
Returns:
true iff both are null or both are non-null and the same strng value

isElementNamed

public static boolean isElementNamed(org.w3c.dom.Element e,
                                     java.lang.String ns,
                                     java.lang.String localName)
Shortcut for checking a DOM element node's namespace and local name

Parameters:
e - An element to compare against
ns - An XML namespace to compare
localName - A local name to compare
Returns:
true iff the element's local name and namespace match the parameters

getFirstChildElement

public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node n)
Gets the first child Element of the node, skipping any Text nodes such as whitespace.

Parameters:
n - The parent in which to search for children
Returns:
The first child Element of n, or null if none

getLastChildElement

public static org.w3c.dom.Element getLastChildElement(org.w3c.dom.Node n)
Gets the last child Element of the node, skipping any Text nodes such as whitespace.

Parameters:
n - The parent in which to search for children
Returns:
The last child Element of n, or null if none

getFirstChildElement

public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Node n,
                                                       java.lang.String ns,
                                                       java.lang.String localName)
Gets the first child Element of the node of the given name, skipping any Text nodes such as whitespace.

Parameters:
n - The parent in which to search for children
ns - The namespace URI of the element to locate
localName - The local name of the element to locate
Returns:
The first child Element of n with the specified name, or null if none

getLastChildElement

public static org.w3c.dom.Element getLastChildElement(org.w3c.dom.Node n,
                                                      java.lang.String ns,
                                                      java.lang.String localName)
Gets the last child Element of the node of the given name, skipping any Text nodes such as whitespace.

Parameters:
n - The parent in which to search for children
ns - The namespace URI of the element to locate
localName - The local name of the element to locate
Returns:
The last child Element of n with the specified name, or null if none

getNextSiblingElement

public static org.w3c.dom.Element getNextSiblingElement(org.w3c.dom.Node n)
Gets the next sibling Element of the node, skipping any Text nodes such as whitespace.

Parameters:
n - The sibling to start with
Returns:
The next sibling Element of n, or null if none

getPreviousSiblingElement

public static org.w3c.dom.Element getPreviousSiblingElement(org.w3c.dom.Node n)
Gets the previous sibling Element of the node, skipping any Text nodes such as whitespace.

Parameters:
n - The sibling to start with
Returns:
The previous sibling Element of n, or null if none

getNextSiblingElement

public static org.w3c.dom.Element getNextSiblingElement(org.w3c.dom.Node n,
                                                        java.lang.String ns,
                                                        java.lang.String localName)
Gets the next sibling Element of the node of the given name, skipping any Text nodes such as whitespace.

Parameters:
n - The sibling to start with
ns - The namespace URI of the element to locate
localName - The local name of the element to locate
Returns:
The next sibling Element of n with the specified name, or null if none

getPreviousSiblingElement

public static org.w3c.dom.Element getPreviousSiblingElement(org.w3c.dom.Node n,
                                                            java.lang.String ns,
                                                            java.lang.String localName)
Gets the previous sibling Element of the node of the given name, skipping any Text nodes such as whitespace.

Parameters:
n - The sibling to start with
ns - The namespace URI of the element to locate
localName - The local name of the element to locate
Returns:
The previous sibling Element of n with the specified name, or null if none


Copyright ? 2002 UCAID. All Rights Reserved.