org.mmbase.util
Class XMLBasicReader

java.lang.Object
  |
  +--org.mmbase.util.XMLBasicReader
Direct Known Subclasses:
MagicFile.MagicXMLReader, XMLBuilderReader, XMLMMLanguageReader, XMLModuleReader

public class XMLBasicReader
extends java.lang.Object

Version:
$Id: XMLBasicReader.java,v 1.10 2001/07/11 13:22:40 pierre Exp $ $Log: XMLBasicReader.java,v $ Revision 1.10 2001/07/11 13:22:40 pierre pierre: removed comments. usejavaxXML is still false. Maybe make this configurable? Revision 1.9 2001/07/09 19:24:07 eduard eduard: added a static function, which provides a DocumentBuilder object, so that there is a handle, to get all xml documents in the same way. Also some code, to enable it for old stuff, but i commented it out, since i didnt dare to change the original code. Revision 1.8 2001/05/18 11:46:14 daniel Added printout of filename on error Revision 1.7 2001/03/23 11:07:16 vpro Enhanced error message CV: ---------------------------------------------------------------------- Revision 1.6 2000/12/20 00:24:53 daniel changed xml parser to file:/// for new xerces/win98/win2000 Revision 1.5 2000/08/18 19:43:45 case cjr: Added getChildElements(element,tag) method to get obtain all child elements with a certain tag. Revision 1.4 2000/08/17 21:16:00 case cjr: returned value for non-set attributes now is "" (should it be null?)
Author:
cjr@dds.nl

Constructor Summary
XMLBasicReader(java.lang.String path)
           
 
Method Summary
 java.util.Enumeration getChildElements(org.w3c.dom.Element e)
           
 java.util.Enumeration getChildElements(org.w3c.dom.Element e, java.lang.String tag)
           
static javax.xml.parsers.DocumentBuilder getDocumentBuilder()
           
 java.lang.String getElementAttributeValue(org.w3c.dom.Element e, java.lang.String attr)
           
 org.w3c.dom.Element getElementByPath(org.w3c.dom.Element e, java.lang.String path)
           
 org.w3c.dom.Element getElementByPath(java.lang.String path)
           
 java.lang.String getElementName(org.w3c.dom.Element e)
           
 java.lang.String getElementValue(org.w3c.dom.Element e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLBasicReader

public XMLBasicReader(java.lang.String path)
Method Detail

getDocumentBuilder

public static javax.xml.parsers.DocumentBuilder getDocumentBuilder()

getElementByPath

public org.w3c.dom.Element getElementByPath(java.lang.String path)
Parameters:
path - Dot-separated list of tags describing path from root element to requested element. NB the path starts with the name of the root element.
Returns:
Leaf element of the path

getElementByPath

public org.w3c.dom.Element getElementByPath(org.w3c.dom.Element e,
                                            java.lang.String path)
Parameters:
e - Element from which the "relative" path is starting. NB the path starts with the name of the root element.
path - Dot-separated list of tags describing path from root element to requested element
Returns:
Leaf element of the path

getElementValue

public java.lang.String getElementValue(org.w3c.dom.Element e)
Parameters:
e - Element
Returns:
Text value of element

getElementName

public java.lang.String getElementName(org.w3c.dom.Element e)
Parameters:
e - Element
Returns:
Tag name of the element

getElementAttributeValue

public java.lang.String getElementAttributeValue(org.w3c.dom.Element e,
                                                 java.lang.String attr)
Parameters:
e - Element
attr - Attribute name
Returns:
Value of attribute

getChildElements

public java.util.Enumeration getChildElements(org.w3c.dom.Element e)
Parameters:
e - Element
Returns:
Enumeration of child elements

getChildElements

public java.util.Enumeration getChildElements(org.w3c.dom.Element e,
                                              java.lang.String tag)
Parameters:
e - Element
Returns:
Enumeration of child elements with the given tag


MMBase 2001