Top Description Fields Constructors Methods
org.jdom

public final Class Verifier

extends Object
Class Inheritance
Imports
java.util.*

A utility class to handle well-formedness checks on names, data, and other verification tasks for JDOM. The class is final and may not be subclassed.
Authors
Brett McLaughlin, Elliotte Rusty Harold, Jason Hunter, Bradley S. Huffman
Version
$Revision: 1.57 $, $Date: 2009/07/23 05:54:23 $

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
private
Verifier()

Ensure instantation cannot occur.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

String reason name is illegal, or null if name is OK.
checkAttributeName
(String
String name to check.
name
)

This will check the supplied name to see if it is legal for use as a JDOM Attribute name.

public static String

Returns:

String reason data is illegal, or null is name is OK.
checkCDATASection
(String
String data to check.
data
)

This will check the supplied data to see if it is legal for use as JDOM CDATA.

public static String

Returns:

String reason name is illegal, or null if name is OK.
checkCharacterData
(String
String value to check.
text
)

This will check the supplied string to see if it only contains characters allowed by the XML 1.0 specification.

public static String

Returns:

String reason data is illegal, or null if data is OK.
checkCommentData
(String
String data to check.
data
)

This will check the supplied data to see if it is legal for use as JDOM Comment data.

public static String

Returns:

String reason name is illegal, or null if name is OK.
checkElementName
(String
String name to check.
name
)

This will check the supplied name to see if it is legal for use as a JDOM Element name.

public static String

Returns:

String reason for collision, or null if no collision.
checkNamespaceCollision
(Namespace
Namespace to check.
namespace
,
Namespace
Namespace to check against.
other
)

Check if two namespaces collide.

public static String

Returns:

String reason for collision, or null if no collision.
checkNamespaceCollision
(Attribute
Attribute to check.
attribute
,
Element
Element to check against.
element
)

Check if Attribute's namespace collides with a Element's namespace.

public static String

Returns:

String reason for collision, or null if no collision.
checkNamespaceCollision
(Namespace
Namespace to check.
namespace
,
Element
Element to check against.
element
)

Check if a Namespace collides with a Element's namespace.

public static String

Returns:

String reason for collision, or null if no collision.
checkNamespaceCollision
(Namespace
Namespace to check.
namespace
,
Attribute
Attribute to check against.
attribute
)

Check if a Namespace collides with a Attribute's namespace.

public static String

Returns:

String reason for collision, or null if no collision.
checkNamespaceCollision
(Namespace
Namespace to check.
namespace
,
List<E>
List to check against.
list
)

Check if a Namespace collides with any namespace from a list of objects.

public static String

Returns:

String reason name is illegal, or null if name is OK.
checkNamespacePrefix
(String
String prefix to check.
prefix
)

This will check the supplied name to see if it is legal for use as a JDOM Namespace prefix.

public static String

Returns:

String reason name is illegal, or null if name is OK.
checkNamespaceURI
(String
String URI to check.
uri
)

This will check the supplied name to see if it is legal for use as a JDOM Namespace URI.

public static String

Returns:

String reason data is illegal, or null if data is OK.
checkProcessingInstructionData
(String
String data to check.
data
)

This will check the supplied data to see if it is legal for use as ProcessingInstruction data.

public static String

Returns:

String reason target is illegal, or null if target is OK.
checkProcessingInstructionTarget
(String
String target to check.
target
)

This will check the supplied data to see if it is legal for use as a JDOM ProcessingInstruction target.

public static String

Returns:

String reason public ID is illegal, or null if public ID is OK.
checkPublicID
(String
String public ID to check.
publicID
)

This will ensure that the data for a public identifier is legal.

public static String

Returns:

String reason system literal is illegal, or null if system literal is OK.
checkSystemLiteral
(String
String system literal to check.
systemLiteral
)

This will ensure that the data for a system literal is legal.

public static String

Returns:

String reason the URI is illegal, or null if OK.
checkURI
(String
String to check.
uri
)

Checks a string to see if it is a legal RFC 2396 URI.

public static String

Returns:

String reason the name is illegal, or null if OK.
checkXMLName
(String
String to check for XML name compliance.
name
)

This is a utility function for sharing the base process of checking any XML name.

public static int

Returns:

decoded character
decodeSurrogatePair
(char
high 16 bits
high
,
char
low 16 bits
low
)

