com.sap.mw.jco

Class JCO.Record.XMLWriter

java.lang.Object
  extended bycom.sap.mw.jco.util.XMLWriterBase
      extended bycom.sap.mw.jco.JCO.Record.XMLWriter
Enclosing class:
JCO.Record

protected static class JCO.Record.XMLWriter
extends com.sap.mw.jco.util.XMLWriterBase

Converts a record to an XML document


Field Summary
static String DEFAULT_NAMESPACE
           
protected  String m_namespace_urn
           
protected  JCO.Record m_record
          The record which is being XML serialized
protected  String[] m_tags
          The array of escaped element tags
 
Fields inherited from class com.sap.mw.jco.util.XMLWriterBase
DOCUMENT_BUFFER_SIZE, ESCAPE_DEFAULT, ESCAPE_IDOC46, ESCAPE_IDOC610, ESCAPE_NONE, m_escape_mode, m_parent, m_trim_spaces, m_with_end_of_line, NAMESPACE_URN_SAP_RFC, NAMESPACE_URN_SOAP_UC
 
Constructor Summary
JCO.Record.XMLWriter()
          Create a new XMLWriter
JCO.Record.XMLWriter(JCO.Record.XMLWriter parent, Writer writer)
          Creates a new XMLWriter object
JCO.Record.XMLWriter(Writer writer)
          Creates a new XMLWriter object
 
Method Summary
static String createXMLDocument(JCO.Record record, String root_tag)
          Constructs an XML document from the passed record and returns it as a string.
static String createXMLDocument(JCO.Record record, String root_tag, String namespace, String namespace_urn)
          Constructs an XML document from the passed record and returns it as a string.
 JCO.Record.XMLWriter element(int index)
          Appends a field to the document
 JCO.Record.XMLWriter encode(JCO.Record record, String root_tag)
          Converts the record to an XML document and appends it to the document buffer
 JCO.Record.XMLWriter encode(JCO.Record record, String root_tag, String namespace, String namespace_urn)
          Converts the record to an XML document and appends it to the document buffer
static void writeXMLDocument(JCO.Record record, String root_tag, String namespace, String namespace_urn, Writer writer)
          Constructs an XML document from the passed record and writes it to the output stream using the specified character encoding.
static void writeXMLDocument(JCO.Record record, String root_tag, Writer writer)
          Constructs an XML document from the passed record and writes it to the output stream using the specified character encoding.
 
Methods inherited from class com.sap.mw.jco.util.XMLWriterBase
close, comment, content, content, content, content, element, element, element, element, empty, empty, ensureBufferCapacity, escape, etag, flush, getBuffer, getEncoding, getEndOfLineMode, getEscapeMode, getTrimTrailingSpaces, length, prolog, reset, setEndOfLineMode, setEscapeMode, setTrimTrailingSpaces, stag, stag, stag, toCharArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NAMESPACE

public static final String DEFAULT_NAMESPACE
See Also:
Constant Field Values

m_namespace_urn

protected String m_namespace_urn

m_tags

protected String[] m_tags
The array of escaped element tags


m_record

protected JCO.Record m_record
The record which is being XML serialized

Constructor Detail

JCO.Record.XMLWriter

public JCO.Record.XMLWriter()
Create a new XMLWriter


JCO.Record.XMLWriter

public JCO.Record.XMLWriter(Writer writer)
Creates a new XMLWriter object

Parameters:
writer - output writer where to write the generated document to

JCO.Record.XMLWriter

public JCO.Record.XMLWriter(JCO.Record.XMLWriter parent,
                            Writer writer)
Creates a new XMLWriter object

Parameters:
parent - the parental XMLWriter
writer - output writer where to write the generated document to
Method Detail

createXMLDocument

public static String createXMLDocument(JCO.Record record,
                                       String root_tag)
Constructs an XML document from the passed record and returns it as a string.

Parameters:
record - the record from which to construct the XML document
root_tag - the root tag or null
Returns:
the XML document as a java.lang.String

createXMLDocument

public static String createXMLDocument(JCO.Record record,
                                       String root_tag,
                                       String namespace,
                                       String namespace_urn)
Constructs an XML document from the passed record and returns it as a string.

Parameters:
record - the record from which to construct the XML document
root_tag - the root tag or null
namespace - the namespace or null if not required
namespace_urn - the urn associated with the namespace or null if not defined
Returns:
the XML document as a java.lang.String

writeXMLDocument

public static void writeXMLDocument(JCO.Record record,
                                    String root_tag,
                                    Writer writer)
                             throws IOException
Constructs an XML document from the passed record and writes it to the output stream using the specified character encoding.

Parameters:
record - the record from which to construct the XML document
root_tag - the root tag or null
writer - output writer where to write the generated document to
Throws:
IOException

writeXMLDocument

public static void writeXMLDocument(JCO.Record record,
                                    String root_tag,
                                    String namespace,
                                    String namespace_urn,
                                    Writer writer)
                             throws IOException
Constructs an XML document from the passed record and writes it to the output stream using the specified character encoding.

Parameters:
record - the record from which to construct the XML document
root_tag - the root tag or null
namespace - the namespace or null if not required
namespace_urn - the urn associated with the namespace or null if not defined
writer - output writer where to write the generated document to
Throws:
IOException

encode

public JCO.Record.XMLWriter encode(JCO.Record record,
                                   String root_tag)
                            throws IOException
Converts the record to an XML document and appends it to the document buffer

Parameters:
record - the record which to append to the XML document
root_tag - the root tag or null
Throws:
IOException - thrown if an input/output error occured
JCO.Exception - if an other JCO related error occured

encode

public JCO.Record.XMLWriter encode(JCO.Record record,
                                   String root_tag,
                                   String namespace,
                                   String namespace_urn)
                            throws IOException
Converts the record to an XML document and appends it to the document buffer

Parameters:
record - the record which to append to the XML document
root_tag - the root tag or null
Throws:
IOException - thrown if an input/output error occured
JCO.Exception - if an other JCO related error occured

element

public JCO.Record.XMLWriter element(int index)
                             throws IOException
Appends a field to the document

Parameters:
index - the index of the field to append
Throws:
IOException - thrown if an input/output error occured
JCO.Exception - if an other JCO related error occured


Copyright 2006 SAP AG Complete Copyright Notice