| java.lang.Object com.rimfaxe.xml.xmlreader.Node com.rimfaxe.xml.xmlreader.Document
Document | public class Document extends Node (Code) | | An XML Document.
Copyright (C) 2002 Hewlett-Packard Company.
This file is part of Sparta, an XML Parser, DOM, and XPath library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. This library
is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See Also: GNU Lesser General Public License version: $Date: 2003/01/27 23:30:58 $ $Revision: 1.8 $ author: Eamonn O'Brien-Strain See Also: org.w3c.dom.Document |
Inner Class :public class Index implements Observer | |
Inner Class :public interface Observer | |
Constructor Summary | |
| Document(String systemId) | public | Document() Create new empty in-memory Document with a null documentElement. |
Document | public Document()(Code) | | Create new empty in-memory Document with a null documentElement.
|
clone | public Object clone()(Code) | | Deep copy of this document. Any annotation is not copied.
|
equals | public boolean equals(Object thatO)(Code) | | Two documents are equal IFF their document elements are equal.
|
getDocumentElement | public Element getDocumentElement()(Code) | | root element of this DOM tree. |
getSystemId | public String getSystemId()(Code) | | the filename, URL, or other ID by which this document is known.Initialized to "MEMORY" for Document created with default constructor. |
notifyObservers | void notifyObservers()(Code) | | |
removeIndices | public void removeIndices()(Code) | | |
setDocumentElement | public void setDocumentElement(Element rootElement)(Code) | | Set the root element of this DOM tree.
|
setSystemId | public void setSystemId(String systemId)(Code) | | Parameters: systemId - the filename, URL, or other ID by which this document is known. |
xpathEnsure | public boolean xpathEnsure(String xpath) throws ParseException(Code) | | Just like Element.xpathEnsure, but also handles case of no documentElement.
|
xpathGetIndex | public Index xpathGetIndex(String xpath) throws ParseException(Code) | | For faster lookup by XPath return (creating if necessary) an
index. The xpath should be of the form "xp[@attrName]" where
xp is an xpath, not ending in a "[...]" predicate, that returns
a list of elements. Doing a get("foo") on the index is
equivalent to doing an
xpathSelectElement("xp[@attrName='foo']") on the document
except that it is faster ( O(1) as apposed to O(n) ).
EXAMPLE:
Enumeration leaders;
if( doc.xpathHasIndex( "/Team/Members[@firstName]" ){
//fast version
Document.Index index = doc.xpathGetIndex( "/Team/Members[@role]" );
leaders = index.get("leader");
}else
//slow version
leaders = doc.xpathSelectElement( "/Team/Members[@role='leader']" );
|
xpathSelectElement | public Element xpathSelectElement(String xpath) throws ParseException(Code) | | Select the first element that matches the absolute XPath
expression in this document, or null if
there is no match.
|
xpathSelectString | public String xpathSelectString(String xpath) throws ParseException(Code) | | Select the first element that matches the absolute XPath
expression in this document, or null if
there is no match.
|
|
|