org.jdom
Class Verifier


public final class Verifier

Verifier handles XML checks on names, data, and other verification tasks for JDOM.

Author:
Brett McLaughlin, Elliotte Rusty Harold, Jason Hunter
Version: 1.0

Method Summary
 final static StringcheckAttributeName(String name)
           This will check the supplied name to see if it valid for use as a JDOM Attribute name.
 final static StringcheckCDATASection(String data)
           This will ensure that the data for a CDATA section is appropriate.
 final static StringcheckCharacterData(String text)
           This will check the supplied string to see if it only contains characters allowed by the XML 1.0 specification.
 final static StringcheckCommentData(String data)
           This will ensure that the data for a Comment is appropriate.
 final static StringcheckElementName(String name)
           This will check the supplied name to see if it valid for use as a JDOM Element name.
 final static StringcheckNamespacePrefix(String prefix)
           This will check the supplied name to see if it valid for use as a JDOM Namespace prefix.
 final static StringcheckNamespaceURI(String uri)
           This will check the supplied name to see if it valid for use as a JDOM Namespace URI.
 final static StringcheckProcessingInstructionTarget(String target)
           This will check the supplied name to see if it valid for use as a JDOM processing instruction target.
 static booleanisXMLCharacter(char 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.
 static booleanisXMLCombiningChar(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.
 static booleanisXMLDigit(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.
 static booleanisXMLExtender(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.
 static booleanisXMLLetter(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.
 static booleanisXMLLetterOrDigit(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.
 static booleanisXMLNameCharacter(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.
 static booleanisXMLNameStartCharacter(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.
 static voidmain(String[] args)
           

Method Detail

checkAttributeName

public final static String checkAttributeName(String name)

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

Parameters:
name - String name to check.
Returns: String - reason name is invalid, or null if name is OK.

checkCDATASection

public final static String checkCDATASection(String data)

This will ensure that the data for a CDATA section is appropriate.

Parameters:
data - String data to check.
Returns: String - reason data is invalid, or null is name is OK.

checkCharacterData

public final 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:
name - String value to check.
Returns: String - reason name is invalid, or null if name is OK.

checkCommentData

public final static String checkCommentData(String data)

This will ensure that the data for a Comment is appropriate.

Parameters:
data - String data to check.
Returns: String - reason data is invalid, or null is name is OK.

checkElementName

public final static String checkElementName(String name)

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

Parameters:
name - String name to check.
Returns: String - reason name is invalid, or null if name is OK.

checkNamespacePrefix

public final static String checkNamespacePrefix(String prefix)

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

Parameters:
prefix - String prefix to check.
Returns: String - reason name is invalid, or null if name is OK.

checkNamespaceURI

public final static String checkNamespaceURI(String uri)

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

Parameters:
uri - String URI to check.
Returns: String - reason name is invalid, or null if name is OK.

checkProcessingInstructionTarget

public final static String checkProcessingInstructionTarget(String target)

This will check the supplied name to see if it valid for use as a JDOM processing instruction target.

Parameters:
target - String target to check.
Returns: String - reason target is invalid, or null if name is OK.

isXMLCharacter

public static boolean isXMLCharacter(char 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 - char to check for XML compliance.
Returns: boolean - true if it's a character, false otherwise.

isXMLCombiningChar

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 to check.
Returns: boolean - true if it's a combining character, false otherwise.

isXMLDigit

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 to check for XML digit compliance.
Returns: boolean - true if it's a digit, false otherwise.

isXMLExtender

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 to check.
Returns: String - true if it's an extender, false otherwise.

isXMLLetter

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 to check for XML name compliance.
Returns: String - true if it's a letter, false otherwise.

isXMLLetterOrDigit

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 to check.
Returns: boolean - true if it's letter or digit, false otherwise.

isXMLNameCharacter

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 to check for XML name compliance.
Returns: boolean - true if it's a name character, false otherwise.

isXMLNameStartCharacter

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 to check for XML name start compliance.
Returns: boolean - true if it's a name start character, false otherwise.

main

public static void main(String[] args)