Project JXTA

net.jxta.impl.document
Class LiteXMLDocument

java.lang.Object
  extended bynet.jxta.impl.document.TextElementCommon
      extended bynet.jxta.impl.document.XMLElementCommon
          extended bynet.jxta.impl.document.LiteXMLElement
              extended bynet.jxta.impl.document.LiteXMLDocument
All Implemented Interfaces:
Attributable, Document, Element, StructuredDocument, StructuredTextDocument, TextDocument, TextDocumentCommon, TextElement, XMLDocument, XMLDocumentCommon, XMLElement

public class LiteXMLDocument
extends LiteXMLElement
implements XMLDocumentCommon

This class is an implementation of the StructuredDocument interface using a simplified XML implementation.


Nested Class Summary
 
Nested classes inherited from class net.jxta.impl.document.LiteXMLElement
LiteXMLElement.charRange, LiteXMLElement.tagRange
 
Nested classes inherited from class net.jxta.impl.document.XMLDocumentCommon
TextDocumentCommon.Utils
 
Field Summary
(package private)  StringBuffer docContent
          The actual document contents.
static StructuredDocumentFactory.TextInstantiator INSTANTIATOR
          The instantiator for instances of our documents.
 
Fields inherited from class net.jxta.impl.document.LiteXMLElement
doc, loc, paranoidConsistencyChecking, parent, verboseLogging
 
Constructor Summary
(package private) LiteXMLDocument(MimeMediaType mimeType, InputStream in)
          Creates new LiteXMLDocument
(package private) LiteXMLDocument(MimeMediaType mimeType, Reader in)
          Creates new LiteXMLDocument
(package private) LiteXMLDocument(MimeMediaType mimeType, String type)
          Creates new LiteXMLDocument
(package private) LiteXMLDocument(MimeMediaType mimeType, String type, String textValue)
          Creates new LiteXMLDocument with a textValue in the root element
 
Method Summary
protected  TextElement createElement(LiteXMLElement.tagRange loc)
          Create a new text element as a sub-range of this document.
 Element createElement(Object key)
          
 Element createElement(Object key, Object val)
          
 TextElement createElement(String name)
          
 TextElement createElement(String name, String val)
          
protected  LiteXMLElement.charRange getDocType(StringBuffer source, boolean wholeElement)
           
(package private)  LiteXMLDocument getDocument()
          The document we are a part of.
 String getFileExtension()
          
 MimeMediaType getMimeType()
          
 Reader getReader()
          
 StructuredDocument getRoot()
          
 InputStream getStream()
          
protected  void init(Reader in)
          Initialises LiteXMLDocument.
 void sendToStream(OutputStream stream)
          
 void sendToWriter(Writer writer)
          
 String toString()
          

A toString implementation for debugging purposes.

 
Methods inherited from class net.jxta.impl.document.LiteXMLElement
addAttribute, addAttribute, addChildTags, adjustLocations, appendChild, checkConsistency, decodeEscaped, encodeEscaped, equals, getAttribute, getAttributeLoc, getAttributes, getChildren, getChildren, getName, getParent, getTagRanges, getTextValue, getTextValue, printNice
 
Methods inherited from class net.jxta.impl.document.TextElementCommon
appendChild, getChildren, getKey, getValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.jxta.document.Element
appendChild, getChildren, getChildren, getKey, getParent, getValue
 
Methods inherited from interface net.jxta.document.TextElement
appendChild, getChildren, getName, getTextValue
 
Methods inherited from interface net.jxta.document.Attributable
addAttribute, addAttribute, getAttribute, getAttributes
 

Field Detail

INSTANTIATOR

public static final StructuredDocumentFactory.TextInstantiator INSTANTIATOR
The instantiator for instances of our documents.


docContent

final StringBuffer docContent
The actual document contents.

Constructor Detail

LiteXMLDocument

LiteXMLDocument(MimeMediaType mimeType,
                String type)
Creates new LiteXMLDocument


LiteXMLDocument

LiteXMLDocument(MimeMediaType mimeType,
                String type,
                String textValue)
Creates new LiteXMLDocument with a textValue in the root element


LiteXMLDocument

LiteXMLDocument(MimeMediaType mimeType,
                InputStream in)
          throws IOException
Creates new LiteXMLDocument


LiteXMLDocument

LiteXMLDocument(MimeMediaType mimeType,
                Reader in)
          throws IOException
Creates new LiteXMLDocument

Method Detail

toString

public String toString()

A toString implementation for debugging purposes.

Specified by:
toString in interface TextDocument
Overrides:
toString in class LiteXMLElement

getMimeType

public MimeMediaType getMimeType()

Specified by:
getMimeType in interface Document

getFileExtension

public String getFileExtension()

Specified by:
getFileExtension in interface Document

createElement

public Element createElement(Object key)

Specified by:
createElement in interface StructuredDocument

createElement

public Element createElement(Object key,
                             Object val)

Specified by:
createElement in interface StructuredDocument

createElement

public TextElement createElement(String name)

Specified by:
createElement in interface StructuredTextDocument

createElement

public TextElement createElement(String name,
                                 String val)

Specified by:
createElement in interface StructuredTextDocument

createElement

protected TextElement createElement(LiteXMLElement.tagRange loc)
Create a new text element as a sub-range of this document.

Parameters:
loc - The document range for the new element.
Returns:
The newly created element.

getReader

public Reader getReader()

Specified by:
getReader in interface TextDocument

getRoot

public StructuredDocument getRoot()

Specified by:
getRoot in interface Element
Overrides:
getRoot in class LiteXMLElement

getStream

public InputStream getStream()
                      throws IOException

Specified by:
getStream in interface Document
Throws:
IOException

sendToWriter

public void sendToWriter(Writer writer)
                  throws IOException

Specified by:
sendToWriter in interface TextDocument
Throws:
IOException

sendToStream

public void sendToStream(OutputStream stream)
                  throws IOException

Specified by:
sendToStream in interface Document
Throws:
IOException

init

protected void init(Reader in)
             throws IOException
Initialises LiteXMLDocument.

Throws:
IOException

getDocType

protected LiteXMLElement.charRange getDocType(StringBuffer source,
                                              boolean wholeElement)

getDocument

LiteXMLDocument getDocument()
The document we are a part of.

Overrides:
getDocument in class LiteXMLElement

JXTA J2SE