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

## com.thoughtworks.xstream.io.xml
Class AbstractXmlWriter

    java.lang.Object
      com.thoughtworks.xstream.io.xml.AbstractXmlWriter

All Implemented Interfaces:
  ExtendedHierarchicalStreamWriter, HierarchicalStreamWriter, XmlFriendlyWriter

Direct Known Subclasses:
  AbstractDocumentWriter, Dom4JXmlWriter, PrettyPrintWriter, SaxWriter, StaxWriter

    public abstract class AbstractXmlWriter

extends Object
implements ExtendedHierarchicalStreamWriter, XmlFriendlyWriter

Abstract base implementation of HierarchicalStreamWriter that provides common functionality to all XML-based writers.

Since:
  1.2
Author:
  Mauro Talevi

Constructor Summary
`protected` | `AbstractXmlWriter()`
`protected` | `AbstractXmlWriter(XmlFriendlyReplacer replacer)`

Method Summary
`String` | `escapeXmlName(String name)` Escapes XML name (node or attribute) to be XML-friendly
`void` | `startNode(String name, Class clazz)`
`HierarchicalStreamWriter` | `underlyingWriter()` Return the underlying HierarchicalStreamWriter implementation.

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

Methods inherited from interface com.thoughtworks.xstream.io.HierarchicalStreamWriter
`addAttribute, close, endNode, flush, setValue, startNode`

Constructor Detail

### AbstractXmlWriter

    protected AbstractXmlWriter()

### AbstractXmlWriter

    protected AbstractXmlWriter(XmlFriendlyReplacer replacer)

Method Detail

### startNode

    public void startNode(String name,
                          Class clazz)

  Specified by:
    `startNode` in interface `ExtendedHierarchicalStreamWriter`

### escapeXmlName

    public String escapeXmlName(String name)

  Escapes XML name (node or attribute) to be XML-friendly

  Specified by:
    `escapeXmlName` in interface `XmlFriendlyWriter`
  Parameters:
    `name` - the unescaped XML name
  Returns:
    An escaped name with original characters replaced

### underlyingWriter

    public HierarchicalStreamWriter underlyingWriter()

  Description copied from interface: `HierarchicalStreamWriter`
  Return the underlying HierarchicalStreamWriter implementation.

  If a Converter needs to access methods of a specific HierarchicalStreamWriter implementation that are not defined in the HierarchicalStreamWriter interface, it should call this method before casting. This is because the writer passed to the Converter is often wrapped/decorated by another implementation to provide additional functionality (such as XPath tracking).

  For example:

      MySpecificWriter mySpecificWriter = (MySpecificWriter)writer; // INCORRECT!
       mySpecificWriter.doSomethingSpecific();

      MySpecificWriter mySpecificWriter = (MySpecificWriter)writer.underlyingWriter();  // CORRECT!
       mySpecificWriter.doSomethingSpecific();

  Implementations of HierarchicalStreamWriter should return 'this', unless they are a decorator, in which case they should delegate to whatever they are wrapping.

  Specified by:
    `underlyingWriter` in interface `HierarchicalStreamWriter`

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

Copyright © 2004-2008 XStream. All Rights Reserved.