com.facetmap.simple
Class XmlConverter
java.lang.Object
com.facetmap.simple.XmlConverter
- All Implemented Interfaces:
- Parser
- Direct Known Subclasses:
- SimpleFacetmap.SimpleXmlConverter
- public abstract class XmlConverter
- extends java.lang.Object
- implements Parser
Contains all XML communication with the engine.
XML creation routines are set up this way: They all use an instance variable
for the Document. So, use of those routines must be synchronized so two threads
don't use the same Document. (This shouldn't be a problem, since every thread
should be constructing its own XmlConverter.) Methods that create Document
objects should synchronize on this XmlConverter 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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DOCTYPE_TRANSFORMERS
public static java.util.Hashtable DOCTYPE_TRANSFORMERS
ELEMENT_TRANSFORMERS
public static java.util.Hashtable ELEMENT_TRANSFORMERS
mHome
protected Map mHome
docsUrl
protected java.net.URL docsUrl
workDir
protected java.io.File workDir
rParser
protected XmlResourceParser rParser
doc
protected org.w3c.dom.Document doc
XmlConverter
public XmlConverter()
XmlConverter
public XmlConverter(java.net.URL docsUrl,
java.io.File workDir)
createMap
public abstract Map createMap(java.lang.String title)
throws DataException,
InternalException
- The class will call this method when it needs a Map object.
Map factories will typically subclass this class and tell it
how to make a Map, then call this class's parse() method.
FIXME Please rewrite me please please! I should be accepting
a Map factory in my constructor, not getting subclassed. This
is so Trav 2002. Learn from it, kids.
- Throws:
DataException
InternalException
createDoctypeTransformers
public static java.util.Hashtable createDoctypeTransformers()
createElementTransformers
public static java.util.Hashtable createElementTransformers()
getDocsUrl
public java.net.URL getDocsUrl()
createDOMParser
public DOMParser createDOMParser()
throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
parseTaxonomy
public Taxonomy parseTaxonomy(org.w3c.dom.Element taxonomyElem)
throws java.io.IOException,
DataException
- Throws:
java.io.IOException
DataException
parseTaxonomy
public Taxonomy parseTaxonomy(org.w3c.dom.Element taxonomyElem,
java.lang.String id)
throws java.io.IOException,
DataException
- Throws:
java.io.IOException
DataException
loadTaxonomy
public Taxonomy loadTaxonomy(java.lang.String url,
java.lang.String id)
throws java.io.IOException,
DataException
- Throws:
java.io.IOException
DataException
parseSpectrum
public Spectrum parseSpectrum(org.w3c.dom.Element spectrumElem)
throws java.io.IOException,
DataException
- Throws:
java.io.IOException
DataException
parseSpectrum
public Spectrum parseSpectrum(org.w3c.dom.Element sElem,
java.lang.String id)
throws java.io.IOException,
DataException
- Throws:
java.io.IOException
DataException
loadSpectrum
public Spectrum loadSpectrum(java.lang.String url,
java.lang.String id)
throws java.io.IOException,
DataException
- Throws:
java.io.IOException
DataException
parseRange
public SpectrumHeading parseRange(org.w3c.dom.Element rElem,
Spectrum spect)
throws DataException
- This parser also adds the range to the spectrum (since that's
required to create the range).
- Throws:
DataException
parse
public Map parse(java.io.BufferedReader r)
throws java.io.IOException,
DataException,
InternalException
- Specified by:
parse in interface Parser
- Throws:
java.io.IOException
DataException
InternalException
parse
public Map parse(java.io.InputStream inputStream)
throws java.io.IOException,
DataException,
InternalException
- Throws:
java.io.IOException
DataException
InternalException
parse
public Map parse(java.lang.String systemId)
throws java.io.IOException,
DataException,
InternalException
- I think the latest xerces code can find a xml doc in a few places
given a systemId. For now I'm just going to assume the systemId
represents a filename (one of the systemId possibilities, I think).
- Throws:
java.io.IOException
DataException
InternalException
parseMap
public void parseMap(org.w3c.dom.Element fmElem)
throws java.io.IOException,
DataException,
InternalException
- Throws:
java.io.IOException
DataException
InternalException
addChildren
protected void addChildren(org.w3c.dom.Node parent,
TaxonomicHeading parentHeading,
Taxonomy tax)
throws DataException
- Throws:
DataException