|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cuba.wired.ddread.XmlReader
public class XmlReader
Convenience class for XML document analysis. This class in turn
uses an object implementing the XmlParserI
interface for
actually reading an XML file from an input stream. Although being
well-hidden in this package, this class is the basis for all XML
input processing within CUBA.
Field Summary | |
---|---|
static java.lang.String |
REVISION_ID
|
Constructor Summary | |
---|---|
XmlReader()
|
|
XmlReader(java.util.Properties props)
|
Method Summary | |
---|---|
static java.lang.String |
getAttribute(org.w3c.dom.Node node,
java.lang.String key)
|
java.lang.String |
getChild(org.w3c.dom.Node node,
java.lang.String key)
|
static org.w3c.dom.Node |
getChildNode(org.w3c.dom.Node node,
java.lang.String key)
|
static java.lang.String |
getElementName(org.w3c.dom.Element element)
|
static java.io.InputStream |
getJarEntry(java.lang.String jarFileName,
java.lang.String dirname,
java.lang.String filename)
|
static java.lang.String |
getMandatoryAttribute(org.w3c.dom.Node node,
java.lang.String key)
|
java.lang.String |
getMandatoryChild(org.w3c.dom.Node node,
java.lang.String key)
|
static org.w3c.dom.Node |
getMandatoryChildNode(org.w3c.dom.Node node,
java.lang.String key)
|
static java.lang.String |
getMandatoryFirstChildValue(org.w3c.dom.Node node)
|
static java.io.InputStream |
getResource(java.lang.String filename)
|
static org.w3c.dom.Element |
getRootElement(java.io.InputStream is)
|
static org.w3c.dom.Element |
getRootElement(java.io.InputStream is,
java.lang.String fileName)
Read an XML file from an input stream and return the root element of the DOM tree. |
static java.io.InputStream |
getSystemResource(java.lang.String dirname,
java.lang.String filename)
Load the specified resource from the current class loader. |
static java.net.URL |
getURL(java.lang.String filename)
|
static void |
setXmlParser(XmlParserI value)
Set the parser to use for reading an XML file from an input stream. |
static void |
setXmlParserType(java.lang.String typeName)
Set the parser type to instanciate for reading an XML file from an input stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String REVISION_ID
Constructor Detail |
---|
public XmlReader()
public XmlReader(java.util.Properties props)
Method Detail |
---|
public static void setXmlParser(XmlParserI value)
setXmlParserType(java.lang.String)
.
value
- a parser object implementing the XmlParserI
interface.public static void setXmlParserType(java.lang.String typeName)
XmlParserXerces
is used as a default.
typeName
- The fully qualified class name to instanciate. The class
must implement the XmlParserI
interface and provide a default
constructor.public static org.w3c.dom.Element getRootElement(java.io.InputStream is) throws InitException
InitException
public static org.w3c.dom.Element getRootElement(java.io.InputStream is, java.lang.String fileName) throws InitException
is
- The input stream to read fromfileName
- the name of the file represented be the input stream. Only
required for error message assembly
InitException
- if the instantiation of an XML parser failed or if
the input could not be parsed propperly.public static java.lang.String getMandatoryAttribute(org.w3c.dom.Node node, java.lang.String key) throws InitException
InitException
public static java.lang.String getAttribute(org.w3c.dom.Node node, java.lang.String key)
public java.lang.String getMandatoryChild(org.w3c.dom.Node node, java.lang.String key) throws InitException
InitException
public static java.lang.String getMandatoryFirstChildValue(org.w3c.dom.Node node) throws InitException
InitException
public java.lang.String getChild(org.w3c.dom.Node node, java.lang.String key)
public static org.w3c.dom.Node getMandatoryChildNode(org.w3c.dom.Node node, java.lang.String key) throws InitException
InitException
public static org.w3c.dom.Node getChildNode(org.w3c.dom.Node node, java.lang.String key)
public static java.lang.String getElementName(org.w3c.dom.Element element)
public static java.io.InputStream getJarEntry(java.lang.String jarFileName, java.lang.String dirname, java.lang.String filename) throws InitException
InitException
public static java.net.URL getURL(java.lang.String filename)
public static java.io.InputStream getResource(java.lang.String filename) throws java.io.IOException
java.io.IOException
public static java.io.InputStream getSystemResource(java.lang.String dirname, java.lang.String filename) throws InitException
dirname
- The resource' location in a directory structure. The
method tries both the directory name as is and in capital letters.
This turned out to be safer for directories like meta-inf.filename
- The actual resource to load.
InitException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |