org.foray.common
Class XMLUtil

java.lang.Object
  extended by org.foray.common.XMLUtil

public final class XMLUtil
extends Object

Utility class containing methods useful in parsing or building XML.


Field Summary
static String XMLNS_NAMESPACE_URI
          The namespace declaration to be assigned to the namespace definition in XML documents.
 
Method Summary
static org.apache.xml.resolver.tools.CatalogResolver getEntityResolver(String[] catalogs)
          Creates an EntityResolver for one or more XML catalogs.
static XMLResolver getXMLResolver(String[] catalogs)
          Creates an XMLResolver for one or more XML catalogs.
static String normalizeWhitespace(String input)
          Converts all whitespace characters to spaces, then compresses all sequences of spaces to one space.
static int normalizeWhitespace(StringBuilder buffer)
          Converts all whitespace characters to spaces, then compresses all sequences of spaces to one space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLNS_NAMESPACE_URI

public static final String XMLNS_NAMESPACE_URI
The namespace declaration to be assigned to the namespace definition in XML documents.

See Also:
"http://www.w3.org/2000/xmlns/", Constant Field Values
Method Detail

normalizeWhitespace

public static String normalizeWhitespace(String input)
Converts all whitespace characters to spaces, then compresses all sequences of spaces to one space.

Parameters:
input - The String that should be converted.
Returns:
The converted String.
See Also:
normalizeWhitespace(StringBuilder)

normalizeWhitespace

public static int normalizeWhitespace(StringBuilder buffer)
Converts all whitespace characters to spaces, then compresses all sequences of spaces to one space.

Parameters:
buffer - The StringBuffer that should be converted.
Returns:
The number of changes made to buffer.
See Also:
normalizeWhitespace(String)

getEntityResolver

public static org.apache.xml.resolver.tools.CatalogResolver getEntityResolver(String[] catalogs)
Creates an EntityResolver for one or more XML catalogs.

Parameters:
catalogs - The array of URIs indicating where the XML catalogs are located.
Returns:
The created EntityResolver.

getXMLResolver

public static XMLResolver getXMLResolver(String[] catalogs)
Creates an XMLResolver for one or more XML catalogs.

Parameters:
catalogs - The array of URIs indicating where the XML catalogs are located.
Returns:
The created EntityResolver.


Copyright © 2017. All rights reserved.