|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.brics.xmlgraph.converter.Template2XMLGraph
public class Template2XMLGraph
Production of XML graph fragment from an XML template constant or a complete XML document.
In templates, gaps are encoded as follows:
gap kind | encoding |
---|---|
<[g]> | <gn:template-gap gap="g"/> |
a=[g] | <gn:attribute-gap gap="g" name="a"/> |
<[T g]> | <gn:template-gap gap="g" type="t"/> |
a=[T g] | <gn:attribute-gap gap="g" type="t" name="a"/> |
gn
prefix refers to the namespace
http://www.brics.dk/xmlgraph/gap
, a and t are QNames,
and g is a Name.
Note that in templates, the root element in the given XML template constant is only used as a
container, and only its contents (and namespace declarations) are relevant.
Field Summary | |
---|---|
static String |
GAP_NAMESPACE
Namespace for gap encoding. |
Constructor Summary | |
---|---|
Template2XMLGraph(XMLGraph xg,
boolean document_mode)
Constructs a new converter. |
Method Summary | |
---|---|
Document |
build(Reader reader,
Origin origin)
Builds JDOM representation of the given template or document. |
Document |
build(URL url,
Origin origin)
Builds JDOM representation of the given template or document. |
XMLGraph |
convert(Document d,
Origin origin)
Converts the given template or document to a new XML graph. |
XMLGraphFragment |
extend(Document d,
Origin origin)
Extends the current XML graph with a fragment corresponding to the given XML template constant. |
void |
useSurroundingChoiceNodes(boolean b)
Enables/disables use of extra ChoiceNode s around each ElementNode and
AttributeNode and above each TextNode . |
void |
useTypedGaps(boolean b)
Enables/disables use of typed gaps. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String GAP_NAMESPACE
Constructor Detail |
---|
public Template2XMLGraph(XMLGraph xg, boolean document_mode)
xg
- XML graph where fragments are to be added (set to null if using convert
)document_mode
- if true, this converter works with complete documents rather that templatesMethod Detail |
---|
public Document build(Reader reader, Origin origin) throws ConverterException
reader
- reader of XML template or documentorigin
- source information (null if not applicable)
ConverterException
- if unable to buildpublic Document build(URL url, Origin origin) throws ConverterException
url
- URL of XML template or documentorigin
- source information (null if not applicable)
ConverterException
- if unable to buildpublic XMLGraph convert(Document d, Origin origin) throws ConverterException
d
- JDOM representation of XML template or documentorigin
- source information (null if not applicable)
ConverterException
- if unable to convertpublic XMLGraphFragment extend(Document d, Origin origin) throws ConverterException
d
- JDOM representation of XML template or documentorigin
- source information (null if not applicable)
ConverterException
- if unable to convertpublic void useSurroundingChoiceNodes(boolean b)
ChoiceNode
s around each ElementNode
and
AttributeNode
and above each TextNode
.
Default: disabled.
b
- enable if true, disable if falsepublic void useTypedGaps(boolean b)
b
- enable if true, disable if false
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |