net.charlesames.utility.xml
Class Xsd

java.lang.Object
  extended by net.charlesames.utility.xml.Xsd

public class Xsd
extends java.lang.Object

Singleton class wrapping functionality for XML schemas.

Author:
Charles Ames

Nested Class Summary
static class Xsd.AttributeNames
           
static class Xsd.AttributeValues
           
static class Xsd.Tags
           
 
Field Summary
static java.lang.String FILE_EXTENSION
          The standard extension for XML schema files.
 
Method Summary
static org.w3c.dom.Element appendAppInfoEntry(org.w3c.dom.Element element, java.lang.String sourceTag, java.lang.String sourceContent, java.lang.String entryTag, java.lang.String entryContent)
          Append an appinfo entry.
static org.w3c.dom.Element appendAppInfoImplementingClass(org.w3c.dom.Element element, java.lang.Class<?> implementingClass)
          Append appinfo element for the implementing class.
static org.w3c.dom.Element appendDocumentation(org.w3c.dom.Element element, java.lang.String content)
          Append a documentation element.
static org.w3c.dom.Element createAnnotationElement(org.w3c.dom.Element element)
          Dereference an existing annotation element.
static org.w3c.dom.Element createAppinfoElement(org.w3c.dom.Element element, java.lang.String sourceTag, java.lang.String sourceContent)
          Dereference an existing appinfo element from an existing annotation element.
static org.w3c.dom.Element createSchemaElement(org.w3c.dom.Document document, java.lang.String targetNamespace)
          Create a schema element at the apex of an XML document.
static Xsd getSingleton()
          Creates XSD singleton on first invocation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_EXTENSION

public static final java.lang.String FILE_EXTENSION
The standard extension for XML schema files.

See Also:
Constant Field Values
Method Detail

getSingleton

public static Xsd getSingleton()
Creates XSD singleton on first invocation. Returns this singleton always.

Returns:
The XSD singleton.

createSchemaElement

public static org.w3c.dom.Element createSchemaElement(org.w3c.dom.Document document,
                                                      java.lang.String targetNamespace)
Create a schema element at the apex of an XML document.

Parameters:
document - The XML document node.
targetNamespace - The target namespace.
Returns:
The newly created XSD schema element.

createAnnotationElement

public static org.w3c.dom.Element createAnnotationElement(org.w3c.dom.Element element)
Dereference an existing annotation element. If one does not exist, create it.

Parameters:
element - The element to be annotated.
Returns:
The new/dereferenced annotation element.

createAppinfoElement

public static org.w3c.dom.Element createAppinfoElement(org.w3c.dom.Element element,
                                                       java.lang.String sourceTag,
                                                       java.lang.String sourceContent)
Dereference an existing appinfo element from an existing annotation element. If one does not exist, create it.

Parameters:
element - The element to be annotated.
sourceTag - The attribute name for the appinfo source. No source is appended if this argument is null or blank.
sourceContent - The attribute value for the appinfo source.
Returns:
The new/dereferenced annotation element.

appendDocumentation

public static org.w3c.dom.Element appendDocumentation(org.w3c.dom.Element element,
                                                      java.lang.String content)
Append a documentation element. createAnnotationElement(Element) is used to create/dereference an annotation element, to which the new documentation element is appended.

Parameters:
element - The element which is to receive the documentation element
content - The text content of the new documentation element.
Returns:
The newly created documentation element.

appendAppInfoEntry

public static org.w3c.dom.Element appendAppInfoEntry(org.w3c.dom.Element element,
                                                     java.lang.String sourceTag,
                                                     java.lang.String sourceContent,
                                                     java.lang.String entryTag,
                                                     java.lang.String entryContent)
Append an appinfo entry. createAppinfoElement(Element, String, String) is used to create/dereference an appinfo element, to which the new appinfo entry is appended.

Parameters:
element - The element which is to receive the documentation element
sourceTag - The XML tag of the appinfo source attribute.
sourceContent - The content of the appinfo source attribute.
entryTag - The XML tag of the new appinfo entry.
entryContent - The text content of the new appinfo entry.
Returns:
The newly created documentation element.

appendAppInfoImplementingClass

public static org.w3c.dom.Element appendAppInfoImplementingClass(org.w3c.dom.Element element,
                                                                 java.lang.Class<?> implementingClass)
Append appinfo element for the implementing class.

Parameters:
element -
implementingClass -
Returns:
The newly created documentation element.