com.ssx.xml.output.impl
Class XmlValidator

java.lang.Object
  extended bycom.ssx.xml.output.impl.XmlValidator
All Implemented Interfaces:
XmlOutput

public class XmlValidator
extends Object
implements XmlOutput

A utility class that can be used to drive an XML document producer based on the XmlSink class from java code. This class handles the Verification of the provided XML data ensuring that the XmlSink preconditions are met.


Constructor Summary
XmlValidator(XmlSink sink)
          Instantiate a new, empty, validator
 
Method Summary
 void attribute(String name, String value)
          Add an attribute to the current element using the element namespace.
 void attribute(String prefix, String name, String value)
          Add an attribute to the current element.
 void close()
          End the output.
 void comment(String content)
          Write a comment to the output.
 void endElement()
          End the current element.
 XmlSink getSink()
           
 void instruction(String target, String data)
          Add a processing instruction to the output.
 void namespace(String prefix, String name)
          Add a new namespace to the current context.
 void startElement(String name)
          Start a new element in the output using the default namespace
 void startElement(String prefix, String name)
          Start a new element in the output
 void text(String text)
          Add character data to the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlValidator

public XmlValidator(XmlSink sink)
Instantiate a new, empty, validator

Parameters:
sink - The XmlSink to be driven by this outputer.
Method Detail

getSink

public XmlSink getSink()
Returns:
The XmlSink used to output the XML

startElement

public void startElement(String name)
Description copied from interface: XmlOutput
Start a new element in the output using the default namespace

Specified by:
startElement in interface XmlOutput
Parameters:
name - The element name
See Also:
XmlOutput.startElement(String)

startElement

public void startElement(String prefix,
                         String name)
Description copied from interface: XmlOutput
Start a new element in the output

Specified by:
startElement in interface XmlOutput
Parameters:
prefix - The namespace prefix
name - The element name
See Also:
XmlOutput.startElement(String, String)

namespace

public void namespace(String prefix,
                      String name)
Add a new namespace to the current context.

Specified by:
namespace in interface XmlOutput
Parameters:
prefix - The alias to use for this namespace within the document. use the empty string or null to denote the default namespace.
name - The namespace name
See Also:
XmlOutput.namespace(java.lang.String, java.lang.String)

attribute

public void attribute(String name,
                      String value)
Description copied from interface: XmlOutput
Add an attribute to the current element using the element namespace.

Specified by:
attribute in interface XmlOutput
Parameters:
name - The attribute name
value - The attribute value
See Also:
XmlOutput.attribute(String, String)

attribute

public void attribute(String prefix,
                      String name,
                      String value)
Description copied from interface: XmlOutput
Add an attribute to the current element.

Specified by:
attribute in interface XmlOutput
Parameters:
prefix - The namespace prefix
name - The attribute name
value - The attribute value
See Also:
XmlOutput.attribute(String, String, String)

endElement

public void endElement()
Description copied from interface: XmlOutput
End the current element.

Specified by:
endElement in interface XmlOutput
See Also:
XmlOutput.endElement()

text

public void text(String text)
Description copied from interface: XmlOutput
Add character data to the output. Any illegal characters will be escaped using entity references.

Specified by:
text in interface XmlOutput
Parameters:
text - The text to add as XML character data
See Also:
XmlOutput.text(String)

instruction

public void instruction(String target,
                        String data)
Description copied from interface: XmlOutput
Add a processing instruction to the output.

Specified by:
instruction in interface XmlOutput
Parameters:
target - The name of the PI target.
data - The PI data - may not contain '?>'
See Also:
XmlOutput.instruction(String, String)

comment

public void comment(String content)
Description copied from interface: XmlOutput
Write a comment to the output.

Specified by:
comment in interface XmlOutput
Parameters:
content - The content of the comment.
See Also:
XmlOutput.comment(String)

close

public void close()
Description copied from interface: XmlOutput
End the output. No more calls are allowed.

Specified by:
close in interface XmlOutput
See Also:
XmlOutput.close()