|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.xerces.dom.NodeImpl
org.apache.xerces.dom.ChildNode
org.apache.xerces.dom.ParentNode
org.apache.xerces.dom.CoreDocumentImpl
org.apache.xerces.dom.DocumentImpl
org.odftoolkit.odfdom.pkg.OdfFileDom
public class OdfFileDom
The DOM representation of an XML file within the ODF document.
| Field Summary | |
|---|---|
protected Map<Node,com.hp.hpl.jena.rdf.model.Model> |
inCententMetadataCache
The cache of in content metadata: key: a Node in the dom ; value: the Jena RDF model of triples of the Node |
protected Map<String,Set<String>> |
mDuplicatePrefixesByUri
Contains only the duplicate prefix. |
protected OdfPackage |
mPackage
|
protected OdfPackageDocument |
mPackageDocument
|
protected String |
mPackagePath
|
protected Map<String,String> |
mPrefixByUri
|
protected Map<String,String> |
mUriByPrefix
|
protected XPath |
mXPath
|
protected JenaSink |
sink
|
| Fields inherited from class org.apache.xerces.dom.DocumentImpl |
|---|
eventListeners, iterators, mutationEvents, ranges |
| Fields inherited from class org.apache.xerces.dom.CoreDocumentImpl |
|---|
actualEncoding, allowGrammarAccess, changes, docElement, docType, encoding, errorChecking, fDocumentURI, identifiers, standalone, userData, version, xmlVersionChanged |
| Fields inherited from class org.apache.xerces.dom.ParentNode |
|---|
firstChild, fNodeListCache, ownerDocument |
| Fields inherited from class org.apache.xerces.dom.ChildNode |
|---|
nextSibling, previousSibling |
| Constructor Summary | |
|---|---|
protected |
OdfFileDom(OdfPackageDocument packageDocument,
String packagePath)
Creates the DOM representation of an XML file of an Odf document. |
protected |
OdfFileDom(OdfPackage pkg,
String packagePath)
Creates the DOM representation of an XML file of an Odf document. |
| Method Summary | ||
|---|---|---|
OdfAttribute |
createAttribute(String name)
Create the ODF attribute with its name |
|
OdfAttribute |
createAttributeNS(OdfName name)
Create the ODF attribute with ODF name |
|
OdfAttribute |
createAttributeNS(String nsuri,
String qname)
Create the ODF attribute with namespace uri and qname |
|
OdfElement |
createElement(String name)
Create ODF element with namespace uri and qname |
|
OdfElement |
createElementNS(OdfName name)
Create ODF element with ODF name |
|
OdfElement |
createElementNS(String nsuri,
String qname)
Create ODF element with namespace uri and qname |
|
com.hp.hpl.jena.rdf.model.Model |
getBookmarkRDFMetadata()
|
|
OdfPackageDocument |
getDocument()
Retrieves the OdfPackageDocument of the XML file. |
|
Map<Node,com.hp.hpl.jena.rdf.model.Model> |
getInContentMetadataCache()
Get in-content metadata cache model |
|
String |
getNamespaceURI(String prefix)
Get Namespace URI bound to a prefix in the current scope (the XML file). |
|
String |
getPackagePath()
Retrieves the String of Package Path |
|
String |
getPrefix(String namespaceURI)
Get prefix bound to Namespace URI in the current scope (the XML file). |
|
Iterator<String> |
getPrefixes(String namespaceURI)
Get all prefixes bound to a Namespace URI in the current scope. |
|
OdfElement |
getRootElement()
Retrieves the ODF root element. |
|
JenaSink |
getSink()
The end users needn't to care of this method, which is used by BookmarkRDFMetadataExtractor |
|
XPath |
getXPath()
Create an XPath instance to select one or more nodes from an ODF document. |
|
protected void |
initialize()
|
|
static OdfFileDom |
newFileDom(OdfPackageDocument packageDocument,
String packagePath)
|
|
static OdfFileDom |
newFileDom(OdfPackage pkg,
String packagePath)
|
|
|
newOdfElement(Class<T> clazz)
|
|
OdfNamespace |
setNamespace(NamespaceName name)
Adds a new Namespace to the DOM. |
|
OdfNamespace |
setNamespace(String prefix,
String uri)
Adds a new Namespace to the DOM. |
|
String |
toString()
|
|
void |
updateInContentMetadataCache(Node node)
Update the in content metadata of the node. |
|
| Methods inherited from class org.apache.xerces.dom.DocumentImpl |
|---|
addEventListener, cloneNode, copyEventListeners, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, dispatchingEventToSubtree, getEventListeners, getImplementation, removeEventListener, saveEnclosingAttr, setEventListeners |
| Methods inherited from class org.apache.xerces.dom.ParentNode |
|---|
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, hasChildNodes, isEqualNode, item, normalize, setOwnerDocument, setReadOnly, synchronizeChildren |
| Methods inherited from class org.apache.xerces.dom.ChildNode |
|---|
getNextSibling, getParentNode, getPreviousSibling |
| Methods inherited from class org.apache.xerces.dom.NodeImpl |
|---|
addEventListener, appendChild, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getContainer, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, getUserData, getUserDataRecord, hasAttributes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setPrefix, setUserData, setUserData, synchronizeData |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.w3c.dom.Node |
|---|
appendChild, compareDocumentPosition, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, setNodeValue, setPrefix, setUserData |
| Field Detail |
|---|
protected String mPackagePath
protected OdfPackageDocument mPackageDocument
protected OdfPackage mPackage
protected XPath mXPath
protected Map<String,String> mUriByPrefix
protected Map<String,String> mPrefixByUri
protected Map<String,Set<String>> mDuplicatePrefixesByUri
protected Map<Node,com.hp.hpl.jena.rdf.model.Model> inCententMetadataCache
protected JenaSink sink
| Constructor Detail |
|---|
protected OdfFileDom(OdfPackageDocument packageDocument,
String packagePath)
packageDocument - the document the XML files belongs topackagePath - the internal package path to the XML file
protected OdfFileDom(OdfPackage pkg,
String packagePath)
pkg - the package the XML files belongs topackagePath - the internal package path to the XML file| Method Detail |
|---|
public static OdfFileDom newFileDom(OdfPackageDocument packageDocument,
String packagePath)
public static OdfFileDom newFileDom(OdfPackage pkg,
String packagePath)
protected void initialize()
public OdfPackageDocument getDocument()
OdfPackageDocument of the XML file.
A package document is usually represented as a directory with a mediatype.
public String getPackagePath()
String of Package Path
public OdfElement getRootElement()
OdfElement being the root of the document.
public OdfElement createElement(String name)
throws DOMException
createElement in interface DocumentcreateElement in class CoreDocumentImplname - The element name
DOMException
public OdfElement createElementNS(String nsuri,
String qname)
throws DOMException
createElementNS in interface DocumentcreateElementNS in class CoreDocumentImplnsuri - The namespace uriqname - The element qname
DOMException
public OdfElement createElementNS(OdfName name)
throws DOMException
name - The OdfName
OdfElement
DOMException
public OdfAttribute createAttribute(String name)
throws DOMException
createAttribute in interface DocumentcreateAttribute in class CoreDocumentImplname - the attribute qname
OdfAttribute
DOMException
public OdfAttribute createAttributeNS(String nsuri,
String qname)
throws DOMException
createAttributeNS in interface DocumentcreateAttributeNS in class CoreDocumentImplnsuri - The namespace uriqname - the attribute qname
OdfAttribute
DOMException
public OdfAttribute createAttributeNS(OdfName name)
throws DOMException
name - The OdfName
OdfAttribute
DOMExceptionpublic <T extends OdfElement> T newOdfElement(Class<T> clazz)
public String toString()
toString in class NodeImplpublic XPath getXPath()
public String getNamespaceURI(String prefix)
Get Namespace URI bound to a prefix in the current scope (the XML file).
When requesting a Namespace URI by prefix, the following table describes the returned Namespace URI value for all possible prefix values:
getNamespaceURI(prefix)
return value for specified prefixes
|
|
| prefix parameter | Namespace URI return value |
DEFAULT_NS_PREFIX ("") |
default Namespace URI in the current scope or
when there is no default Namespace URI in the current scope |
| bound prefix | Namespace URI bound to prefix in current scope |
| unbound prefix |
|
XMLConstants.XML_NS_PREFIX ("xml") |
XMLConstants.XML_NS_URI
("http://www.w3.org/XML/1998/namespace") |
XMLConstants.XMLNS_ATTRIBUTE ("xmlns") |
XMLConstants.XMLNS_ATTRIBUTE_NS_URI
("http://www.w3.org/2000/xmlns/") |
null |
IllegalArgumentException is thrown |
getNamespaceURI in interface NamespaceContextprefix - prefix to look up
IllegalArgumentException - When prefix is
nullpublic String getPrefix(String namespaceURI)
Get prefix bound to Namespace URI in the current scope (the XML file).
Multiple prefixes bound to Namespace URI will be normalized to the first prefix defined.
When requesting a prefix by Namespace URI, the following table describes the returned prefix value for all Namespace URI values:
getPrefix(namespaceURI) return value for
specified Namespace URIs
|
|
|---|---|
| Namespace URI parameter | prefix value returned |
| <default Namespace URI> | XMLConstants.DEFAULT_NS_PREFIX ("")
|
| bound Namespace URI | prefix bound to Namespace URI in the current scope, if multiple prefixes are bound to the Namespace URI in the current scope, a single arbitrary prefix, whose choice is implementation dependent, is returned |
| unbound Namespace URI | null |
XMLConstants.XML_NS_URI
("http://www.w3.org/XML/1998/namespace") |
XMLConstants.XML_NS_PREFIX ("xml") |
XMLConstants.XMLNS_ATTRIBUTE_NS_URI
("http://www.w3.org/2000/xmlns/") |
XMLConstants.XMLNS_ATTRIBUTE ("xmlns") |
null |
IllegalArgumentException is thrown |
getPrefix in interface NamespaceContextnamespaceURI - URI of Namespace to lookup
IllegalArgumentException - When namespaceURI is
nullpublic Iterator<String> getPrefixes(String namespaceURI)
Get all prefixes bound to a Namespace URI in the current scope. (the XML file)
NOTE: Multiple prefixes bound to a similar Namespace URI will be normalized to the first prefix defined. Still the namespace attributes exist in the XML as inner value prefixes might be used.
The Iterator is
not modifiable. e.g. the
remove() method will throw
UnsupportedOperationException.
When requesting prefixes by Namespace URI, the following table describes the returned prefixes value for all Namespace URI values:
getPrefixes(namespaceURI) return value for
specified Namespace URIs |
|
|---|---|
| Namespace URI parameter | prefixes value returned |
| bound Namespace URI, including the <default Namespace URI> |
Iterator over prefixes bound to Namespace URI in
the current scope in an arbitrary,
implementation dependent,
order
|
| unbound Namespace URI | empty Iterator |
XMLConstants.XML_NS_URI
("http://www.w3.org/XML/1998/namespace") |
Iterator with one element set to
XMLConstants.XML_NS_PREFIX ("xml") |
XMLConstants.XMLNS_ATTRIBUTE_NS_URI
("http://www.w3.org/2000/xmlns/") |
Iterator with one element set to
XMLConstants.XMLNS_ATTRIBUTE ("xmlns") |
null |
IllegalArgumentException is thrown |
getPrefixes in interface NamespaceContextnamespaceURI - URI of Namespace to lookup
Iterator for all prefixes bound to the
Namespace URI in the current scope
IllegalArgumentException - When namespaceURI is
null
public OdfNamespace setNamespace(String prefix,
String uri)
XPath.
All namespace attributes will be written to the root element during later serialization of the DOM by the OdfPackage.
prefix - of the namespace to be set to this DOMuri - of the namespace to be set to this DOM
public OdfNamespace setNamespace(NamespaceName name)
XPath.
All namespace attributes will be written to the root element during later serialization of the DOM by the OdfPackage.
name - the namespace to be set
public Map<Node,com.hp.hpl.jena.rdf.model.Model> getInContentMetadataCache()
public void updateInContentMetadataCache(Node node)
the - node, whose in content metadata will be updatedpublic com.hp.hpl.jena.rdf.model.Model getBookmarkRDFMetadata()
public JenaSink getSink()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||