JDOM
1.0beta10

org.jdom
Class Verifier

java.lang.Object
  |
  +--org.jdom.Verifier

public final class Verifier
extends java.lang.Object

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.

Version:
$Revision: 1.49 $, $Date: 2004/02/06 09:28:30 $
Author:
Brett McLaughlin, Elliotte Rusty Harold, Jason Hunter, Bradley S. Huffman

Method Summary
static java.lang.String checkAttributeName(java.lang.String name)
          This will check the supplied name to see if it is legal for use as a JDOM Attribute name.
static java.lang.String checkCDATASection(java.lang.String data)
          This will check the supplied data to see if it is legal for use as JDOM CDATA.
static java.lang.String checkCharacterData(java.lang.String text)
          This will check the supplied string to see if it only contains characters allowed by the XML 1.0 specification.
static java.lang.String checkCommentData(java.lang.String data)
          This will check the supplied data to see if it is legal for use as JDOM Comment data.
static java.lang.String checkElementName(java.lang.String name)
          This will check the supplied name to see if it is legal for use as a JDOM Element name.
static java.lang.String checkNamespaceCollision(Attribute attribute, Element element)
          Check if Attribute's namespace collides with a Element's namespace.
static java.lang.String checkNamespaceCollision(Namespace namespace, Attribute attribute)
          Check if a Namespace collides with a Attribute's namespace.
static java.lang.String checkNamespaceCollision(Namespace namespace, Element element)
          Check if a Namespace collides with a Element's namespace.
static java.lang.String checkNamespaceCollision(Namespace namespace, java.util.List list)
          Check if a Namespace collides with any namespace from a list of objects.
static java.lang.String checkNamespaceCollision(Namespace namespace, Namespace other)
          Check if two namespaces collide.
static java.lang.String checkNamespacePrefix(java.lang.String prefix)
          This will check the supplied name to see if it is legal for use as a JDOM Namespace prefix.
static java.lang.String checkNamespaceURI(java.lang.String uri)
          This will check the supplied name to see if it is legal for use as a JDOM Namespace URI.
static java.lang.String checkProcessingInstructionData(java.lang.String data)
          This will check the supplied data to see if it is legal for use as ProcessingInstruction data.
static java.lang.String checkProcessingInstructionTarget(java.lang.String target)
          This will check the supplied data to see if it is legal for use as a JDOM ProcessingInstruction target.
static java.lang.String checkPublicID(java.lang.String publicID)
          This will ensure that the data for a public identifier is legal.
static java.lang.String checkSystemLiteral(java.lang.String systemLiteral)
          This will ensure that the data for a system literal is legal.
static java.lang.String checkURI(java.lang.String uri)
           Checks a string to see if it is a legal RFC 2396 URI.
static java.lang.String checkXMLName(java.lang.String name)
          This is a utility function for sharing the base process of checking any XML name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkElementName

public static java.lang.String checkElementName(java.lang.String name)
This will check the supplied name to see if it is legal for use as a JDOM Element name.

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

checkAttributeName

public static java.lang.String checkAttributeName(java.lang.String name)
This will check the supplied name to see if it is legal for use as a JDOM Attribute name.

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

checkCharacterData

public static java.lang.String checkCharacterData(java.lang.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 value to check.
Returns:
String reason name is illegal, or null if name is OK.

checkCDATASection

public static java.lang.String checkCDATASection(java.lang.String data)
This will check the supplied data to see if it is legal for use as JDOM CDATA.

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

checkNamespacePrefix

public static java.lang.String checkNamespacePrefix(java.lang.String prefix)
This will check the supplied name to see if it is legal for use as a JDOM Namespace prefix.

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

checkNamespaceURI

public static java.lang.String checkNamespaceURI(java.lang.String uri)
This will check the supplied name to see if it is legal for use as a JDOM Namespace URI.

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

checkNamespaceCollision

public static java.lang.String checkNamespaceCollision(Namespace namespace,
                                                       Namespace other)
Check if two namespaces collide.

Parameters:
namespace - Namespace to check.
other - Namespace to check against.
Returns:
String reason for collision, or null if no collision.

checkNamespaceCollision

public static java.lang.String checkNamespaceCollision(Attribute attribute,
                                                       Element element)
Check if Attribute's namespace collides with a Element's namespace.

Parameters:
attribute - Attribute to check.
element - Element to check against.
Returns:
String reason for collision, or null if no collision.

checkNamespaceCollision

public static java.lang.String checkNamespaceCollision(Namespace namespace,
                                                       Element element)
Check if a Namespace collides with a Element's namespace.

Parameters:
namespace - Namespace to check.
element - Element to check against.
Returns:
String reason for collision, or null if no collision.

checkNamespaceCollision

public static java.lang.String checkNamespaceCollision(Namespace namespace,
                                                       Attribute attribute)
Check if a Namespace collides with a Attribute's namespace.

Parameters:
namespace - Namespace to check.
attribute - Attribute to check against.
Returns:
String reason for collision, or null if no collision.

checkNamespaceCollision

public static java.lang.String checkNamespaceCollision(Namespace namespace,
                                                       java.util.List list)
Check if a Namespace collides with any namespace from a list of objects.

Parameters:
namespace - Namespace to check.
list - List to check against.
Returns:
String reason for collision, or null if no collision.

checkProcessingInstructionTarget

public static java.lang.String checkProcessingInstructionTarget(java.lang.String target)
This will check the supplied data to see if it is legal for use as a JDOM ProcessingInstruction target.

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

checkProcessingInstructionData

public static java.lang.String checkProcessingInstructionData(java.lang.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 data to check.
Returns:
String reason data is illegal, or null if data is OK.

checkCommentData

public static java.lang.String checkCommentData(java.lang.String data)
This will check the supplied data to see if it is legal for use as JDOM Comment data.

Parameters:
data - String data to check.
Returns:
String reason data is illegal, or null if data is OK.

checkPublicID

public static java.lang.String checkPublicID(java.lang.String publicID)
This will ensure that the data for a public identifier is legal.

Parameters:
publicID - String public ID to check.
Returns:
String reason public ID is illegal, or null if public ID is OK.

checkSystemLiteral

public static java.lang.String checkSystemLiteral(java.lang.String systemLiteral)
This will ensure that the data for a system literal is legal.

Parameters:
systemLiteral - String system literal to check.
Returns:
String reason system literal is illegal, or null if system literal is OK.

checkXMLName

public static java.lang.String checkXMLName(java.lang.String name)
This is a utility function for sharing the base process of checking any XML name.

Parameters:
name - String to check for XML name compliance.
Returns:
String reason the name is illegal, or null if OK.

checkURI

public static java.lang.String checkURI(java.lang.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 to check.
Returns:
String reason the URI is illegal, or null if OK.

JDOM
1.0beta10

Copyright © 2004 Jason Hunter, Brett McLaughlin. All Rights Reserved.