com.facetmap.format.xml
Class XmlGenerator

java.lang.Object
  extended by com.facetmap.format.xml.XmlGenerator

public class XmlGenerator
extends java.lang.Object

Generates XML output for Facetmaps and Selections. See the Facetmap XML 2.0.1 DTD and the Selection XML DTD for definitions of this class's output.

This is a stateful generator, so all output methods are synchronized. Typically you should create a new XmlGenerator for each output task. If you extend this class, new methods that create Document objects should synchronize on this XmlGenerator object. Methods that build Elements should not be synchronized, but they should only be called by other Element-builders and the synchronized Document-builders. That's why they're protected.


Field Summary
protected  org.w3c.dom.Document doc
           
protected  Facetmap map
           
 
Constructor Summary
XmlGenerator()
           
 
Method Summary
 org.w3c.dom.Document documentOf(java.lang.Exception exc)
           
 org.w3c.dom.Document documentOf(Facetmap facetmap)
           
 org.w3c.dom.Document documentOf(Selection s)
           
static XMLSerializer getDataOnlySerializer(java.io.Writer w)
           
static XMLSerializer getDefaultSerializer(java.io.Writer w)
           
protected  org.w3c.dom.Element modelOf(CompoundHeadingFacet compoundHeadingFacet)
           
protected  org.w3c.dom.Element modelOf(DateFacet dateFacet)
           
 org.w3c.dom.Element modelOf(java.lang.Exception exc)
           
protected  org.w3c.dom.Element modelOf(Facet untypedFacet)
           
protected  org.w3c.dom.Element modelOf(Resource r)
           
 org.w3c.dom.Element modelOf(Selection s)
           
protected  org.w3c.dom.Element modelOf(SpectrumFacet spect)
           
protected  org.w3c.dom.Element modelOf(SpectrumHeading h)
           
protected  org.w3c.dom.Element modelOf(TaxonomyFacet tax)
           
protected  org.w3c.dom.Element modelOf(TaxonomyHeading h)
           
protected  org.w3c.dom.Element modelOf(com.facetmap.format.xml.XmlGenerator.HeadingRef fr)
           
 void outputDocument(org.w3c.dom.Document d, java.io.Writer w)
           
 void outputDocumentElement(org.w3c.dom.Document d, java.io.Writer w)
           
 void outputException(java.lang.Exception exc, java.io.Writer w)
           
 void outputMap(Facetmap m, java.io.Writer w)
           
 void outputSelection(Selection s, java.io.Writer w)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected Facetmap map

doc

protected org.w3c.dom.Document doc
Constructor Detail

XmlGenerator

public XmlGenerator()
Method Detail

getDefaultSerializer

public static XMLSerializer getDefaultSerializer(java.io.Writer w)

getDataOnlySerializer

public static XMLSerializer getDataOnlySerializer(java.io.Writer w)

outputDocument

public void outputDocument(org.w3c.dom.Document d,
                           java.io.Writer w)
                    throws java.io.IOException
Throws:
java.io.IOException

outputDocumentElement

public void outputDocumentElement(org.w3c.dom.Document d,
                                  java.io.Writer w)
                           throws java.io.IOException
Throws:
java.io.IOException

outputMap

public void outputMap(Facetmap m,
                      java.io.Writer w)
               throws java.io.IOException,
                      DataException,
                      InternalException
Throws:
java.io.IOException
DataException
InternalException

outputSelection

public void outputSelection(Selection s,
                            java.io.Writer w)
                     throws java.io.IOException,
                            DataException,
                            InternalException
Throws:
java.io.IOException
DataException
InternalException

outputException

public void outputException(java.lang.Exception exc,
                            java.io.Writer w)
                     throws java.io.IOException
Throws:
java.io.IOException

documentOf

public org.w3c.dom.Document documentOf(Facetmap facetmap)

modelOf

protected org.w3c.dom.Element modelOf(Facet untypedFacet)

modelOf

protected org.w3c.dom.Element modelOf(CompoundHeadingFacet compoundHeadingFacet)

modelOf

protected org.w3c.dom.Element modelOf(TaxonomyFacet tax)

modelOf

protected org.w3c.dom.Element modelOf(SpectrumFacet spect)

modelOf

protected org.w3c.dom.Element modelOf(DateFacet dateFacet)

modelOf

protected org.w3c.dom.Element modelOf(TaxonomyHeading h)

modelOf

protected org.w3c.dom.Element modelOf(SpectrumHeading h)

modelOf

protected org.w3c.dom.Element modelOf(Resource r)

modelOf

protected org.w3c.dom.Element modelOf(com.facetmap.format.xml.XmlGenerator.HeadingRef fr)

modelOf

public org.w3c.dom.Element modelOf(Selection s)
                            throws DataException,
                                   InternalException
Throws:
DataException
InternalException

modelOf

public org.w3c.dom.Element modelOf(java.lang.Exception exc)

documentOf

public org.w3c.dom.Document documentOf(Selection s)
                                throws DataException,
                                       InternalException
Throws:
DataException
InternalException

documentOf

public org.w3c.dom.Document documentOf(java.lang.Exception exc)