|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.ac.starlink.votable.VOElementFactory
Provides static methods for constructing VOElements from a variety
of sources. A VOElement can be made either from an existing
DOM Element
or from some non-DOM source such
as a file, input stream, or SAX stream.
In the latter case a DOM is built using the
transformToDOM(javax.xml.transform.Source,boolean)
method with no validation. There are several optimisations performed
by this method which distinguish it from a DOM that you'd get
if you constructed it directly; the most important ones are that
the data-bearing parts (children of STREAM or TABLEDATA elements)
of the XML document are not included in the built DOM, and that
any reference to the VOTable DTD is resolved locally rather than
making a potential network connection. You almost certainly don't
need to worry about this; however if for some reason you want to
work on a 'normal' DOM, or if you want validation, you can construct
the DOM yourself and invoke one of the non-transforming
makeVOElement methods on the result.
The various makeVOElement methods may return an object of class
VOElement or of one of its subclasses, according to the
name of the element in question; specific subclasses are provided only
where some extra functionality is available, for instance the
TableElement.getData()
method of the TableElement class.
One upshot of this is that a tree of VOElements need not conform to
the VOTable DTD, elements of any name may be in it. Wherever an
element has a name which matches an element with specific significance
in a VOTable document however, such as "TABLE", it is handled
accordingly.
Constructor Summary | |
VOElementFactory()
|
Method Summary | |
static VOElement |
makeVOElement(DataSource datsrc)
Builds a custom DOM read from a DataSource and returns a new VOElement based on its top-level element. |
static VOElement |
makeVOElement(Document doc,
String systemId)
Returns a new VOElement based on a DOM Document node. |
static VOElement |
makeVOElement(DOMSource dsrc)
Returns a new VOElement based on a DOM source. |
static VOElement |
makeVOElement(Element el,
String systemId)
Returns a new VOElement based on a given DOM element. |
static VOElement |
makeVOElement(File file)
Builds a custom DOM read from a file and returns a new VOElement based on its top-level element. |
static VOElement |
makeVOElement(InputStream strm,
String systemId)
Builds a custom DOM from an input stream and returns a new VOElement based on its top-level element. |
static VOElement |
makeVOElement(Source xsrc)
Returns a new VOElement based on an XML Source. |
static VOElement |
makeVOElement(String uri)
Builds a custom DOM read from a URI and returns a new VOElement based on its top-level element. |
static VOElement |
makeVOElement(URL url)
Builds a custom DOM read from a URL and returns a new VOElement based on its top-level element. |
static DOMSource |
transformToDOM(Source xsrc,
boolean validate)
Gets a DOMSource from a generic XML Source. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public VOElementFactory()
Method Detail |
public static VOElement makeVOElement(Element el, String systemId)
el
- DOM element on which the new object will be basedsystemId
- the location of the documentpublic static VOElement makeVOElement(DOMSource dsrc)
dsrc
- DOM source representing an Element or Document node
public static VOElement makeVOElement(Source xsrc) throws SAXException, IOException
xsrc
- the XML source representing the element
SAXException
- if xsrc is not a DOM source
and there is a parse error transforming it to a DOM
IOException
- if xsrc is not a DOM source
and there is an I/O error transforming to a DOMpublic static VOElement makeVOElement(Document doc, String systemId)
doc
- DOM document nodesystemId
- the location of the document
public static VOElement makeVOElement(InputStream strm, String systemId) throws SAXException, IOException
strm
- stream containing XML datasystemId
- the location of the document
SAXException
IOException
public static VOElement makeVOElement(String uri) throws SAXException, IOException
uri
- location of the document
SAXException
IOException
public static VOElement makeVOElement(URL url) throws SAXException, IOException
url
- location of the document
SAXException
IOException
public static VOElement makeVOElement(File file) throws SAXException, IOException
file
- file containing XML document
SAXException
IOException
public static VOElement makeVOElement(DataSource datsrc) throws SAXException, IOException
datsrc
- data source containing XML
SAXException
IOException
public static DOMSource transformToDOM(Source xsrc, boolean validate) throws SAXException, IOException
xsrc
- input XML sourcevalidate
- whether to use a validating parser if the
transformation needs to be done (that is, if xsrc
is not already a DOMSource)
SAXException
IOException
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |