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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Attributes(package private) final Object(package private) Locatorfinal Map<TypedSubstantial, Binding<String, String>> Map from every xslt code node or target language element (completeElementor 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.ParseListenerIs 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 ResultContextAux 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) ContentHandlerCurrent output to which the sax events will be forwarded.(package private) Templates.StackframeModels the nesting of result elements under constrcution.static final TPathCacheCache for all parsed tpath expressions.static final DTD.Dtdstatic final DTM.DtdFields inherited from class eu.bandm.tools.xslt.base.MessageSender
msg, trace -
Constructor Summary
ConstructorsConstructorDescriptionTemplates(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg, Trace trace, URI ownUri, ResultContext resultContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) (package private) Location<XMLDocumentIdentifier> Translate the globallocatorvariable, 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) voiddrop()voidvoidvoidendElement(String namespaceURI, String localName, String qName) voidendPrefixMapping(String pref) voidignorableWhitespace(char[] ch, int start, int length) voidprocessingInstruction(String name, String v) (package private) voidpush(DTM.Element element, Attributes atts, AttributeChecks_valueTemplates ac, boolean isxsl, boolean startNewTdomThread) (package private) voidpush(NamespaceName n, DTM.Element element, Attributes atts, AttributeChecks_valueTemplates ac, boolean isxsl, boolean startNewTdomThread) voidsetDocumentLocator(Locator locator) (package private) voidsignalError(String text) voidskippedEntity(String name) voidvoidstartElement(String namespaceURI, String localName, String qName, Attributes atts) voidstartPrefixMapping(String pref, String uri) (package private) voidMethods inherited from class eu.bandm.tools.xslt.base.MessageSender
error, error, error, error, failure, getLocation, hint, log, log, setMsg, setTrace, warning, warning, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 (completeElementor 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 globallocatorvariable, 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:
startPrefixMappingin interfaceContentHandler
-
endPrefixMapping
- Specified by:
endPrefixMappingin interfaceContentHandler
-
startElement
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException - Specified by:
startElementin interfaceContentHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Throws:
SAXException
-
skippedEntity
- Specified by:
skippedEntityin interfaceContentHandler- Throws:
SAXException
-
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler
-
startDocument
public void startDocument()- Specified by:
startDocumentin interfaceContentHandler
-
endDocument
public void endDocument()- Specified by:
endDocumentin interfaceContentHandler
-
ignorableWhitespace
- Specified by:
ignorableWhitespacein interfaceContentHandler- Throws:
SAXException
-
characters
- Specified by:
charactersin interfaceContentHandler- Throws:
SAXException
-
setDocumentLocator
- Specified by:
setDocumentLocatorin interfaceContentHandler
-