com.sodius.mdw.core.util.io
Interface XMLWriter

All Superinterfaces:
ContentHandler

public interface XMLWriter
extends ContentHandler

Receives notification of the logical content of a document to be written out.

This writer outputs well-formated XML data and encodes text data as necessary.

This interface is not intended to be implemented by clients.

See Also:
XMLUtils.createWriter(File)

Method Summary
 void characters(String text)
          Receives notification of character data.
 Attributes createAttributes(String[] nameAndValues)
          Creates an XML Attributes for the specified names and values.
 Attributes createAttributes(String name, String value)
          Creates a singleton XML Attributes for the specified name and value.
 void dataElement(String qName, String data)
          Receives notification of the element with data information but whithout attributes and child.
 void dataElement(String uri, String localName, String data)
          Receives notification of the element with data information but whithout attributes and child.
 void emptyElement(String qName, Attributes attrs)
          Receives notification of the element without data information and whithout child.
 void emptyElement(String uri, String localName, Attributes attrs)
          Receives notification of the element without data information and whithout child.
 void endElement(String qName)
          Receives notification of the end of an element.
 void endElement(String uri, String localName)
          Receives notification of the end of an element.
 void startElement(String qName)
          Receives notification of the beginning of an element.
 void startElement(String qName, Attributes attrs)
          Receives notification of the beginning of an element containing attributes.
 void startElement(String uri, String localName)
          Receives notification of the beginning of an element.
 void startElement(String uri, String localName, Attributes attrs)
          Receives notification of the beginning of an element containing attributes.
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 

Method Detail

createAttributes

Attributes createAttributes(String name,
                            String value)
Creates a singleton XML Attributes for the specified name and value.

Parameters:
name - the attribute name.
value - the attribute value.
Returns:
a singleton XML Attributes.

createAttributes

Attributes createAttributes(String[] nameAndValues)
Creates an XML Attributes for the specified names and values.

The specified array must contains pairs of names and values (["name", aNameValue, "id", anID] for example). null values are ignored and won't appear in the XML document.

Parameters:
nameAndValues - the attributes name and values.
Returns:
an XML Attributes.

characters

void characters(String text)
                throws SAXException
Receives notification of character data.

Parameters:
text - the text data to write.
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

dataElement

void dataElement(String qName,
                 String data)
                 throws SAXException
Receives notification of the element with data information but whithout attributes and child.

This method can be used if the XML document does not contain namespaces.

Parameters:
qName - the qualified name (with prefix).
data - the element text information.
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

dataElement

void dataElement(String uri,
                 String localName,
                 String data)
                 throws SAXException
Receives notification of the element with data information but whithout attributes and child.

This method can be used if the XML document contains namespaces.

Parameters:
uri - the Namespace URI.
localName - the local name (without prefix).
data - the element text information.
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

emptyElement

void emptyElement(String qName,
                  Attributes attrs)
                  throws SAXException
Receives notification of the element without data information and whithout child.

This method can be used if the XML document does not contain namespaces.

Parameters:
qName - the qualified name (with prefix).
attrs - the attributes attached to the element.
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

emptyElement

void emptyElement(String uri,
                  String localName,
                  Attributes attrs)
                  throws SAXException
Receives notification of the element without data information and whithout child.

This method can be used if the XML document contains namespaces.

Parameters:
uri - the Namespace URI.
localName - the local name (without prefix).
attrs - the attributes attached to the element.
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

startElement

void startElement(String qName)
                  throws SAXException
Receives notification of the beginning of an element.

This method can be used if the XML document does not contain namespaces and if the XML element has no attribute.

Parameters:
qName - the qualified name (with prefix).
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

startElement

void startElement(String qName,
                  Attributes attrs)
                  throws SAXException
Receives notification of the beginning of an element containing attributes.

This method can be used if the XML document does not contain namespaces.

Parameters:
qName - the qualified name (with prefix).
attrs - the attributes attached to the element.
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

startElement

void startElement(String uri,
                  String localName)
                  throws SAXException
Receives notification of the beginning of an element.

This method can be used if the XML document contains namespaces and if the XML element has no attribute.

Parameters:
uri - the Namespace URI.
localName - the local name (without prefix).
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

startElement

void startElement(String uri,
                  String localName,
                  Attributes attrs)
                  throws SAXException
Receives notification of the beginning of an element containing attributes.

This method can be used if the XML document contains namespaces.

Parameters:
uri - the Namespace URI.
localName - the local name (without prefix).
attrs - the attributes attached to the element.
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

endElement

void endElement(String qName)
                throws SAXException
Receives notification of the end of an element.

This method can be used if the XML document does not contain namespaces.

Parameters:
qName - the qualified name (with prefix).
Throws:
SAXException - any SAX exception, possibly wrapping another exception.

endElement

void endElement(String uri,
                String localName)
                throws SAXException
Receives notification of the end of an element.

This method can be used if the XML document contains namespaces.

Parameters:
uri - the Namespace URI.
localName - the local name (without prefix).
Throws:
SAXException - any SAX exception, possibly wrapping another exception.