This is a utility function to decode a non-BMP UTF-16 surrogate pair.

public static boolean

Returns:

true if it's allowed, false otherwise.
isHexDigit
(char
to check for hex digit.
c
)

This is a utility function for determining whether a specified Unicode character is a hexadecimal digit as defined in RFC 2396; that is, one of the ASCII characters 0-9, a-f, or A-F.

public static boolean

Returns:

true if the character is a high surrogate, false otherwise
isHighSurrogate
(char
character to check
ch
)

This is a function for determining whether the specified character is the high 16 bits in a UTF-16 surrogate pair.

public static boolean

Returns:

true if the character is a low surrogate, false otherwise.
isLowSurrogate
(char
character to check
ch
)

This is a function for determining whether the specified character is the low 16 bits in a UTF-16 surrogate pair.

public static boolean

Returns:

true if it's allowed, false otherwise.
isURICharacter
(char
char to check for URI reference compliance.
c
)

This is a utility function for determining whether a specified Unicode character is legal in URI references as determined by RFC 2396.

public static boolean

Returns:

boolean true if it's a character, false otherwise
isXMLCharacter
(int
char to check for XML compliance
c
)

This is a utility function for determining whether a specified character is a character according to production 2 of the XML 1.0 specification.

public static boolean

Returns:

boolean true if it's a combining character, false otherwise.
isXMLCombiningChar
(char
char to check.
c
)

This is a utility function for determining whether a specified character is a combining character according to production 87 of the XML 1.0 specification.

public static boolean

Returns:

boolean true if it's a digit, false otherwise
isXMLDigit
(char
char to check for XML digit compliance
c
)

This is a utility function for determining whether a specified Unicode character is a digit according to production 88 of the XML 1.0 specification.

public static boolean

Returns:

String true if it's an extender, false otherwise.
isXMLExtender
(char
char to check.
c
)

This is a utility function for determining whether a specified character is an extender according to production 88 of the XML 1.0 specification.

public static boolean

Returns:

String true if it's a letter, false otherwise.
isXMLLetter
(char
char to check for XML name compliance.
c
)

This is a utility function for determining whether a specified character is a letter according to production 84 of the XML 1.0 specification.

public static boolean

Returns:

boolean true if it's letter or digit, false otherwise.
isXMLLetterOrDigit
(char
char to check.
c
)

This is a utility function for determining whether a specified character is a letter or digit according to productions 84 and 88 of the XML 1.0 specification.

public static boolean

Returns:

boolean true if it's a name character, false otherwise.
isXMLNameCharacter
(char
char to check for XML name compliance.
c
)

This is a utility function for determining whether a specified character is a name character according to production 4 of the XML 1.0 specification.

public static boolean

Returns:

boolean true if it's a name start character, false otherwise.
isXMLNameStartCharacter
(char
char to check for XML name start compliance.
c
)

This is a utility function for determining whether a specified character is a legal name start character according to production 5 of the XML 1.0 specification.

public static boolean
public static boolean

Returns:

boolean true if it's a whitespace, false otherwise
isXMLWhitespace
(char
char to check for XML whitespace compliance
c
)

This is a utility function for determining whether a specified Unicode character is a whitespace character according to production 3 of the XML 1.0 specification.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CVS_IDback to summary
private static final String CVS_ID

Constructor Detail

Verifierback to summary
private Verifier()

Ensure instantation cannot occur.

Method Detail

checkAttributeNameback to summary
public static String checkAttributeName(String name)

This will check the supplied name to see if it is legal for use as a JDOM Attribute name.

Parameters
name:String

String name to check.

Returns:String

String reason name is illegal, or null if name is OK.

checkCDATASectionback to summary
public static String checkCDATASection(String data)

This will check the supplied data to see if it is legal for use as JDOM CDATA.

Parameters
data:String

String data to check.

Returns:String

String reason data is illegal, or null is name is OK.

checkCharacterDataback to summary
public static String checkCharacterData(String text)

This will check the supplied string to see if it only contains characters allowed by the XML 1.0 specification. The C0 controls (e.g. null, vertical tab, formfeed, etc.) are specifically excluded except for carriage return, linefeed, and the horizontal tab. Surrogates are also excluded.

This method is useful for checking element content and attribute values. Note that characters like " and < are allowed in attribute values and element content. They will simply be escaped as " or < when the value is serialized.

