 |
Xalan-C++ API Reference
1.12.0
|
Go to the documentation of this file.
18 #if !defined(XALAN_XSLTENGINEIMPL_HEADER_GUARD)
19 #define XALAN_XSLTENGINEIMPL_HEADER_GUARD
43 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
81 namespace XERCES_CPP_NAMESPACE
84 class DocumentHandler;
96 using xercesc::InputSource;
97 using xercesc::DocumentHandler;
105 class StylesheetConstructionContext;
106 class StylesheetRoot;
108 class XalanSourceTreeDocument;
110 class XMLParserLiaison;
112 class XPathEnvSupport;
114 class XPathProcessor;
115 class XSLTResultTarget;
142 if (theLHS == 0 && theRHS != 0)
146 else if (theRHS == 0)
152 return theLHS->
compare(*theRHS) < 0 ? true :
false;
173 assert(theString != 0);
175 return *theString == m_string;
207 MemoryManager& theManager,
220 return m_xpathConstructionContext.getMemoryManager();
226 return m_xpathConstructionContext.getMemoryManager();
249 const Locator* locator,
345 const XPath* xpath)
const;
389 DocumentHandler* docHandler,
391 ErrorHandler* theErrorHandler = 0);
406 const InputSource& inputSource,
407 DocumentHandler* docHandler,
409 ErrorHandler* theErrorHandler = 0);
448 addResultNamespaceDecl(
450 namespaceVal.
c_str(),
464 const XalanDOMChar* namespaceVal,
467 m_resultNamespacesStack.addDeclaration(
488 bool fromCopy =
false,
489 const Locator* locator = 0)
513 const XalanDOMChar* value,
514 bool fromCopy =
false,
515 const Locator* locator = 0)
541 const XalanDOMChar* value,
543 bool fromCopy =
false,
544 const Locator* locator = 0);
558 const XalanDOMChar* value,
559 bool fromCopy =
false,
560 const Locator* locator = 0)
562 assert(m_outputContextStack.empty() ==
false);
565 getPendingAttributesImpl(),
585 bool fromCopy =
false,
586 const Locator* locator = 0)
588 assert(m_outputContextStack.empty() ==
false);
591 getPendingAttributesImpl(),
606 const Locator* locator);
619 const XalanDOMChar* name,
627 const XalanDOMChar* ch,
632 const XalanDOMChar* ch,
637 const XalanDOMChar* target,
638 const XalanDOMChar* data);
652 const XalanDOMChar* ch,
692 const XalanDOMChar* ch,
738 const XalanDOMChar* ch,
752 bool cloneTextNodesOnly,
753 const Locator* locator);
770 bool shouldCloneAttributes,
771 bool cloneTextNodesOnly,
772 const Locator* locator);
784 bool outputTextNodesOnly,
785 const Locator* locator);
798 bool outputTextNodesOnly,
799 const Locator* locator)
801 outputResultTreeFragment(
818 bool outputTextNodesOnly,
819 const Locator* locator);
854 return s_XSLNameSpaceURL;
865 return s_XalanNamespaceURL;
876 return m_quietConflictWarnings;
1016 return m_xpathFactory;
1027 return *m_xpathProcessor.get();
1045 return m_xpathEnvSupport;
1059 m_problemListener = l;
1073 return m_problemListener;
1084 m_outputContextStack.pushContext(theListener);
1093 m_outputContextStack.popContext();
1103 return getHasPendingStartDocumentImpl();
1113 setHasPendingStartDocumentImpl(b);
1123 return getMustFlushPendingStartDocumentImpl();
1133 setMustFlushPendingStartDocumentImpl(b);
1144 return getPendingAttributesImpl();
1155 getPendingAttributesImpl() = pendingAttributes;
1167 const XalanDOMChar* theName,
1168 const XalanDOMChar* theNewType,
1169 const XalanDOMChar* theNewValue)
1173 getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue);
1179 return !getPendingElementNameImpl().empty();
1190 return getPendingElementNameImpl();
1201 setPendingElementNameImpl(elementName);
1207 setPendingElementNameImpl(elementName);
1218 return m_stylesheetLocatorStack.empty() ==
true ? 0 : m_stylesheetLocatorStack.back();
1229 m_stylesheetLocatorStack.push_back(locator);
1238 if (m_stylesheetLocatorStack.empty() ==
false)
1240 m_stylesheetLocatorStack.pop_back();
1254 return m_outputContextStack.getPendingAttributes();
1265 return m_outputContextStack.getPendingAttributes();
1276 getPendingAttributesImpl() = pendingAttributes;
1287 return m_outputContextStack.getPendingElementName();
1298 return m_outputContextStack.getPendingElementName();
1309 m_outputContextStack.getPendingElementName() = elementName;
1320 assert(elementName != 0);
1322 m_outputContextStack.getPendingElementName() = elementName;
1332 return m_outputContextStack.getHasPendingStartDocument();
1342 m_outputContextStack.getHasPendingStartDocument() = b;
1352 return m_outputContextStack.getMustFlushPendingStartDocument();
1362 m_outputContextStack.getMustFlushPendingStartDocument() = b;
1368 return m_outputContextStack.getFormatterListener();
1374 m_outputContextStack.getFormatterListener() = flistener;
1424 warnCopyTextNodesOnly(
1426 const Locator* locator);
1437 bool overrideStrip);
1444 pendingAttributesHasDefaultNS()
const;
1452 bool fOnlyIfPrefixNotPresent);
1458 bool fOnlyIfPrefixNotPresent =
false);
1499 bool m_traceSelects;
1505 bool m_quietConflictWarnings;
1529 const Locator& locator,
1544 XMLUInt32 m_uniqueNSValue;
1556 m_topLevelParams.
clear();
1562 generateCDATASection()
const
1564 if (m_hasCDATASectionElements ==
false)
1570 assert(m_cdataStack.
empty() ==
false);
1572 return m_cdataStack.
back();
1579 setMustFlushPendingStartDocument(
true);
1592 isCDataResultElem(
const XalanDOMString& elementName);
1595 fireCharacterGenerateEvent(
1596 const XalanNode& theNode,
1600 fireCharacterGenerateEvent(
1601 const XObjectPtr& theXObject,
1605 fireCharacterGenerateEvent(
1606 const XalanDOMString& theString,
1610 fireCharacterGenerateEvent(
1611 const XalanDOMChar* ch,
1617 checkDefaultNamespace(
1618 const XalanDOMString& theElementName,
1619 const XalanDOMString& theElementNamespaceURI);
1623 const XalanDOMString& theMessage,
1624 const Locator* theLocator,
1625 const XalanNode* theSourceNode);
1629 const XalanDOMString& theMessage,
1630 const Locator* theLocator,
1631 const XalanNode* theSourceNode);
1635 const XalanDOMString& theMessage,
1636 const Locator* theLocator,
1637 const XalanNode* theSourceNode);
1640 XMLParserLiaison& m_parserLiaison;
1642 XPathEnvSupport& m_xpathEnvSupport;
1644 DOMSupport& m_domSupport;
1649 StylesheetExecutionContext* m_executionContext;
1654 OutputContextStack m_outputContextStack;
1659 XalanNamespacesStack m_resultNamespacesStack;
1664 AttributeListImpl m_dummyAttributesList;
1666 XalanDOMString m_scratchString;
1668 XalanDOMStringPointerVectorType m_attributeNamesVisited;
1670 bool m_hasCDATASectionElements;
1672 XPathConstructionContextDefault m_xpathConstructionContext;
1674 ParamMapType m_stylesheetParams;
1677 installFunctions(MemoryManager& theManager);
1680 uninstallFunctions();
1683 static const XalanDOMString s_emptyString;
1685 static const XalanDOMString& s_stylesheetNodeName;
1686 static const XalanDOMString& s_typeString;
1687 static const XalanDOMString& s_hrefString;
1688 static const XalanDOMString& s_piTokenizerString;
1689 static const XalanDOMString& s_typeValueString1;
1690 static const XalanDOMString& s_typeValueString2;
1691 static const XalanDOMString& s_typeValueString3;
1692 static const XalanDOMString& s_typeValueString4;
1695 XSLTEngineImpl(
const XSLTEngineImpl&);
1698 operator=(
const XSLTEngineImpl&);
1710 #endif // XALAN_XSLTENGINEIMPL_HEADER_GUARD
Stylesheet * getStylesheetFromPIURL(const XalanDOMString &xslURLString, XalanNode &fragBase, const XalanDOMString &xmlBaseIdent, bool isRoot, StylesheetConstructionContext &constructionContext)
Reset the state of the XSL processor by reading in a new XSL stylesheet from a processing instruction...
void replacePendingAttribute(const XalanDOMChar *theName, const XalanDOMChar *theNewType, const XalanDOMChar *theNewValue)
Replace the contents of a pending attribute.
virtual void setStylesheetParam(const XalanDOMString &key, XObjectPtr value)
Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.
void flushPending()
Flush the pending element.
virtual void setStylesheetRoot(const StylesheetRoot *theStylesheet)
Set the root stylesheet.
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMChar *value, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
void entityReference(const XalanDOMChar *data)
Receive notification of a entityReference.
XPathProcessor & getXPathProcessor()
Get the XPath processor object.
XalanVector< bool > BoolVectorType
virtual void fireGenerateEvent(const GenerateEvent &ge)
Fire a generate event.
void charactersRaw(const XObjectPtr &xobject)
Send raw character data from an XObject to the result tree.
void copyNamespaceAttributes(const XalanNode &src)
Copy XMLNS: attributes in if not already in scope.
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
XalanMap< XalanDOMString, XalanParamHolder > ParamMapType
MemoryManager & getMemoryManager()
virtual StylesheetRoot * processStylesheet(const XalanDOMString &xsldocURLString, StylesheetConstructionContext &constructionContext)
Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation.
xercesc::AttributeList AttributeListType
const Locator * getLocatorFromStack() const
Get the locator from the top of the locator stack.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
virtual void fireSelectEvent(const SelectionEvent &se)
Fire a selection event.
Function::XObjectArgVectorType XObjectArgVectorType
void setFormatterListenerImpl(FormatterListener *flistener)
bool isPendingResultPrefix(const XalanDOMString &thePrefix) const
Determine whether or not a prefix is in use on the pending element or the pending attributes.
bool operator()(const XalanDOMString *theString) const
virtual XMLParserLiaison & getXMLParserLiaison() const
Get the XML Parser Liaison that this processor uses.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XalanNode *contextNode, const XalanElement &prefixResolver, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
void pushLocatorOnStack(const Locator *locator)
Push a locator on to the locator stack.
XPathExecutionContext::GetCachedString ECGetCachedString
void ignorableWhitespace(const XalanDOMChar *ch, size_type length)
virtual const XalanDocumentFragment & rtree() const
Cast result object to a result tree fragment.
void setPendingElementName(const XalanDOMString &elementName)
Changes the currently pending element name.
BoolVectorType m_cdataStack
Stack of Booleans to keep track of if we should be outputting cdata instead of escaped text.
void outputResultTreeFragment(const XalanDocumentFragment &theTree, bool outputTextNodesOnly, const Locator *locator)
Given a result tree fragment, walk the tree and output it to the result stream.
static const XalanDOMString & getXalanXSLNameSpaceURL()
Special Xalan namespace for built-in extensions.
void comment(const XalanDOMChar *data)
Called when a Comment is to be constructed.
virtual void setStylesheetParam(const XalanDOMString &key, const XalanDOMString &expression)
Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.
XPathEnvSupport & getXPathEnvSupport()
Retrieve the XPath environment support object.
void characters(const XObjectPtr &xobject)
Send character data from an XObject to the result tree.
#define XALAN_XSLT_EXPORT
void setPendingAttributes(const AttributeListType &pendingAttributes)
Set the list of attributes yet to be processed.
XalanVector< const XalanDOMString * > XalanDOMStringPointerVectorType
void endElement(const XalanDOMChar *name)
virtual void fireTraceEvent(const TracerEvent &te)
Fire a trace event.
int compare(const XalanDOMString &theString) const
XalanDOMString m_resultNameSpaceURL
The URL that belongs to the result namespace.
XalanDOMString m_resultNameSpacePrefix
The namespace that the result tree conforms to.
virtual size_type getTraceListeners() const
Determine the number of trace listeners.
void addResultAttribute(const XalanDOMString &aname, const XalanDOMChar *value, bool fromCopy=false, const Locator *locator=0)
Add attribute to pending attributes list, and if it is a namespace, add it to the namespaces stack.
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
virtual void addTraceListener(TraceListener *tl)
Add a trace listener for the purposes of debugging and diagnosis.
void setHasPendingStartDocument(bool b)
void outputResultTreeFragment(const XObject &theTree, bool outputTextNodesOnly, const Locator *locator)
Given a result tree fragment, walk the tree and output it to the result stream.
FindStringPointerFunctor(const XalanDOMString &theString)
Class to hold XObjectPtr return types.
ProblemListener * getProblemListener() const
Get the problem listener property.
It's the responsibility of the XSLTEngineImpl class, collaborating with the XML parser liaison,...
bool isElementPending() const
void charactersRaw(const XalanNode &node)
Send raw character data from the node to the result tree.
void processingInstruction(const XalanDOMChar *target, const XalanDOMChar *data)
const XObjectPtr evalXPathStr(const XalanDOMString &str, XalanNode *contextNode, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
virtual StylesheetRoot * processStylesheet(const XSLTInputSource &stylesheetSource, StylesheetConstructionContext &constructionContext)
Given a stylesheet input source, compile the stylesheet into an internal representation.
const XalanDOMString & getPendingElementName() const
Retrieve name of the pending element currently being processed.
xercesc::DocumentHandler DocumentHandlerType
virtual void setQuietConflictWarnings(bool b)
If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be print...
void copyAttributeToTarget(const XalanDOMString &attrName, const XalanDOMString &attrValue, AttributeListImpl &attrList)
Copy an attribute to an AttributeListImpl.
virtual ~XSLTEngineImpl()
void addResultNamespaceDecl(const XalanDOMString &prefix, const XalanDOMString &namespaceVal)
Add a namespace declaration to the namespace stack.
void startElement(const XalanDOMChar *name, AttributeListType &atts)
This is an interface for an XSLT Processor engine.
bool getHasPendingStartDocument() const
const XPathProcessorPtrType m_xpathProcessor
void characters(const XalanNode &node)
Send character data from the node to the result tree.
void reportDuplicateNamespaceNodeError(const XalanDOMString &theName, const Locator *locator)
Report an error copying a duplicate namespace node.
This is the abstract class that the XSL processor uses when it has a problem of some kind,...
void setMustFlushPendingStartDocument(bool b)
virtual void setExecutionContext(StylesheetExecutionContext *theExecutionContext)
Set the execution context.
void setPendingElementNameImpl(const XalanDOMString &elementName)
Changes the currently pending element name.
void pushOutputContext(FormatterListener *theListener)
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMString &value, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
const AttributeListType & getPendingAttributes() const
Get the list of attributes yet to be processed.
AttributeListImpl & getPendingAttributesImpl()
Get the list of attributes yet to be processed.
void cdata(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of cdata.
virtual void setFormatterListener(FormatterListener *flistener)
Set the current formatter listener.
void setHasPendingStartDocumentImpl(bool b)
Class to hold XPath return types.
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
void copyAttributesToAttList(const XalanNode &node, AttributeListImpl &attList)
Copy the attributes from the XSL element to the created output element.
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve a namespace corresponding to a prefix.
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMChar *value, size_type theLength, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
void setPendingElementName(const XalanDOMChar *elementName)
virtual void removeTraceListener(TraceListener *tl)
Remove a trace listener.
bool getMustFlushPendingStartDocumentImpl() const
XalanMemMgrAutoPtr< XPathProcessor > XPathProcessorPtrType
virtual void process(const XSLTInputSource &inputSource, const XSLTInputSource &stylesheetSource, XSLTResultTarget &outputTarget, StylesheetConstructionContext &constructionContext, StylesheetExecutionContext &executionContext)
Transform the source tree to the output in the given result tree target.
XalanVector< TraceListener * > TraceListenerVectorType
This class defines an interface for classes that resolve namespace prefixes to their URIs.
const XPath * createMatchPattern(const XalanDOMString &str, const PrefixResolver &resolver)
Create and initialize an xpath and return it.
The implementation of the default error handling for Xalan.
FormatterListener * getFormatterListenerImpl() const
void cloneToResultTree(const XalanNode &node, bool cloneTextNodesOnly, const Locator *locator)
Clone a node to the result tree.
void setPendingElementNameImpl(const XalanDOMChar *elementName)
Changes the currently pending element name.
void startElement(const XalanDOMChar *name)
Receive notification of the beginning of an element with an empty attribute list.
virtual const XalanDOMString & getURI() const
Retrieve the base URI for the resolver.
const XalanDOMString & getPendingElementNameImpl() const
Retrieve name of the pending element currently being processed.
bool getHasPendingStartDocumentImpl() const
void setPendingAttributesImpl(const AttributeListType &pendingAttributes)
Set the list of attributes yet to be processed.
XPathConstructionContext::GetCachedString CCGetCachedString
virtual void resolveTopLevelParams(StylesheetExecutionContext &executionContext)
Resolve the params that were pushed by the caller.
virtual const StylesheetRoot * getStylesheetRoot() const
Retrieve the root stylesheet.
void cloneToResultTree(const XalanNode &node, XalanNode::NodeType nodeType, bool overrideStrip, bool shouldCloneAttributes, bool cloneTextNodesOnly, const Locator *locator)
Clone a node to the result tree.
static const XalanDOMString & getXSLNameSpaceURL()
Retrieve the URI for the current XSL namespace, for example, "http://www.w3.org/1999/XSL/Transform".
virtual void process(const XSLTInputSource &inputSource, XSLTResultTarget &outputTarget, StylesheetExecutionContext &executionContext)
Transform the source tree to the output in the given result tree target.
XObjectFactory & m_xobjectFactory
XalanDocument * parseXML(const InputSource &inputSource, DocumentHandler *docHandler, XalanDocument *docToRegister, ErrorHandler *theErrorHandler=0)
Read in the XML file, either producing a Document or calling SAX events, and register the document in...
virtual bool getTraceSelects() const
If this is set to true, simple traces of template calls are made.
bool operator()(const XalanDOMString *theLHS, const XalanDOMString *theRHS) const
XSLTEngineImpl(MemoryManager &theManager, XMLParserLiaison &parserLiaison, XPathEnvSupport &xpathEnvSupport, DOMSupport &domSupport, XObjectFactory &xobjectFactory, XPathFactory &xpathFactory)
Construct an XSL processor that can call back to a XML processor, so it can handle included files,...
This is the parent class of events generated for tracing the progress of the XSL processor.
const XalanDOMChar * c_str() const
void characters(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of character data.
void setProblemListener(ProblemListener *l)
Set the problem listener property.
double evalMatchPatternStr(const XalanDOMString &str, XalanNode *context, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result as a numberic score.
This acts as the stylesheet root of the stylesheet tree, and holds values that are shared by all styl...
XalanDOMString & getPendingElementNameImpl()
Retrieve name of the pending element currently being processed.
xercesc::InputSource InputSourceType
void popLocatorStack()
Pop the locator from the top of the locator stack.
virtual void reset()
Reset the state.
virtual FormatterListener * getFormatterListener() const
Get the current formatter listener.
MemoryManager & getMemoryManager() const
const AttributeListImpl & getPendingAttributesImpl() const
Get the list of attributes yet to be processed.
This class represents the base stylesheet or an "import" stylesheet.
Local implementation of NodeRefList.
XPathFactory & getXPathFactory()
Get the factory for making xpaths.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
This is the class for events generated by the XSL processor after it generates a new node in the resu...
void addResultAttribute(const XalanDOMString &aname, const XalanDOMString &value, bool fromCopy=false, const Locator *locator=0)
Add attribute to pending attributes list, and if it is a namespace, add it to the namespaces stack.
virtual void clearStylesheetParams()
Clear any stylesheet params.
void outputToResultTree(const XObject &value, bool outputTextNodesOnly, const Locator *locator)
Output an object to the result tree by doing the right conversions.
virtual void setTraceSelects(bool b)
static void initialize(MemoryManager &theManager)
Perform initialization of statics – must be called before any processing occurs.
virtual XalanNode * getSourceTreeFromInput(const XSLTInputSource &inputSource)
Given an input source, get the source tree.
static void terminate()
Perform termination of statics.
void clearTopLevelParams()
Reset the vector of top level parameters.
const XalanDOMString * getResultNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve the result namespace corresponding to a prefix.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
XPathFactory & m_xpathFactory
void traceSelect(StylesheetExecutionContext &executionContext, const ElemTemplateElement &theTemplate, const NodeRefListBase &nl, const XPath *xpath) const
Compose a diagnostic trace of the current selection.
StylesheetExecutionContext::ParamVectorType ParamVectorType
virtual void getUniqueNamespaceValue(XalanDOMString &theValue)
Generate a random namespace prefix guaranteed to be unique.
bool getQuietConflictWarnings() const
Whether to warn about pattern match conflicts.
virtual void setDiagnosticsOutput(PrintWriter *pw)
If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
void charactersRaw(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of character data.
This class handles the creation of XObjects and manages their lifetime.
void addResultNamespaceDecl(const XalanDOMString &prefix, const XalanDOMChar *namespaceVal, size_type len)
Add a namespace declaration to the namespace stack.
void setMustFlushPendingStartDocumentImpl(bool b)
bool getMustFlushPendingStartDocument() const
void characters(const XalanDOMChar *ch, size_type length)
void setDocumentLocator(const Locator *locator)
XalanVector< const Locator * > LocatorStack
XalanDocument * parseXML(const XalanDOMString &urlString, DocumentHandler *docHandler, XalanDocument *docToRegister, ErrorHandler *theErrorHandler=0)
Read in the XML file, either producing a Document or calling SAX events, and register the document in...
void returnXPath(const XPath *xpath)
Return the xpath created by createXPath() or createMatchPattern().
const XalanDOMString * getResultPrefixForNamespace(const XalanDOMString &theNamespace) const
Retrieve the result prefix corresponding to a namespace.