org.jopendocument.dom
Class ODXMLDocument

java.lang.Object
  extended by org.jopendocument.dom.ODXMLDocument
Direct Known Subclasses:
ODSingleXMLDocument

public class ODXMLDocument
extends java.lang.Object

An OpenDocument XML document, like content.xml ou styles.xml.

Author:
Sylvain CUAZ

Constructor Summary
ODXMLDocument(org.jdom.Document content)
           
ODXMLDocument(ODXMLDocument doc)
           
 
Method Summary
 void addAutoStyle(org.jdom.Element styleElem)
           
 java.lang.String asString()
           
static ODXMLDocument create(org.jdom.Document doc)
           
 java.lang.String findUnusedName(StyleDesc<?> desc, java.lang.String baseName)
          Find an unused style name in this document.
 org.jdom.Element getChild(java.lang.String childName)
           
 org.jdom.Element getChild(java.lang.String childName, boolean create)
          Return the asked child, optionally creating it.
 org.jdom.Element getDefaultStyle(StyleStyleDesc<?> styleDesc, boolean create)
           
 org.jdom.Element getDescendantByName(org.jdom.Element root, java.lang.String qName, java.lang.String name)
           
 org.jdom.Element getDescendantByName(java.lang.String qName, java.lang.String name)
          Search for a descendant with the passed name.
 org.jdom.Document getDocument()
           
 XMLFormatVersion getFormatVersion()
           
static java.util.Set<java.lang.String> getNamedElements()
          The XML elements posessing a name.
 org.jdom.Element getStyle(StyleDesc<?> styleDesc, java.lang.String name)
           
 org.jdom.Element getStyle(StyleDesc<?> styleDesc, java.lang.String name, org.jdom.Document referent)
           
 Validator getValidator()
           
 XMLVersion getVersion()
           
 OOXML getXML()
           
 org.jdom.xpath.XPath getXPath(java.lang.String string)
           
 void setChild(org.jdom.Element elem)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ODXMLDocument

public ODXMLDocument(org.jdom.Document content)

ODXMLDocument

public ODXMLDocument(ODXMLDocument doc)
Method Detail

getNamedElements

public static java.util.Set<java.lang.String> getNamedElements()
The XML elements posessing a name.

Returns:
the qualified names of named elements.
See Also:
getDescendantByName(String, String)

create

public static final ODXMLDocument create(org.jdom.Document doc)

getDocument

public org.jdom.Document getDocument()

getValidator

public Validator getValidator()

getXML

public final OOXML getXML()

getFormatVersion

public final XMLFormatVersion getFormatVersion()

getVersion

public final XMLVersion getVersion()

getChild

public final org.jdom.Element getChild(java.lang.String childName)

getChild

public org.jdom.Element getChild(java.lang.String childName,
                                 boolean create)
Return the asked child, optionally creating it.

Parameters:
childName - the name of the child.
create - whether it should be created in case it doesn't exist.
Returns:
the asked child or null if it doesn't exist and create is false

setChild

public void setChild(org.jdom.Element elem)

getXPath

public final org.jdom.xpath.XPath getXPath(java.lang.String string)
                                    throws org.jdom.JDOMException
Throws:
org.jdom.JDOMException

getDescendantByName

public final org.jdom.Element getDescendantByName(java.lang.String qName,
                                                  java.lang.String name)
Search for a descendant with the passed name.

Parameters:
qName - the XML element qualified name, eg "table:table".
name - the value of the name, eg "MyTable".
Returns:
the first element named name or null if none is found, eg <table:table table:name="MyTable" >
Throws:
java.lang.IllegalArgumentException - if qName is not in getNamedElements()

getDescendantByName

public final org.jdom.Element getDescendantByName(org.jdom.Element root,
                                                  java.lang.String qName,
                                                  java.lang.String name)

getStyle

public final org.jdom.Element getStyle(StyleDesc<?> styleDesc,
                                       java.lang.String name)

getStyle

public final org.jdom.Element getStyle(StyleDesc<?> styleDesc,
                                       java.lang.String name,
                                       org.jdom.Document referent)

getDefaultStyle

public final org.jdom.Element getDefaultStyle(StyleStyleDesc<?> styleDesc,
                                              boolean create)

findUnusedName

public final java.lang.String findUnusedName(StyleDesc<?> desc,
                                             java.lang.String baseName)
Find an unused style name in this document.

Parameters:
desc - the description of the style.
baseName - the base name, e.g. "myColStyle".
Returns:
an unused name, e.g. "myColStyle12".
See Also:
Style.getStyleDesc(Class, XMLVersion)

addAutoStyle

public final void addAutoStyle(org.jdom.Element styleElem)

asString

public java.lang.String asString()