|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.facetmap.format.xml.XmlFacetmapFactory
public class XmlFacetmapFactory
Produces a Facetmap object from a Facetmap XML document (see the
Facetmap XML 2.0.1 DTD).
Typically you'll use createFacetmapFromXml(InputStream, Properties)
; however, lower-level methods are available for parsing lower-level
elements.
XFML support is disabled in this version but will return in the next version.
This is, at present, a stateful factory object; it holds the state of the Facetmap it's generating. This, along with its unsightly multitude of public methods, allows it to be used by more complex Facetmap creation software. But as a result you should construct one XmlFacetmapFactory for each Facetmap you intend to produce.
In other words, this class is neither stateless nor threadsafe.
Some arcane specifics about this: All methods here 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 XmlFacetmapFactory.) Methods that create Document objects should synchronize on this XmlFacetmapFactory 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 java.text.DateFormat |
dateFormat
|
protected org.w3c.dom.Document |
doc
|
static java.util.Hashtable |
DOCTYPE_TRANSFORMERS
|
static java.util.Hashtable |
ELEMENT_TRANSFORMERS
|
protected SimpleFacetmap |
facetmap
|
protected SimpleFacetSpace |
facetSpace
|
protected XmlResourceParser |
rParser
|
protected java.text.DateFormat |
timeFormat
|
protected java.io.File |
workDir
|
| Constructor Summary | |
|---|---|
XmlFacetmapFactory()
|
|
XmlFacetmapFactory(java.net.URL docsUrl,
java.io.File workDir)
|
|
| Method Summary | |
|---|---|
protected void |
addChildren(org.w3c.dom.Node parent,
SimpleTaxonomyHeading parentHeading,
SimpleTaxonomyFacet tax)
|
static java.util.Hashtable |
createDoctypeTransformers()
|
DOMParser |
createDOMParser()
|
static java.util.Hashtable |
createElementTransformers()
|
SimpleFacetmap |
createFacetmap(java.lang.String title)
|
Facetmap |
createFacetmapFromXml(java.io.InputStream inputStream,
java.util.Properties props)
|
SimpleSpectrumFacet |
loadSpectrum(java.lang.String url,
java.lang.String id)
|
SimpleTaxonomyFacet |
loadTaxonomy(java.lang.String url,
java.lang.String id)
|
static void |
main(java.lang.String[] argv)
Parses XML provided to standard input, and writes equivalent Facetmap XML to standard out. |
Facetmap |
parse(java.io.BufferedReader r)
Construct a Facetmap object using all the default properties. |
Facetmap |
parse(java.io.BufferedReader r,
java.util.Properties props)
|
Facetmap |
parse(java.lang.String systemId)
I think the latest xerces code can find a xml doc in a few places given a systemId. |
java.util.Date |
parseDateAttribute(java.lang.String attributeValue)
|
SimpleDateFacet |
parseDateFacet(org.w3c.dom.Element dElem)
|
void |
parseFacetmap(org.w3c.dom.Element fmElem)
|
void |
parseOnlyResources(org.w3c.dom.Element resources)
|
SpectrumHeading |
parseRange(org.w3c.dom.Element rElem,
SimpleSpectrumFacet spect)
This parser also adds the range to the spectrum (since that's required to create the range). |
SimpleSpectrumFacet |
parseSpectrum(org.w3c.dom.Element spectrumElem)
|
SimpleSpectrumFacet |
parseSpectrum(org.w3c.dom.Element sElem,
java.lang.String id)
|
TaxonomyFacet |
parseTaxonomy(org.w3c.dom.Element taxonomyElem)
|
SimpleTaxonomyFacet |
parseTaxonomy(org.w3c.dom.Element taxonomyElem,
java.lang.String id)
|
UnfacetedResource.UnfacetedHeading |
parseUnfacetedHeading(org.w3c.dom.Element mapElem)
|
UnfacetedResource |
parseUnfacetedResource(org.w3c.dom.Element resourceElem)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.util.Hashtable DOCTYPE_TRANSFORMERS
public static java.util.Hashtable ELEMENT_TRANSFORMERS
protected SimpleFacetmap facetmap
protected SimpleFacetSpace facetSpace
protected java.io.File workDir
protected XmlResourceParser rParser
protected java.text.DateFormat dateFormat
protected java.text.DateFormat timeFormat
protected org.w3c.dom.Document doc
| Constructor Detail |
|---|
public XmlFacetmapFactory()
public XmlFacetmapFactory(java.net.URL docsUrl,
java.io.File workDir)
| Method Detail |
|---|
public SimpleFacetmap createFacetmap(java.lang.String title)
throws DataException
DataExceptionpublic static java.util.Hashtable createDoctypeTransformers()
public static java.util.Hashtable createElementTransformers()
public DOMParser createDOMParser()
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public TaxonomyFacet parseTaxonomy(org.w3c.dom.Element taxonomyElem)
throws java.io.IOException,
DataException
java.io.IOException
DataException
public SimpleTaxonomyFacet parseTaxonomy(org.w3c.dom.Element taxonomyElem,
java.lang.String id)
throws java.io.IOException,
DataException
java.io.IOException
DataException
public SimpleTaxonomyFacet loadTaxonomy(java.lang.String url,
java.lang.String id)
throws java.io.IOException,
DataException
java.io.IOException
DataException
public SimpleSpectrumFacet parseSpectrum(org.w3c.dom.Element spectrumElem)
throws java.io.IOException,
DataException
java.io.IOException
DataException
public SimpleDateFacet parseDateFacet(org.w3c.dom.Element dElem)
throws DataException
DataException
public java.util.Date parseDateAttribute(java.lang.String attributeValue)
throws DataException
DataException
public SimpleSpectrumFacet parseSpectrum(org.w3c.dom.Element sElem,
java.lang.String id)
throws java.io.IOException,
DataException
java.io.IOException
DataException
public SimpleSpectrumFacet loadSpectrum(java.lang.String url,
java.lang.String id)
throws java.io.IOException,
DataException
java.io.IOException
DataException
public SpectrumHeading parseRange(org.w3c.dom.Element rElem,
SimpleSpectrumFacet spect)
throws DataException
DataException
public Facetmap parse(java.io.BufferedReader r)
throws java.io.IOException,
DataException,
InternalException
java.io.IOException
DataException
InternalException
public Facetmap parse(java.io.BufferedReader r,
java.util.Properties props)
throws java.io.IOException,
DataException,
InternalException
java.io.IOException
DataException
InternalException
public Facetmap createFacetmapFromXml(java.io.InputStream inputStream,
java.util.Properties props)
throws java.io.IOException,
DataException,
InternalException
java.io.IOException
DataException
InternalException
public Facetmap parse(java.lang.String systemId)
throws java.io.IOException,
DataException,
InternalException
java.io.IOException
DataException
InternalExceptionpublic void parseOnlyResources(org.w3c.dom.Element resources)
public UnfacetedResource parseUnfacetedResource(org.w3c.dom.Element resourceElem)
public UnfacetedResource.UnfacetedHeading parseUnfacetedHeading(org.w3c.dom.Element mapElem)
public void parseFacetmap(org.w3c.dom.Element fmElem)
throws java.io.IOException,
DataException,
InternalException
java.io.IOException
DataException
InternalException
protected void addChildren(org.w3c.dom.Node parent,
SimpleTaxonomyHeading parentHeading,
SimpleTaxonomyFacet tax)
throws DataException
DataException
public static void main(java.lang.String[] argv)
throws DataException,
InternalException,
java.io.IOException
java -Dcom.facetmap.licenseFile=./license.txt
-Dcom.facetmap.sourceTable.column.Name=title
com.facetmap.format.excel.ExcelFacetmapFactory records.xls
> record-facetmap.xml
DataException
InternalException
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||