com.dynamide
Class JDOMFile

java.lang.Object
  extended by com.dynamide.DynamideObject
      extended by com.dynamide.resource.ContextNode
          extended by com.dynamide.JDOMFile
All Implemented Interfaces:
IContext, IGet, org.xml.sax.EntityResolver
Direct Known Subclasses:
Persistent

public class JDOMFile
extends ContextNode
implements org.xml.sax.EntityResolver


Field Summary
 
Fields inherited from class com.dynamide.DynamideObject
m_id
 
Constructor Summary
JDOMFile()
           
JDOMFile(DynamideObject owner)
           
JDOMFile(DynamideObject owner, java.lang.String filename)
           
JDOMFile(DynamideObject owner, java.lang.String filename, java.lang.String saxDriverClassname)
           
 
Method Summary
protected  void addError(java.lang.String error)
           
 void clearErrors()
           
 void commitInMemoryChangesToDOM()
          Called when persisitence is going to happen: gives subclasses an opportunity to sync the DOM with memory.
static org.jdom.output.XMLOutputter createJDomXMLOutputter(boolean expandEmptyElements)
           
static org.jdom.Element findFirstElement(org.jdom.Element current, java.lang.String findName)
           
 org.jdom.Element findFirstElement(java.lang.String findName)
           
static org.jdom.Element findFirstElementWithAttribute(org.jdom.Element current, java.lang.String findName, java.lang.String attrName, java.lang.String attrValue, boolean ignoreElementCase)
           
static java.lang.String getAttributeValue(org.jdom.Element element, java.lang.String attrName)
          Safe to call: always returns a string, maybe empty, but never null.
 org.jdom.Document getDocument()
           
 java.lang.String getErrors()
           
 java.lang.String getFilename()
           
 java.lang.String getFullXMLSource()
          Return just the un-rendered full xml source.
 org.jdom.Element getRootElement()
           
static java.lang.String hideEntities(java.lang.String html)
           
static boolean isValidXHTML(java.lang.String src)
           
static boolean isValidXHTMLFragment(java.lang.String src)
           
 void listNamedElement(org.jdom.Element root, java.io.PrintStream out, java.lang.String elementName)
           
static void main(java.lang.String[] args)
           
 java.lang.String output()
           
static java.lang.String output(org.jdom.Element start)
          This overload returns a String and requires no output stream.
static java.lang.String output(org.jdom.Element start, boolean hideException)
           
static void output(org.jdom.Element root, java.io.PrintStream out)
           
 void output(java.io.PrintStream out)
           
static org.jaxen.XPath prepare(java.lang.String xpathExpression)
           
static java.lang.String prettyPrintHTML(java.lang.String html)
           
static java.lang.String prettyPrintHTML(java.lang.String html, java.lang.String newlines, java.lang.String trim, boolean xhtml, boolean expandEmpty, boolean indent, boolean hideErrrors)
           
static java.lang.String prettyPrintHTMLSafe(java.lang.String src)
           
 org.jdom.Document read(java.lang.String filename)
           
 org.jdom.Document readFromString(java.lang.String source)
           
 void reload()
           
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
           
static java.lang.String safeGetElementChildText(org.jdom.Element element, java.lang.String childName)
           
 boolean saveToFile()
           
 boolean saveToFile(java.lang.String filename, boolean backup)
           
 java.util.List select(org.jdom.Element element, java.lang.String xpathExpression)
           
 java.util.List select(org.jdom.Element element, org.jaxen.XPath xpath)
           
 java.util.List select(java.lang.String xpathExpression)
           
 org.jdom.Element selectFirst(org.jdom.Element element, java.lang.String xpathExpression)
           
 org.jdom.Element selectFirst(org.jdom.Element element, org.jaxen.XPath xpath)
           
 void setFilename(java.lang.String newName)
          Warning: most operations will not heed this, since the API has filename parameters when needed.
static void testPrettyPrint(int count)
           
static java.lang.String unHideEntities(java.lang.String html)
           
 java.lang.String valueOf(org.jdom.Element element, java.lang.String xpathExpression)
           
 java.lang.String valueOf(java.lang.String xpathExpression)
           
 
Methods inherited from class com.dynamide.resource.ContextNode
bind, bind, bindAll, bindAllAttributes, bindAttribute, dump, dumpAttributes, dumpContext, find, find, find, firstContext, get, getAttribute, getAttributeCount, getAttributes, getContext, getContextCount, getContexts, getKey, getPermission, hasAttribute, hasContext, listAttributeNames, listAttributeNames, listContextNames, listContextNames, lockPermissions, rebind, rebind, rebindAttribute, remove, removeAttribute, removeFirstContext, setKey, toString, unlockPermissions, update, writeCache
 
Methods inherited from class com.dynamide.DynamideObject
clearProfiler, dump, dumpHTML, expand, finalize, findParentExpander, findParentPage, findParentSession, findTopParentPage, getCategoryID, getDotName, getID, getNextGetter, getObjectID, getOwner, getProfiler, isDebugEnabled, isInfoEnabled, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logWarn, logWarn, logWarn, logWarn, popLogContext, printf, printProfiler, profileEnter, profileLeave, pushLogContext, setDotName, setID, setNextGetter, setObjectID, setOwner, sprintf, useProfiler, walkParents
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JDOMFile

public JDOMFile()

JDOMFile

public JDOMFile(DynamideObject owner)

JDOMFile

public JDOMFile(DynamideObject owner,
                java.lang.String filename)
         throws java.io.IOException,
                org.jdom.JDOMException
Throws:
java.io.IOException
org.jdom.JDOMException

