|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jopendocument.dom.ODXMLDocument
public class ODXMLDocument
An OpenDocument XML document, like content.xml ou styles.xml.
Nested Class Summary | |
---|---|
protected static interface |
ODXMLDocument.ElementTransformer
|
Field Summary | |
---|---|
protected static ODXMLDocument.ElementTransformer |
NOP_ElementTransformer
|
Constructor Summary | |
---|---|
|
ODXMLDocument(org.jdom.Document content)
|
protected |
ODXMLDocument(org.jdom.Document content,
XMLFormatVersion version)
|
|
ODXMLDocument(ODXMLDocument doc)
|
Method Summary | |
---|---|
protected void |
add(org.jdom.Element elem,
int lindex,
ODXMLDocument other,
String rpath,
ODXMLDocument.ElementTransformer addTransf)
Add the part pointed by rpath of other in this document like child number
lindex of elem . |
protected void |
add(IFactory<org.jdom.Element> elemF,
int lindex,
ODXMLDocument other,
String rpath,
ODXMLDocument.ElementTransformer addTransf)
|
protected void |
add(String lpath,
int lindex,
ODXMLDocument other,
String rpath,
ODXMLDocument.ElementTransformer addTransf)
Add the part pointed by rpath of other in this document like child number
lindex of the part pointed by lpath . |
void |
addAutoStyle(org.jdom.Element styleElem)
|
protected void |
addIfNotPresent(ODXMLDocument doc,
String path)
|
protected void |
addIfNotPresent(ODXMLDocument doc,
String path,
int index)
Adds an element from doc to this, if it's not already there. |
String |
asString()
|
static ODXMLDocument |
create(org.jdom.Document doc)
|
String |
findUnusedName(StyleDesc<?> desc,
String baseName)
Find an unused style name in this document. |
org.jdom.Element |
getChild(String childName)
|
org.jdom.Element |
getChild(String childName,
boolean create)
Return the asked child, optionally creating it. |
org.jdom.Element |
getDefaultStyle(StyleStyleDesc<?> styleDesc,
boolean create)
|
protected org.jdom.Element |
getDescendant(String path)
|
protected org.jdom.Element |
getDescendant(String path,
boolean create)
|
org.jdom.Element |
getDescendantByName(org.jdom.Element root,
String qName,
String name)
|
org.jdom.Element |
getDescendantByName(String qName,
String name)
Search for a descendant with the passed name. |
org.jdom.Document |
getDocument()
|
XMLFormatVersion |
getFormatVersion()
|
static Set<String> |
getNamedElements()
The XML elements posessing a name. |
org.jdom.Element |
getStyle(StyleDesc<?> styleDesc,
String name)
|
org.jdom.Element |
getStyle(StyleDesc<?> styleDesc,
String name,
org.jdom.Document referent)
|
Validator |
getValidator()
|
XMLVersion |
getVersion()
|
OOXML |
getXML()
|
org.jdom.xpath.XPath |
getXPath(String string)
|
protected void |
mergeAll(ODXMLDocument other,
String path)
|
protected void |
mergeAll(ODXMLDocument other,
String path,
ODXMLDocument.ElementTransformer addTransf)
Fusionne l'élément spécifié par topElem. |
void |
setChild(org.jdom.Element elem)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final ODXMLDocument.ElementTransformer NOP_ElementTransformer
Constructor Detail |
---|
protected ODXMLDocument(org.jdom.Document content, XMLFormatVersion version)
public ODXMLDocument(org.jdom.Document content)
public ODXMLDocument(ODXMLDocument doc)
Method Detail |
---|
public static Set<String> getNamedElements()
getDescendantByName(String, String)
public static final ODXMLDocument create(org.jdom.Document doc)
public org.jdom.Document getDocument()
public Validator getValidator()
public final OOXML getXML()
public final XMLFormatVersion getFormatVersion()
public final XMLVersion getVersion()
public final org.jdom.Element getChild(String childName)
public org.jdom.Element getChild(String childName, boolean create)
childName
- the name of the child.create
- whether it should be created in case it doesn't exist.
null
if it doesn't exist and create is
false
public void setChild(org.jdom.Element elem)
protected final org.jdom.Element getDescendant(String path) throws org.jdom.JDOMException
org.jdom.JDOMException
protected final org.jdom.Element getDescendant(String path, boolean create) throws org.jdom.JDOMException
org.jdom.JDOMException
public final org.jdom.xpath.XPath getXPath(String string) throws org.jdom.JDOMException
org.jdom.JDOMException
public final org.jdom.Element getDescendantByName(String qName, String name)
qName
- the XML element qualified name, eg "table:table".name
- the value of the name, eg "MyTable".
name
or null
if none is found, eg
<table:table table:name="MyTable" >
IllegalArgumentException
- if qName
is not in getNamedElements()
public final org.jdom.Element getDescendantByName(org.jdom.Element root, String qName, String name)
public final org.jdom.Element getStyle(StyleDesc<?> styleDesc, String name)
public final org.jdom.Element getStyle(StyleDesc<?> styleDesc, String name, org.jdom.Document referent)
public final org.jdom.Element getDefaultStyle(StyleStyleDesc<?> styleDesc, boolean create)
public final String findUnusedName(StyleDesc<?> desc, String baseName)
desc
- the description of the style.baseName
- the base name, e.g. "myColStyle".
Style.getStyleDesc(Class, XMLVersion)
public final void addAutoStyle(org.jdom.Element styleElem)
public String asString()
protected void mergeAll(ODXMLDocument other, String path) throws org.jdom.JDOMException
org.jdom.JDOMException
protected void mergeAll(ODXMLDocument other, String path, ODXMLDocument.ElementTransformer addTransf) throws org.jdom.JDOMException
other
sont ajoutés.
other
- le document à fusionner.path
- le chemon de l'élément à fusionner, eg "./office:body".addTransf
- la transformation à appliquer avant d'ajouter ou null
.
org.jdom.JDOMException
protected void add(String lpath, int lindex, ODXMLDocument other, String rpath, ODXMLDocument.ElementTransformer addTransf) throws org.jdom.JDOMException
rpath
of other in this document like child number
lindex
of the part pointed by lpath
.
lpath
- local xpath.lindex
- local index beneath lpath, < 0 meaning the end.other
- the document to add.rpath
- the remote xpath, note: the content of that element will be added NOT the
element itself.addTransf
- the children of rpath will be transformed, can be null
.
org.jdom.JDOMException
- if an error occur.protected void add(org.jdom.Element elem, int lindex, ODXMLDocument other, String rpath, ODXMLDocument.ElementTransformer addTransf) throws org.jdom.JDOMException
rpath
of other in this document like child number
lindex
of elem
.
elem
- local element, if null
add to rpath see
mergeAll(ODXMLDocument, String, org.jopendocument.dom.ODXMLDocument.ElementTransformer)
.lindex
- local index beneath lpath, < 0 meaning the end, ignored if elem is
null
.other
- the document to add.rpath
- the remote xpath, note: the content of that element will be added NOT the
element itself.addTransf
- the children of rpath will be transformed, can be null
.
org.jdom.JDOMException
- if an error occur.protected final void add(IFactory<org.jdom.Element> elemF, int lindex, ODXMLDocument other, String rpath, ODXMLDocument.ElementTransformer addTransf) throws org.jdom.JDOMException
org.jdom.JDOMException
protected final void addIfNotPresent(ODXMLDocument doc, String path) throws org.jdom.JDOMException
org.jdom.JDOMException
protected final void addIfNotPresent(ODXMLDocument doc, String path, int index) throws org.jdom.JDOMException
doc
- the other document.path
- an XPath denoting an element, and relative to the root element, eg
./office:settings.index
- the index where to add the element, -1 means the end.
org.jdom.JDOMException
- if a problem occurs with path.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |