com.atlassian.confluence.it.export
Class XmlSiteExportHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.atlassian.confluence.it.export.XmlSiteExportHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XmlSiteExportHandler
extends org.xml.sax.helpers.DefaultHandler

A SAX handler for processing the XML component of a site export and building some simple mappings of the found pages and spaces, suitable for validating Site export tests. You should note that a large site export will lead to large memory usage so use it for small test sites only. It's also pretty quick and nasty but you'll see that for yourself.


Constructor Summary
XmlSiteExportHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Read a property value if the currentProperty has been set.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String name)
          If this is the end of an object element and we have a current item then store it.
 SimpleSiteStructure getStructure()
          When called after parsing is complete it will return the SimpleSiteStructure which has been constructed.
 void startDocument()
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String name, org.xml.sax.Attributes attributes)
          Does not expect or handle nested object elements.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlSiteExportHandler

public XmlSiteExportHandler()
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Read a property value if the currentProperty has been set.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String name)
                throws org.xml.sax.SAXException
If this is the end of an object element and we have a current item then store it. Nested object elements would confuse things.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String name,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Does not expect or handle nested object elements. If one is encountered then any parsing of outer object will be lost.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

getStructure

public SimpleSiteStructure getStructure()
When called after parsing is complete it will return the SimpleSiteStructure which has been constructed.

Returns:
the structure created or null if parsing has not been performed.


Copyright © 2003-2010 Atlassian. All Rights Reserved.