Package eu.bandm.tools.xslt.base
Class Templates
java.lang.Object
eu.bandm.tools.xslt.base.MessageSender
eu.bandm.tools.xslt.base.Templates
- All Implemented Interfaces:
ContentHandler
Represents one single xslt source file, w/o further context info.
Internally PURE subtrees are realized by xslt and target tdom trees;
BI-COLOURED tree nodes are realized by
The SAX receiver switches between xslt mode and target mode and delegates parsing to the TDOM sax receiver method. Whenever a tdom element is completed successfully, a "parseListener" can take this element and insert it into a MultiTypeNodeList. If the parsing process fails under the way, because of an xslt element embedded in a target structure (which can happen ubiquituously), then tdom parsing is cancelled. For this case a MultiTypeNodeList is constructed as a "plan b" in parallel to the SAX event forwarding, and completed instead. A missing attribute or an attribute with "value template" also leads to an incomplete target element, ie a MultiTypeNodeList.
No context check is done, this is done by the user, which is a
MultiTypeNodeList
objects.
Each instance of this class is
a SAX receiver, ie. provides the parsing method for these bi-coloured trees.
The SAX receiver switches between xslt mode and target mode and delegates parsing to the TDOM sax receiver method. Whenever a tdom element is completed successfully, a "parseListener" can take this element and insert it into a MultiTypeNodeList. If the parsing process fails under the way, because of an xslt element embedded in a target structure (which can happen ubiquituously), then tdom parsing is cancelled. For this case a MultiTypeNodeList is constructed as a "plan b" in parallel to the SAX event forwarding, and completed instead. A missing attribute or an attribute with "value template" also leads to an incomplete target element, ie a MultiTypeNodeList.
No context check is done, this is done by the user, which is a
Transformation
.-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Attributes
(package private) final Object
(package private) Locator
final Map<TypedSubstantial,
Binding<String, String>> Map from every xslt code node or target language element (completeElement
or incompleteMultiTypeNodeList
) to the valid namspace prefix mapping.Currently valid prefix map, reflecting the map-directives of the SAX input (=xslt source), initially mapping only the empty prefix to the empty (non-ns) url, and "xml" to the xml namespace uri.(package private) final URI
(package private) final TypedNode.ParseListener
Is called by tdom sax parsing code wheneven an element is completed.final Map<eu.bandm.tools.xslt.tdom.Element,
MultiTypeNodeList> Links from xslt elements at LEAF position to their raw/MultiType contents.(package private) final ResultContext
Aux comprehension of result dtd features.(package private) final ContentHandler
(package private) static final Map<NamespaceName,
Method> (package private) eu.bandm.tools.xslt.tdom.Element_xsl_stylesheet
(package private) ContentHandler
Current output to which the sax events will be forwarded.(package private) Templates.Stackframe
Models the nesting of result elements under constrcution.static final TPathCache
Cache for all parsed tpath expressions.static final DTD.Dtd
static final DTM.Dtd
Fields inherited from class eu.bandm.tools.xslt.base.MessageSender
msg, trace
-
Constructor Summary
ConstructorDescriptionTemplates
(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, Trace trace, URI ownUri, ResultContext resultContext) -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) (package private) Location<XMLDocumentIdentifier>
Translate the globallocator
variable, which is a SAX locator and should be updated "under the hood" by the XML input parser which uses "this" as its event drain.
(This information can only have "element" granularity, since attribute source text position is already forgotten.)(package private) void
drop()
void
void
void
endElement
(String namespaceURI, String localName, String qName) void
endPrefixMapping
(String pref) void
ignorableWhitespace
(char[] ch, int start, int length) void
processingInstruction
(String name, String v) (package private) void
push
(DTM.Element element, Attributes atts, AttributeChecks_valueTemplates ac, boolean isxsl, boolean startNewTdomThread) (package private) void
push
(NamespaceName n, DTM.Element element, Attributes atts, AttributeChecks_valueTemplates ac, boolean isxsl, boolean startNewTdomThread) void
setDocumentLocator
(Locator locator) (package private) void
signalError
(String text) void
skippedEntity
(String name) void
void
startElement
(String namespaceURI, String localName, String qName, Attributes atts) void
startPrefixMapping
(String pref, String uri) (package private) void
Methods inherited from class eu.bandm.tools.xslt.base.MessageSender
error, error, error, error, failure, getLocation, hint, log, log, setMsg, setTrace, warning, warning, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
xsltDtd
-
xsltDtm
-
sax_parse_methods_xslt
-
EMPTY_ATTRIBUTES
-
tpathCache
Cache for all parsed tpath expressions. Syntax only, therefore shared by all xslt code. FIXME how serialized !?!?! -
stylesheet
eu.bandm.tools.xslt.tdom.Element_xsl_stylesheet stylesheet -
result_subtrees
Links from xslt elements at LEAF position to their raw/MultiType contents. These also contain the parsed tpath expressions of those attribute values (of the later result element) which are AVTs. -
ns_contexts
Map from every xslt code node or target language element (completeElement
or incompleteMultiTypeNodeList
) to the valid namspace prefix mapping. It simply "freezes" a point in the dynamic state ofns_prefixMap
.
This is necessary because namespace prefices must be resolved not only in sax events (which are already resolved consistently, when arriving here!-) BUT ALSO LATER when evaluating xpath expressions and some object names stored in attributes (parameters, variables, attribute sets).
Is easy to produce because it is TOTALLY STATIC info. -
ownUri
-
resultContext
Aux comprehension of result dtd features. Null if plain text or nothing (in case of libraries) is generated as an output. FIXME stimmtnicht Resultcontext.textOnly für text only ! -
tdom_drain
ContentHandler tdom_drainCurrent output to which the sax events will be forwarded. Holds a queue on which a tdom sax parsing thread is actively reading. Will be switched according to changes of "tree colour". -
sax_disposer
-
locator
Locator locator -
tos
Models the nesting of result elements under constrcution. Each sub-tree of embedded/intervening xslt elements is modelled by one(1) common stack frame. But all target dtd tdom elements get one dedicated stack for each nesting level. This is because at the beginning of their parsing we do not know whether this will succeed, or whether a MultiTypeNodeList must be constructed due to embedded xslt elements. -
ns_prefixMap
Currently valid prefix map, reflecting the map-directives of the SAX input (=xslt source), initially mapping only the empty prefix to the empty (non-ns) url, and "xml" to the xml namespace uri. -
FLAG
-
parseListener
Is called by tdom sax parsing code wheneven an element is completed. FIXME MORE
-
-
Constructor Details
-
Templates
public Templates(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, Trace trace, URI ownUri, ResultContext resultContext) - Parameters:
trace
- set of flags for trace on/offownUri
- position of the file to parseresultContext
- wraps all info from result tdom and dtd
-
-
Method Details
-
currentLocation
Location<XMLDocumentIdentifier> currentLocation()Translate the globallocator
variable, which is a SAX locator and should be updated "under the hood" by the XML input parser which uses "this" as its event drain.
(This information can only have "element" granularity, since attribute source text position is already forgotten.) -
dump
-
push
void push(DTM.Element element, Attributes atts, AttributeChecks_valueTemplates ac, boolean isxsl, boolean startNewTdomThread) -
push
void push(NamespaceName n, DTM.Element element, Attributes atts, AttributeChecks_valueTemplates ac, boolean isxsl, boolean startNewTdomThread) -
drop
void drop() -
switchTosToRawMode
void switchTosToRawMode() -
signalError
-
startPrefixMapping
- Specified by:
startPrefixMapping
in interfaceContentHandler
-
endPrefixMapping
- Specified by:
endPrefixMapping
in interfaceContentHandler
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Throws:
SAXException
-
skippedEntity
- Specified by:
skippedEntity
in interfaceContentHandler
- Throws:
SAXException
-
processingInstruction
- Specified by:
processingInstruction
in interfaceContentHandler
-
startDocument
public void startDocument()- Specified by:
startDocument
in interfaceContentHandler
-
endDocument
public void endDocument()- Specified by:
endDocument
in interfaceContentHandler
-
ignorableWhitespace
- Specified by:
ignorableWhitespace
in interfaceContentHandler
- Throws:
SAXException
-
characters
- Specified by:
characters
in interfaceContentHandler
- Throws:
SAXException
-
setDocumentLocator
- Specified by:
setDocumentLocator
in interfaceContentHandler
-