JDOMFile

public JDOMFile(DynamideObject owner,
                java.lang.String filename,
                java.lang.String saxDriverClassname)
         throws java.io.IOException,
                org.jdom.JDOMException
Throws:
java.io.IOException
org.jdom.JDOMException
Method Detail

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
org.xml.sax.SAXException
java.io.IOException

getFilename

public java.lang.String getFilename()

setFilename

public void setFilename(java.lang.String newName)
Warning: most operations will not heed this, since the API has filename parameters when needed. Setting the filename then saving it, will work, however.


getDocument

public org.jdom.Document getDocument()

getRootElement

public org.jdom.Element getRootElement()

read

public org.jdom.Document read(java.lang.String filename)
                       throws org.jdom.JDOMException,
                              java.io.IOException
Throws:
org.jdom.JDOMException
java.io.IOException

readFromString

public org.jdom.Document readFromString(java.lang.String source)
                                 throws java.io.IOException,
                                        org.jdom.JDOMException
Throws:
java.io.IOException
org.jdom.JDOMException

reload

public void reload()
            throws java.io.IOException,
                   org.jdom.JDOMException
Throws:
java.io.IOException
org.jdom.JDOMException

output

public void output(java.io.PrintStream out)
            throws java.io.IOException,
                   org.jdom.JDOMException
Throws:
java.io.IOException
org.jdom.JDOMException

output

public static void output(org.jdom.Element root,
                          java.io.PrintStream out)
                   throws java.io.IOException,
                          org.jdom.JDOMException
Throws:
java.io.IOException
org.jdom.JDOMException

output

public static java.lang.String output(org.jdom.Element start)
This overload returns a String and requires no output stream.


output

public static java.lang.String output(org.jdom.Element start,
                                      boolean hideException)

output

public java.lang.String output()

createJDomXMLOutputter

public static org.jdom.output.XMLOutputter createJDomXMLOutputter(boolean expandEmptyElements)

getFullXMLSource

public java.lang.String getFullXMLSource()
Return just the un-rendered full xml source.


hideEntities

public static java.lang.String hideEntities(java.lang.String html)

unHideEntities

public static java.lang.String unHideEntities(java.lang.String html)

isValidXHTMLFragment

public static boolean isValidXHTMLFragment(java.lang.String src)

isValidXHTML

public static boolean isValidXHTML(java.lang.String src)

prettyPrintHTMLSafe

public static java.lang.String prettyPrintHTMLSafe(java.lang.String src)

prettyPrintHTML

public static java.lang.String prettyPrintHTML(java.lang.String html)
                                        throws XMLFormatException
Throws:
XMLFormatException

prettyPrintHTML

public static java.lang.String prettyPrintHTML(java.lang.String html,
                                               java.lang.String newlines,
                                               java.lang.String trim,
                                               boolean xhtml,
                                               boolean expandEmpty,
                                               boolean indent,
                                               boolean hideErrrors)
                                        throws XMLFormatException
Throws:
XMLFormatException

commitInMemoryChangesToDOM

public void commitInMemoryChangesToDOM()
                                throws java.lang.Exception
Called when persisitence is going to happen: gives subclasses an opportunity to sync the DOM with memory.

Throws:
java.lang.Exception

saveToFile

public boolean saveToFile()

saveToFile

public boolean saveToFile(java.lang.String filename,
                          boolean backup)

findFirstElement

public org.jdom.Element findFirstElement(java.lang.String findName)

findFirstElement

public static org.jdom.Element findFirstElement(org.jdom.Element current,
                                                java.lang.String findName)

findFirstElementWithAttribute

public static org.jdom.Element findFirstElementWithAttribute(org.jdom.Element current,
                                                             java.lang.String findName,
                                                             java.lang.String attrName,
                                                             java.lang.String attrValue,
                                                             boolean ignoreElementCase)

getAttributeValue

public static java.lang.String getAttributeValue(org.jdom.Element element,
                                                 java.lang.String attrName)
Safe to call: always returns a string, maybe empty, but never null. If you want to know if an attribute is not present, use the normal jdom.Element.getAttributeValue()


safeGetElementChildText

public static java.lang.String safeGetElementChildText(org.jdom.Element element,
                                                       java.lang.String childName)

listNamedElement

public void listNamedElement(org.jdom.Element root,
                             java.io.PrintStream out,
                             java.lang.String elementName)

addError

protected void addError(java.lang.String error)

clearErrors

public void clearErrors()

getErrors

public java.lang.String getErrors()

prepare

public static org.jaxen.XPath prepare(java.lang.String xpathExpression)
                               throws java.lang.Exception
Throws:
java.lang.Exception

select

public java.util.List select(java.lang.String xpathExpression)

select

public java.util.List select(org.jdom.Element element,
                             java.lang.String xpathExpression)

select

public java.util.List select(org.jdom.Element element,
                             org.jaxen.XPath xpath)
See Also:
prepare(java.lang.String)

selectFirst

public org.jdom.Element selectFirst(org.jdom.Element element,
                                    java.lang.String xpathExpression)

selectFirst

public org.jdom.Element selectFirst(org.jdom.Element element,
                                    org.jaxen.XPath xpath)
See Also:
prepare(java.lang.String)

valueOf

public java.lang.String valueOf(java.lang.String xpathExpression)

valueOf

public java.lang.String valueOf(org.jdom.Element element,
                                java.lang.String xpathExpression)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

testPrettyPrint

public static void testPrettyPrint(int count)
                            throws java.lang.Exception
Throws:
java.lang.Exception


Copyright 2001-2013 DYNAMIDE.COM. All Rights Reserved.