Parameters
text:String

String value to check.

Returns:String

String reason name is illegal, or null if name is OK.

checkCommentDataback to summary
public static String checkCommentData(String data)

This will check the supplied data to see if it is legal for use as JDOM Comment data.

Parameters
data:String

String data to check.

Returns:String

String reason data is illegal, or null if data is OK.

checkElementNameback to summary
public static String checkElementName(String name)

This will check the supplied name to see if it is legal for use as a JDOM Element name.

Parameters
name:String

String name to check.

Returns:String

String reason name is illegal, or null if name is OK.

checkNamespaceCollisionback to summary
public static String checkNamespaceCollision(Namespace namespace, Namespace other)

Check if two namespaces collide.

Parameters
namespace:Namespace

Namespace to check.

other:Namespace

Namespace to check against.

Returns:String

String reason for collision, or null if no collision.

checkNamespaceCollisionback to summary
public static String checkNamespaceCollision(Attribute attribute, Element element)

Check if Attribute's namespace collides with a Element's namespace.

Parameters
attribute:Attribute

Attribute to check.

element:Element

Element to check against.

Returns:String

String reason for collision, or null if no collision.

checkNamespaceCollisionback to summary
public static String checkNamespaceCollision(Namespace namespace, Element element)

Check if a Namespace collides with a Element's namespace.

Parameters
namespace:Namespace

Namespace to check.

element:Element

Element to check against.

Returns:String

String reason for collision, or null if no collision.

checkNamespaceCollisionback to summary
public static String checkNamespaceCollision(Namespace namespace, Attribute attribute)

Check if a Namespace collides with a Attribute's namespace.

Parameters
namespace:Namespace

Namespace to check.

attribute:Attribute

Attribute to check against.

Returns:String

String reason for collision, or null if no collision.

checkNamespaceCollisionback to summary
public static String checkNamespaceCollision(Namespace namespace, List<E> list)

Check if a Namespace collides with any namespace from a list of objects.

Parameters
namespace:Namespace

Namespace to check.

list:List<E>

List to check against.

Returns:String

String reason for collision, or null if no collision.

checkNamespacePrefixback to summary
public static String checkNamespacePrefix(String prefix)

This will check the supplied name to see if it is legal for use as a JDOM Namespace prefix.

Parameters
prefix:String

String prefix to check.

Returns:String

String reason name is illegal, or null if name is OK.

checkNamespaceURIback to summary
public static String checkNamespaceURI(String uri)

This will check the supplied name to see if it is legal for use as a JDOM Namespace URI.

Parameters
uri:String

String URI to check.

Returns:String

String reason name is illegal, or null if name is OK.

checkProcessingInstructionDataback to summary
public static String checkProcessingInstructionData(String data)

This will check the supplied data to see if it is legal for use as ProcessingInstruction data. Besides checking that all the characters are allowed in XML, this also checks that the data does not contain the PI end-string "?>".

Parameters
data:String

String data to check.

Returns:String

String reason data is illegal, or null if data is OK.

checkProcessingInstructionTargetback to summary
public static String checkProcessingInstructionTarget(String target)

This will check the supplied data to see if it is legal for use as a JDOM ProcessingInstruction target.

Parameters
target:String

String target to check.

Returns:String

String reason target is illegal, or null if target is OK.

checkPublicIDback to summary
public static String checkPublicID(String publicID)

This will ensure that the data for a public identifier is legal.

Parameters
publicID:String

String public ID to check.

Returns:String

String reason public ID is illegal, or null if public ID is OK.

checkSystemLiteralback to summary
public static String checkSystemLiteral(String systemLiteral)

This will ensure that the data for a system literal is legal.

Parameters
systemLiteral:String

String system literal to check.

Returns:String

String reason system literal is illegal, or null if system literal is OK.

checkURIback to summary
public static String checkURI(String uri)

Checks a string to see if it is a legal RFC 2396 URI. Both absolute and relative URIs are supported.

Parameters
uri:String

String to check.

Returns:String

String reason the URI is illegal, or null if OK.

checkXMLNameback to summary
public static String checkXMLName(String name)

This is a utility function for sharing the base process of checking any XML name.

Parameters
name:String

String to check for XML name compliance.

Returns:String

String reason the name is illegal, or null if OK.

