org.openide.loaders
Class XMLDataObject.Util

java.lang.Object
  |
  +--org.openide.loaders.XMLDataObject.Util
Enclosing class:
XMLDataObject

public static class XMLDataObject.Util
extends Object

Utility class collecting library methods related to XML processing not to XMLDataObject directly.


Constructor Summary
XMLDataObject.Util()
           
 
Method Summary
static org.w3c.dom.Document createDocument()
          Creates empty DOM Document using JAXP factoring.
static org.xml.sax.XMLReader createXMLReader()
           
static org.xml.sax.XMLReader createXMLReader(boolean validate)
           
static org.xml.sax.XMLReader createXMLReader(boolean validate, boolean ns)
          Factory SAX XMLReader that can be used to parse XML files.
static org.w3c.dom.Document parse(org.xml.sax.InputSource in, org.xml.sax.ErrorHandler eh, boolean validate)
          Factory a DocumentBuilder and let it create a org.w3c.dom.Document This method takes URL.
static void write(org.w3c.dom.Document doc, OutputStream out, String enc)
          Write Document into OutputStream using given encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDataObject.Util

public XMLDataObject.Util()
Method Detail

createXMLReader

public static org.xml.sax.XMLReader createXMLReader()
Returns:
createXMLReader(false, false);

createXMLReader

public static org.xml.sax.XMLReader createXMLReader(boolean validate)
Parameters:
validate - if true validating parser is returned
Returns:
createXMLReader(validate, false);

createXMLReader

public static org.xml.sax.XMLReader createXMLReader(boolean validate,
                                                    boolean ns)
Factory SAX XMLReader that can be used to parse XML files. The factory is created according to javax.xml.parsers.SAXParserFactory property. The parser has set entity resolver to system entity resolver chain.
Parameters:
validate - if true validating parser is returned
ns - if true namespace aware parser is returned
Returns:
XMLReader or null if given reader can not be created

write

public static void write(org.w3c.dom.Document doc,
                         OutputStream out,
                         String enc)
                  throws IOException
Write Document into OutputStream using given encoding. It is a shortcut for writing configurations etc. It guarantee just that data will be written. Structure and indentation may change.
Parameters:
doc - DOM Document to be written
out - data sink
enc - - XML defined encoding name (i.e. IANA defined, one of UTF-8, UNICODE, ASCII).

createDocument

public static org.w3c.dom.Document createDocument()
Creates empty DOM Document using JAXP factoring.
Returns:
Document or null on problems with JAXP factoring

parse

public static org.w3c.dom.Document parse(org.xml.sax.InputSource in,
                                         org.xml.sax.ErrorHandler eh,
                                         boolean validate)
                                  throws IOException,
                                         org.xml.sax.SAXException
Factory a DocumentBuilder and let it create a org.w3c.dom.Document This method takes URL. After successful finish the document tree is returned. A parser producing the Document has set entity resolver to system entity resolver chain.
Parameters:
in - the parser input (for URL users use: new InputSource(url.toExternalForm())
eh - error handler to notify about exception
validate - if true validating parser is used
Returns:
org.w3c.dom.Document or null if a parsing error occures


Built on February 22 2001.  |  Portions Copyright 1997-2000 Sun Microsystems, Inc. All rights reserved.