Search this API

y.io.graphml.output
Class AbstractXmlWriter

java.lang.Object
  extended by y.io.graphml.output.AbstractXmlWriter
All Implemented Interfaces:
XmlWriter
Direct Known Subclasses:
DomXmlWriter

public abstract class AbstractXmlWriter
extends java.lang.Object
implements XmlWriter

Abstract implementation of XmlWriter.

 

Constructor Summary
AbstractXmlWriter()
           
 
Method Summary
protected abstract  XmlNamespaceManager createNamespaceManager()
          Create a new XmlNamespaceManager instance that can be used by this writer instance
 XmlNamespaceManager getNamespaceManager()
          Gets the XmlNamespaceManager manager associated with this writer.
 XmlWriter writeAttribute(GraphMLXmlAttribute attribute)
          Write an XML attribute from the given attribute struct.
 XmlWriter writeAttribute(java.lang.String localName, boolean value)
          Convenience method to directly write a boolean valued XML attribute.
 XmlWriter writeAttribute(java.lang.String localName, double value)
          Convenience method to directly write a double valued XML attribute.
 XmlWriter writeAttribute(java.lang.String localName, long value)
          Convenience method to directly write a integer valued XML attribute.
 XmlWriter writeAttribute(java.lang.String localName, java.lang.String value)
          Write a XML attribute node.
 XmlWriter writeAttribute(java.lang.String prefix, java.lang.String localName, java.lang.String ns, java.lang.String value)
          Write a XML attribute node.
protected abstract  void writeAttributeCore(java.lang.String prefix, java.lang.String localName, java.lang.String namespace, java.lang.String value)
          The core method that actually writes an attribute.
 XmlWriter writeEndElement()
          Close a XML element previously opened with writeStartElement(String,String) or writeStartElement(String,String,String).
protected abstract  void writeEndElementCore()
          The core method that actually writes the end element.
 XmlWriter writeStartElement(java.lang.String localName, java.lang.String ns)
          Begin a new XML element with given parameters.
 XmlWriter writeStartElement(java.lang.String prefix, java.lang.String localName, java.lang.String ns)
          Begin a new XML element with given parameters.
protected abstract  void writeStartElementCore(java.lang.String prefix, java.lang.String localName, java.lang.String namespace)
          The core method that actually writes the starting element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface y.io.graphml.output.XmlWriter
flushDocument, writeCData, writeComment, writeDocumentFragment, writeEndDocument, writeProcessingInstruction, writeStartDocument, writeText
 

Constructor Detail

AbstractXmlWriter

public AbstractXmlWriter()
Method Detail

writeAttribute

public XmlWriter writeAttribute(java.lang.String localName,
                                java.lang.String value)
Write a XML attribute node. The attribute is attached to the closest open XML element that has been started with writeStartElement(String,String) or writeStartElement(String,String,String).

Specified by:
writeAttribute in interface XmlWriter
Parameters:
localName - The local name of the attribute
value - The value of this attribute
Returns:
The writer instance for further chaining

writeStartElement

public XmlWriter writeStartElement(java.lang.String prefix,
                                   java.lang.String localName,
                                   java.lang.String ns)
Begin a new XML element with given parameters. All subsequent output is attached to this element until writeEndElement() has been called or a new element has been started.

Specified by:
writeStartElement in interface XmlWriter
Parameters:
prefix - The namespace prefix to use for this element
localName - The local name of this element
ns - The namespace of this element
Returns:
The writer instance for further chaining

writeStartElement

public XmlWriter writeStartElement(java.lang.String localName,
                                   java.lang.String ns)
Begin a new XML element with given parameters.

All subsequent output is attached to this element until writeEndElement() has been called or a new element has been started.

The if the namespace is declared in an enclosing scope, the prefix is used from this declaration, otherwise the namespace is declared as default namespace for this element.

Specified by:
writeStartElement in interface XmlWriter
Parameters:
localName - The local name of this element
ns - The namespace of this element
Returns:
The writer instance for further chaining

writeStartElementCore

protected abstract void writeStartElementCore(java.lang.String prefix,
                                              java.lang.String localName,
                                              java.lang.String namespace)
The core method that actually writes the starting element.

Parameters:
prefix - The prefix or null.
localName - The name of the element.
namespace - The namespace uri of the element.

writeAttribute

public XmlWriter writeAttribute(java.lang.String prefix,
                                java.lang.String localName,
                                java.lang.String ns,
                                java.lang.String value)
Write a XML attribute node. The attribute is attached to the closest open XML element that has been started with writeStartElement(String,String) or writeStartElement(String,String,String).

Specified by:
writeAttribute in interface XmlWriter
Parameters:
prefix - The namespace prefix of the attribute
localName - The local name of the attribute
ns - The namespace URI of this attribute
value - The value of this attribute
Returns:
The writer instance for further chaining

writeAttributeCore

protected abstract void writeAttributeCore(java.lang.String prefix,
                                           java.lang.String localName,
                                           java.lang.String namespace,
                                           java.lang.String value)
The core method that actually writes an attribute.

Parameters:
prefix - The prefix or null.
localName - The name of the element.
namespace - The namespace uri of the element.
value - The value of the attribute.

writeEndElement

public XmlWriter writeEndElement()
Close a XML element previously opened with writeStartElement(String,String) or writeStartElement(String,String,String).

Specified by:
writeEndElement in interface XmlWriter
Returns:
The writer instance for further chaining

writeEndElementCore

protected abstract void writeEndElementCore()
The core method that actually writes the end element.


getNamespaceManager

public XmlNamespaceManager getNamespaceManager()
Gets the XmlNamespaceManager manager associated with this writer.

Specified by:
getNamespaceManager in interface XmlWriter
Returns:
The namespace manager.

createNamespaceManager

protected abstract XmlNamespaceManager createNamespaceManager()
Create a new XmlNamespaceManager instance that can be used by this writer instance

Returns:
a suitable XmlNamespaceManager implementation.

writeAttribute

public XmlWriter writeAttribute(GraphMLXmlAttribute attribute)
Write an XML attribute from the given attribute struct.

Specified by:
writeAttribute in interface XmlWriter
Parameters:
attribute - Encapsulates the current attribute values.
Returns:
The writer instance writer for writer chaining.

writeAttribute

public XmlWriter writeAttribute(java.lang.String localName,
                                double value)
Convenience method to directly write a double valued XML attribute.

Specified by:
writeAttribute in interface XmlWriter
Parameters:
localName - The local name of the attribute
value - The value of this attribute
Returns:
The writer instance for further chaining

writeAttribute

public XmlWriter writeAttribute(java.lang.String localName,
                                long value)
Convenience method to directly write a integer valued XML attribute.

Specified by:
writeAttribute in interface XmlWriter
Parameters:
localName - The local name of the attribute
value - The value of this attribute
Returns:
The writer instance for further chaining

writeAttribute

public XmlWriter writeAttribute(java.lang.String localName,
                                boolean value)
Convenience method to directly write a boolean valued XML attribute.

Specified by:
writeAttribute in interface XmlWriter
Parameters:
localName - The local name of the attribute
value - The value of this attribute
Returns:
The writer instance for further chaining

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.