decodeSurrogatePairback to summary
public static int decodeSurrogatePair(char high, char low)

This is a utility function to decode a non-BMP UTF-16 surrogate pair.

Parameters
high:char

high 16 bits

low:char

low 16 bits

Returns:int

decoded character

isHexDigitback to summary
public static boolean isHexDigit(char c)

This is a utility function for determining whether a specified Unicode character is a hexadecimal digit as defined in RFC 2396; that is, one of the ASCII characters 0-9, a-f, or A-F.

Parameters
c:char

to check for hex digit.

Returns:boolean

true if it's allowed, false otherwise.

isHighSurrogateback to summary
public static boolean isHighSurrogate(char ch)

This is a function for determining whether the specified character is the high 16 bits in a UTF-16 surrogate pair.

Parameters
ch:char

character to check

Returns:boolean

true if the character is a high surrogate, false otherwise

isLowSurrogateback to summary
public static boolean isLowSurrogate(char ch)

This is a function for determining whether the specified character is the low 16 bits in a UTF-16 surrogate pair.

Parameters
ch:char

character to check

Returns:boolean

true if the character is a low surrogate, false otherwise.

isURICharacterback to summary
public static boolean isURICharacter(char c)

This is a utility function for determining whether a specified Unicode character is legal in URI references as determined by RFC 2396.

Parameters
c:char

char to check for URI reference compliance.

Returns:boolean

true if it's allowed, false otherwise.

isXMLCharacterback to summary
public static boolean isXMLCharacter(int c)

This is a utility function for determining whether a specified character is a character according to production 2 of the XML 1.0 specification.

Parameters
c:int

char to check for XML compliance

Returns:boolean

boolean true if it's a character, false otherwise

isXMLCombiningCharback to summary
public static boolean isXMLCombiningChar(char c)

This is a utility function for determining whether a specified character is a combining character according to production 87 of the XML 1.0 specification.

Parameters
c:char

char to check.

Returns:boolean

boolean true if it's a combining character, false otherwise.

isXMLDigitback to summary
public static boolean isXMLDigit(char c)

This is a utility function for determining whether a specified Unicode character is a digit according to production 88 of the XML 1.0 specification.

Parameters
c:char

char to check for XML digit compliance

Returns:boolean

boolean true if it's a digit, false otherwise

isXMLExtenderback to summary
public static boolean isXMLExtender(char c)

This is a utility function for determining whether a specified character is an extender according to production 88 of the XML 1.0 specification.

Parameters
c:char

char to check.

Returns:boolean

String true if it's an extender, false otherwise.

isXMLLetterback to summary
public static boolean isXMLLetter(char c)

This is a utility function for determining whether a specified character is a letter according to production 84 of the XML 1.0 specification.

Parameters
c:char

char to check for XML name compliance.

Returns:boolean

String true if it's a letter, false otherwise.

isXMLLetterOrDigitback to summary
public static boolean isXMLLetterOrDigit(char c)

This is a utility function for determining whether a specified character is a letter or digit according to productions 84 and 88 of the XML 1.0 specification.

Parameters
c:char

char to check.

Returns:boolean

boolean true if it's letter or digit, false otherwise.

isXMLNameCharacterback to summary
public static boolean isXMLNameCharacter(char c)

This is a utility function for determining whether a specified character is a name character according to production 4 of the XML 1.0 specification.

Parameters
c:char

char to check for XML name compliance.

Returns:boolean

boolean true if it's a name character, false otherwise.

isXMLNameStartCharacterback to summary
public static boolean isXMLNameStartCharacter(char c)

This is a utility function for determining whether a specified character is a legal name start character according to production 5 of the XML 1.0 specification. This production does allow names to begin with colons which the Namespaces in XML Recommendation disallows.

Parameters
c:char

char to check for XML name start compliance.

Returns:boolean

boolean true if it's a name start character, false otherwise.

isXMLPublicIDCharacterback to summary
public static boolean isXMLPublicIDCharacter(char c)
isXMLWhitespaceback to summary
public static boolean isXMLWhitespace(char c)

This is a utility function for determining whether a specified Unicode character is a whitespace character according to production 3 of the XML 1.0 specification.

Parameters
c:char

char to check for XML whitespace compliance

Returns:boolean

boolean true if it's a whitespace, false otherwise