XMLSyntax
Keywords: uk.ac.ic.doc.automed.xml.XMLSyntax class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.ac.ic.doc.automed.xml
Class XMLSyntax

    java.lang.Object
      uk.ac.ic.doc.automed.xml.XMLSyntax

    public class XMLSyntax

extends java.lang.Object

Constructor Summary
`XMLSyntax()`

Method Summary
`static java.lang.String` | `addPrefix(java.lang.String msg, java.lang.String prefix)`
`static void` | `checkCDATA(java.lang.String value)` Thorws XMLSyntaxException if the string is null.
`static void` | `checkXMLChar(char c)` Throws IlegleXMLCharacterExceptioin if c is not a valid XML character (i.e.
`static void` | `checkXMLName(java.lang.String name)` Throws an XMLSyntaxException if name is not a valid XML element or attribute name.
`static java.lang.String` | `getAsciiEscapeString(java.lang.String s)` returns a String suitable for printing to standard out
`static java.lang.String` | `getFullExceptionMessage(java.lang.Throwable t)`
`static java.lang.String` | `getFullExceptionMessage(java.lang.Throwable t, java.lang.String prefix, boolean stackTrace)`
`static java.lang.String` | `getUnicodeEscapeString(char c)` useful for reporting illegle characters that may not be printable
`static java.lang.String` | `protectAttributeValue(java.lang.String value)` Escapes the characters in value that would otherwise be interpreted as markup meta characters when value is used as an attribute value.
`static java.lang.String` | `protectCharData(java.lang.String value)` Escapes the characters in value that would otherwise be interpreted as markup meta characters when value is used as normal character data content ("]]>" is escaped to "]]>").
`static java.lang.String[]` | `splitCDATA(java.lang.String value)` Thorws XMLSyntaxException if the String is null.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XMLSyntax

    public XMLSyntax()

Method Detail

### checkXMLName

    public static void checkXMLName(java.lang.String name)
                             throws XMLSyntaxException

  Throws an XMLSyntaxException if name is not a valid XML element or attribute name. This includes null and the empty string. A valid XML element or attribute name must start with a period, underscore or letter and every character after first must be a period, underscore, hyphen, colon, letter or digit. The name must not start with the string \"xml\" no matter what the case.

  Parameters:
    `name` - The name to check the validity of.
  Throws:
    `XMLSyntaxException`

### protectAttributeValue

    public static java.lang.String protectAttributeValue(java.lang.String value)
                                                  throws XMLSyntaxException

  Escapes the characters in value that would otherwise be interpreted as markup meta characters when value is used as an attribute value. Both single and double quotes are escaped rather than requiring you to specify what delimeter you are using. Throws an XMLSyntaxException if value is null or any character in value is not a valid XML character.

  Throws:
    `XMLSyntaxException`

### protectCharData

    public static java.lang.String protectCharData(java.lang.String value)
                                            throws XMLSyntaxException

  Escapes the characters in value that would otherwise be interpreted as markup meta characters when value is used as normal character data content ("]]>" is escaped to "]]>"). Throws an XMLSyntaxException if value is null or any character in value is not a valid XML character.

  Throws:
    `XMLSyntaxException`

### splitCDATA

    public static java.lang.String[] splitCDATA(java.lang.String value)
                                         throws XMLSyntaxException

  Thorws XMLSyntaxException if the String is null. Throws IlegleXMLCharacterException if any character in value is not a valid XML character. If the string contains any embedded "]]>" sequences then multiple strings are returned, each should be enclosed in its own CData delimiters, otherwise a single element array containing your original string is returned

  Throws:
    `XMLSyntaxException`

### checkCDATA

    public static void checkCDATA(java.lang.String value)
                           throws XMLSyntaxException

  Thorws XMLSyntaxException if the string is null. Throws IlegleXMLCharacterException if any character in value is not a valid XML character. Does not check for embedded "]]>" strings.

  Throws:
    `XMLSyntaxException`

### checkXMLChar

    public static void checkXMLChar(char c)
                             throws IlegleXMLCharacterException

  Throws IlegleXMLCharacterExceptioin if c is not a valid XML character (i.e. one suitable for general character data). No account of special characters such as '<' or '&' is taken as these vary according to the context.

  Throws:
    `IlegleXMLCharacterException`

### getUnicodeEscapeString

    public static java.lang.String getUnicodeEscapeString(char c)

  useful for reporting illegle characters that may not be printable

### getAsciiEscapeString

    public static java.lang.String getAsciiEscapeString(java.lang.String s)

  returns a String suitable for printing to standard out

### getFullExceptionMessage

    public static java.lang.String getFullExceptionMessage(java.lang.Throwable t)

### getFullExceptionMessage

    public static java.lang.String getFullExceptionMessage(java.lang.Throwable t,
                                                           java.lang.String prefix,
                                                           boolean stackTrace)

### addPrefix

    public static java.lang.String addPrefix(java.lang.String msg,
                                             java.lang.String prefix)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD