|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.novell.nds.dirxml.driver.XmlDocument
The XmlDocument class wraps an XML document and allows that document to be
accessed via DOM, SAX (v1), or a serialized form.
| Field Summary | |
protected byte[] |
documentBytes
|
protected Document |
documentDOM
|
protected String |
documentString
|
static int |
DOM
Value returned from getSource() indicating that the XML data was
set using a DOM Document. |
protected boolean |
indent
|
protected InputSource |
inputSource
|
static int |
NOT_SET
Value returned from getSource() indicating that the XML data has
not been set in the XmlDocument instance. |
static int |
SAX
Value returned from getSource() indicating that the XML data was
set using a SAX Parser and InputSource. |
protected Parser |
saxParser
|
static int |
SERIALIZED
Value returned from getSource() indicating that the XML data was
set using a String or a byte array. |
protected int |
source
|
protected XMLParser |
xmlDocParser
|
| Constructor Summary | |
XmlDocument()
Construct an empty XML document |
|
XmlDocument(byte[] document)
Construct an XML document based on an XML byte array |
|
XmlDocument(Document document)
Construct an XML document based on a DOM document |
|
XmlDocument(Parser parser,
InputSource inputSource)
Construct an XML document based on a SAX Parser and InputSource |
|
XmlDocument(String document)
Construct an XML document based on an XML string |
|
| Method Summary | |
Document |
getDocument()
get document contents as a DOM document |
byte[] |
getDocumentBytes(String encoding)
get document contents as a byte array |
InputSource |
getDocumentInputSource()
Get SAX InputSource to use with SAX Parser returned from getSAX(). |
Document |
getDocumentNS()
get document contents as a DOM Level 2 document with namespace information. |
Parser |
getDocumentSAX()
get document contents as via a SAX Parser |
String |
getDocumentString()
get document contents as a String |
boolean |
getIndent()
Get if whitespace may be added for formatting when serializing document |
XMLParser |
getParser()
get the parser used by this document |
Vector |
getParserErrorMsgs()
get any pending parser error messages |
String |
getParserErrorMsgString()
get any pending parser error messages, concatenated into one string and separated by a newline |
int |
getSource()
Return the original source of the XML contained in this instance. |
XmlWriter |
getXmlWriter(OutputStream outputStream,
String encoding)
Return an XmlWriter instance suitable for serializing the document |
XmlWriter |
getXmlWriter(Writer writer)
Return an XmlWriter instance suitable for serializing the document |
void |
readDocument(InputStream document)
read document contents from an InputStream |
void |
readDocument(InputStream document,
String documentURI)
|
void |
readDocument(Reader document)
read document contents from a Reader |
void |
readDocument(String document)
read document contents from a URI string |
void |
readDocument(URL document)
read document contents from a URL |
void |
readExternal(ObjectInput in)
Mandatory readExternal method. |
void |
setDocument(byte[] document)
set document contents based an XML byte array |
void |
setDocument(Document document)
set document contents based a DOM document |
void |
setDocument(Parser parser,
InputSource inputSource)
|
void |
setDocument(String document)
set document contents based an XML string |
void |
setIndent(boolean indent)
Add whitespace for formatting to serialized document |
void |
writeDocument(OutputStream document,
String encoding)
write document content to an OutputStream |
void |
writeDocument(Writer document)
write document contents to Writer |
void |
writeExternal(ObjectOutput out)
Mandatory writeExernal method for object Serialization. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int NOT_SET
getSource() indicating that the XML data has
not been set in the XmlDocument instance.
public static final int DOM
getSource() indicating that the XML data was
set using a DOM Document.
public static final int SAX
getSource() indicating that the XML data was
set using a SAX Parser and InputSource.
public static final int SERIALIZED
getSource() indicating that the XML data was
set using a String or a byte array.
protected Document documentDOM
protected String documentString
protected byte[] documentBytes
protected boolean indent
protected Parser saxParser
protected InputSource inputSource
protected int source
protected XMLParser xmlDocParser
| Constructor Detail |
public XmlDocument()
public XmlDocument(Document document)
document - the documentpublic XmlDocument(String document)
document - the documentpublic XmlDocument(byte[] document)
document - the document
public XmlDocument(Parser parser,
InputSource inputSource)
parser - The SAX Parser interfaceinputSource - The SAX InputSource interface| Method Detail |
public int getSource()
NOT_SET, DOM, SAX, or SERIALIZED.public void setDocument(Document document)
document - the documentpublic void setDocument(String document)
document - the documentpublic void setDocument(byte[] document)
document - the document
public void setDocument(Parser parser,
InputSource inputSource)
public void readDocument(InputStream document)
document - the document
public void readDocument(InputStream document,
String documentURI)
throws MalformedURLException
MalformedURLExceptionpublic void readDocument(Reader document)
document - the document
public void readDocument(URL document)
throws IOException
document - the document URL
IOException
public void readDocument(String document)
throws IOException
document - the document URI string
IOException
public void writeDocument(OutputStream document,
String encoding)
throws IOException,
UnsupportedEncodingException
document - the documentencoding - desired encoding
IOException
UnsupportedEncodingException
public void writeDocument(Writer document)
throws IOException
document - the document
IOExceptionpublic Document getDocument()
public Document getDocumentNS()
public String getDocumentString()
String
public byte[] getDocumentBytes(String encoding)
byte array
encoding - desired encoding
public Parser getDocumentSAX()
public InputSource getDocumentInputSource()
getSAX().
InputSource to use with the returned SAX
Parser from getSAX().
public XmlWriter getXmlWriter(OutputStream outputStream,
String encoding)
throws UnsupportedEncodingException
outputStream - The OutputStream to which to write.encoding - The character encoding to use in writing to the OutputStream
UnsupportedEncodingExceptionpublic XmlWriter getXmlWriter(Writer writer)
writer - A Writer instance to which to serialize the documentpublic XMLParser getParser()
public Vector getParserErrorMsgs()
public String getParserErrorMsgString()
public void setIndent(boolean indent)
indent - True if whitespace may be added to serialized documentpublic boolean getIndent()
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizableIOException
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizableIOException
ClassNotFoundException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||