org.apache.archiva.xml
Class XMLReader

java.lang.Object
  extended by org.apache.archiva.xml.XMLReader

public class XMLReader
extends Object

XMLReader - a set of common xml utility methods for reading content out of an xml file.


Field Summary
private  org.dom4j.Document document
           
private  String documentType
           
private  Map<String,String> namespaceMap
           
private  URL xmlUrl
           
 
Constructor Summary
XMLReader(String type, File file)
           
XMLReader(String type, URL url)
           
 
Method Summary
 void addNamespaceMapping(String elementName, String uri)
           
private  org.dom4j.XPath createXPath(String xpathExpr)
           
 String getDefaultNamespaceURI()
           
 org.dom4j.Element getElement(String xpathExpr)
           
 List<org.dom4j.Element> getElementList(String xpathExpr)
           
 List<String> getElementListText(String xpathExpr)
           
 String getElementText(org.dom4j.Node context, String xpathExpr)
           
 String getElementText(String xpathExpr)
           
 boolean hasElement(String xpathExpr)
           
private  void init(String type, URL url)
           
 void removeNamespaces()
          Remove namespaces from entire document.
 void removeNamespaces(org.dom4j.Element elem)
          Remove namespaces from element recursively.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlUrl

private URL xmlUrl

documentType

private String documentType

document

private org.dom4j.Document document

namespaceMap

private Map<String,String> namespaceMap
Constructor Detail

XMLReader

public XMLReader(String type,
                 File file)
          throws XMLException
Throws:
XMLException

XMLReader

public XMLReader(String type,
                 URL url)
          throws XMLException
Throws:
XMLException
Method Detail

init

private void init(String type,
                  URL url)
           throws XMLException
Throws:
XMLException

getDefaultNamespaceURI

public String getDefaultNamespaceURI()

addNamespaceMapping

public void addNamespaceMapping(String elementName,
                                String uri)

getElement

public org.dom4j.Element getElement(String xpathExpr)
                             throws XMLException
Throws:
XMLException

createXPath

private org.dom4j.XPath createXPath(String xpathExpr)

hasElement

public boolean hasElement(String xpathExpr)
                   throws XMLException
Throws:
XMLException

removeNamespaces

public void removeNamespaces()
Remove namespaces from entire document.


removeNamespaces

public void removeNamespaces(org.dom4j.Element elem)
Remove namespaces from element recursively.


getElementText

public String getElementText(org.dom4j.Node context,
                             String xpathExpr)
                      throws XMLException
Throws:
XMLException

getElementText

public String getElementText(String xpathExpr)
                      throws XMLException
Throws:
XMLException

getElementList

public List<org.dom4j.Element> getElementList(String xpathExpr)
                                       throws XMLException
Throws:
XMLException

getElementListText

public List<String> getElementListText(String xpathExpr)
                                throws XMLException
Throws:
XMLException


Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.