dbertoni 00/12/15 15:25:58
Modified: c/src/DOMSupport DOMSupport.hpp DOMSupportDefault.cpp
DOMSupportDefault.hpp
c/src/TestXSLT process.cpp
c/src/XPath XPathExecutionContext.hpp
XPathExecutionContextDefault.cpp
XPathExecutionContextDefault.hpp XPathSupport.hpp
XPathSupportDefault.cpp XPathSupportDefault.hpp
c/src/XSLT FunctionUnparsedEntityURI.cpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
c/src/XercesParserLiaison XercesDOMSupport.cpp
XercesDOMSupport.hpp
Log:
Changes to integrate new Xalan source tree.
Revision Changes Path
1.5 +14 -0 xml-xalan/c/src/DOMSupport/DOMSupport.hpp
Index: DOMSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMSupport.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DOMSupport.hpp 2000/11/02 01:45:28 1.4
+++ DOMSupport.hpp 2000/12/15 23:25:54 1.5
@@ -73,6 +73,7 @@
class XalanAttr;
+class XalanDocument;
class XalanElement;
class XalanNode;
class XalanText;
@@ -121,6 +122,19 @@
*/
virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const = 0;
+
+ /**
+ * Retrieves the URI of the named unparsed entity
+ * from the supplied document.
+ *
+ * @param theName The name of the entity
+ * @param theDocument The document that contains the entity
+ * @return The URI of the entity
+ */
+ virtual const XalanDOMString&
+ getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const = 0;
};
1.7 +70 -0 xml-xalan/c/src/DOMSupport/DOMSupportDefault.cpp
Index: DOMSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMSupportDefault.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DOMSupportDefault.cpp 2000/11/02 01:45:28 1.6
+++ DOMSupportDefault.cpp 2000/12/15 23:25:54 1.7
@@ -65,7 +65,10 @@
#include <XalanDOM/XalanNode.hpp>
#include <XalanDOM/XalanAttr.hpp>
#include <XalanDOM/XalanDocument.hpp>
+#include <XalanDOM/XalanDocumentType.hpp>
#include <XalanDOM/XalanElement.hpp>
+#include <XalanDOM/XalanEntity.hpp>
+#include <XalanDOM/XalanNamedNodeMap.hpp>
@@ -155,4 +158,71 @@
return m_pool.get(theResult);
#endif
}
+}
+
+
+
+const XalanDOMString&
+DOMSupportDefault::getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const
+{
+ XalanDOMString theURI;
+
+ const XalanDocumentType* const theDoctype =
+ theDocument.getDoctype();
+
+ if(theDoctype != 0)
+ {
+ const XalanNamedNodeMap* const theEntities =
+ theDoctype->getEntities();
+
+ if (theEntities != 0)
+ {
+ const XalanNode* const theNode =
+ theEntities->getNamedItem(theName);
+
+ if (theNode != 0 && theNode->getNodeType() ==
XalanNode::ENTITY_NODE)
+ {
+ const XalanEntity* theEntity =
+#if defined(XALAN_OLD_STYLE_CASTS)
+ (const XalanEntity*)theNode;
+#else
+ static_cast<const
XalanEntity*>(theNode);
+#endif
+
+ const XalanDOMString
theNotationName(theEntity->getNotationName());
+
+ if(isEmpty(theNotationName) == false) // then
it's unparsed
+ {
+ // The draft says: "The XSLT processor
may use the public
+ // identifier to generate a URI for the
entity instead of the URI
+ // specified in the system identifier.
If the XSLT processor does
+ // not use the public identifier to
generate the URI, it must use
+ // the system identifier; if the system
identifier is a relative
+ // URI, it must be resolved into an
absolute URI using the URI of
+ // the resource containing the entity
declaration as the base
+ // URI [RFC2396]."
+ // So I'm falling a bit short here.
+ theURI = theEntity->getSystemId();
+
+ if(isEmpty(theURI) == true)
+ {
+ theURI =
theEntity->getPublicId();
+ }
+ else
+ {
+ // This should be resolved to
an absolute URL, but that's hard
+ // to do from here.
+ }
+ }
+ }
+ }
+ }
+
+#if defined(XALAN_NO_MUTABLE)
+ return ((DOMSupportDefault*)this)->m_pool.get(theURI);
+#else
+ return m_pool.get(theURI);
+#endif
}
1.5 +5 -0 xml-xalan/c/src/DOMSupport/DOMSupportDefault.hpp
Index: DOMSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMSupportDefault.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DOMSupportDefault.hpp 2000/11/02 01:45:28 1.4
+++ DOMSupportDefault.hpp 2000/12/15 23:25:54 1.5
@@ -97,6 +97,11 @@
virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const;
+ virtual const XalanDOMString&
+ getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const;
+
private:
const XalanDOMString&
1.50 +79 -6 xml-xalan/c/src/TestXSLT/process.cpp
Index: process.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/TestXSLT/process.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- process.cpp 2000/12/12 15:17:57 1.49
+++ process.cpp 2000/12/15 23:25:55 1.50
@@ -129,6 +129,12 @@
+#include <XalanSourceTree/XalanSourceTreeDOMSupport.hpp>
+#include <XalanSourceTree/XalanSourceTreeInit.hpp>
+#include <XalanSourceTree/XalanSourceTreeParserLiaison.hpp>
+
+
+
#include <XSLT/XSLTEngineImpl.hpp>
#include <XSLT/XSLTInit.hpp>
#include <XSLT/XSLTInputSource.hpp>
@@ -215,6 +221,8 @@
<< endl
<< " [-PARAM name expression (Sets a stylesheet parameter.)]"
<< endl
+ << " [-XST Use XSLT source tree instead of Xerces DOM]"
+ << endl
<< endl
<< "The following options are valid only with -HTML or -XML."
<< endl
@@ -238,7 +246,6 @@
-
#if defined(XALAN_NEEDS_EXPLICIT_TEMPLATE_INSTANTIATION)
#include<stl/_tree.c>
#endif
@@ -265,6 +272,7 @@
bool doValidation;
bool noIndent;
bool formatToNull;
+ bool useXST;
int indentAmount;
int outputType;
CharVectorType outFileName;
@@ -289,6 +297,7 @@
doValidation(false),
noIndent(false),
formatToNull(false),
+ useXST(false),
indentAmount(-1),
outputType(-1),
outFileName(),
@@ -529,6 +538,10 @@
{
p.traceTemplateChildren = true;
}
+ else if (!stricmp("-XST", argv[i]))
+ {
+ p.useXST = true;
+ }
else
{
cerr << endl << "Warning: Ignoring unknown option \""
<< argv[i] << "\"." << endl << endl;
@@ -692,9 +705,50 @@
+DOMSupport&
+getDOMSupport(
+ XalanSourceTreeDOMSupport& theXalanSourceTreeDOMSupport,
+ XercesDOMSupport& theXercesDOMSupport,
+ const CmdLineParams& params)
+{
+ if (params.useXST == true)
+ {
+ return theXalanSourceTreeDOMSupport;
+ }
+ else
+ {
+ return theXercesDOMSupport;
+ }
+}
+
+
+
+XMLParserLiaison&
+getParserLiaison(
+ XalanSourceTreeParserLiaison& theXalanSourceTreeParserLiaison,
+ XercesParserLiaison& theXercesParserLiaison,
+ const CmdLineParams& params)
+{
+ if (params.useXST == true)
+ {
+ return theXalanSourceTreeParserLiaison;
+ }
+ else
+ {
+ return theXercesParserLiaison;
+ }
+}
+
+
+
int
xsltMain(const CmdLineParams& params)
{
+ // Initialize the XSLT subsystem. This must stay in scope until
+ // we're done with the subsystem, since its destructor shuts down
+ // the subsystem.
+ XSLTInit theInit;
+
#if defined(XALAN_USE_ICU)
// Create an installer to install the substitue format-number()
function.
FunctionICUFormatNumber::FunctionICUFormatNumberInstaller
theInstaller;
@@ -716,8 +770,30 @@
XalanStdOutputStream theStdErr(cerr);
XalanOutputStreamPrintWriter diagnosticsWriter(theStdErr);
- XercesDOMSupport theDOMSupport;
- XercesParserLiaison xmlParserLiaison(theDOMSupport);
+ // Initialize the XalanSourceTree subsystem. This must stay in scope
until
+ // we're done with the subsystem, since its destructor shuts down the
+ // subsystem.
+ XalanSourceTreeInit theXalanSourceTreeInit;
+
+ XalanSourceTreeDOMSupport theXalanSourceTreeDOMSupport;
+ XalanSourceTreeParserLiaison
theXalanSourceTreeParserLiaison(theXalanSourceTreeDOMSupport);
+
+ // Hookup the parser liaison instance to the support instance.
+
theXalanSourceTreeDOMSupport.setParserLiaison(&theXalanSourceTreeParserLiaison);
+
+
+ XercesDOMSupport theXercesDOMSupport;
+ XercesParserLiaison
theXercesParserLiaison(theXercesDOMSupport);
+
+ DOMSupport& theDOMSupport = getDOMSupport(
+ theXalanSourceTreeDOMSupport,
+ theXercesDOMSupport,
+ params);
+
+ XMLParserLiaison& xmlParserLiaison = getParserLiaison(
+ theXalanSourceTreeParserLiaison,
+ theXercesParserLiaison,
+ params);
XPathSupportDefault
theXPathSupport(theDOMSupport);
XSLTProcessorEnvSupportDefault theXSLProcessorSupport;
@@ -1009,10 +1085,7 @@
{
try
{
- XSLTInit theInit;
-
theResult = xsltMain(theParams);
-
}
catch (XSLException& e)
{
1.30 +1 -1 xml-xalan/c/src/XPath/XPathExecutionContext.hpp
Index: XPathExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContext.hpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- XPathExecutionContext.hpp 2000/12/04 20:48:18 1.29
+++ XPathExecutionContext.hpp 2000/12/15 23:25:55 1.30
@@ -655,7 +655,7 @@
* @param theDocument document containing entity
* @return URI for the entity
*/
- virtual XalanDOMString
+ virtual const XalanDOMString&
getUnparsedEntityURI(
const XalanDOMString& theName,
const XalanDocument& theDocument) const = 0;
1.28 +1 -1 xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp
Index: XPathExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- XPathExecutionContextDefault.cpp 2000/12/04 20:48:18 1.27
+++ XPathExecutionContextDefault.cpp 2000/12/15 23:25:55 1.28
@@ -497,7 +497,7 @@
-XalanDOMString
+const XalanDOMString&
XPathExecutionContextDefault::getUnparsedEntityURI(
const XalanDOMString& theName,
const XalanDocument& theDocument) const
1.28 +1 -1 xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp
Index: XPathExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- XPathExecutionContextDefault.hpp 2000/12/04 20:48:18 1.27
+++ XPathExecutionContextDefault.hpp 2000/12/15 23:25:55 1.28
@@ -256,7 +256,7 @@
virtual XalanDOMString
findURIFromDoc(const XalanDocument* owner) const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getUnparsedEntityURI(
const XalanDOMString& theName,
const XalanDocument& theDocument) const;
1.9 +1 -1 xml-xalan/c/src/XPath/XPathSupport.hpp
Index: XPathSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupport.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XPathSupport.hpp 2000/11/02 01:46:03 1.8
+++ XPathSupport.hpp 2000/12/15 23:25:55 1.9
@@ -217,7 +217,7 @@
// completely expand entities before the structure model is passed to
the
// DOM; in this case, there will be no EntityReferences in the DOM
tree."
// So I'm not sure how well this is going to work.
- virtual XalanDOMString
+ virtual const XalanDOMString&
getUnparsedEntityURI(
const XalanDOMString& theName,
const XalanDocument& theDocument) const = 0;
1.12 +4 -61 xml-xalan/c/src/XPath/XPathSupportDefault.cpp
Index: XPathSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupportDefault.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XPathSupportDefault.cpp 2000/11/02 01:46:03 1.11
+++ XPathSupportDefault.cpp 2000/12/15 23:25:56 1.12
@@ -63,10 +63,6 @@
#include <XalanDOM/XalanDocument.hpp>
-#include <XalanDOM/XalanDocumentType.hpp>
-#include <XalanDOM/XalanElement.hpp>
-#include <XalanDOM/XalanEntity.hpp>
-#include <XalanDOM/XalanNamedNodeMap.hpp>
@@ -199,63 +195,10 @@
-XalanDOMString
+const XalanDOMString&
XPathSupportDefault::getUnparsedEntityURI(
- const XalanDOMString& theName,
- const XalanDocument& theDocument) const
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const
{
- XalanDOMString theURI;
-
- const XalanDocumentType* const theDoctype =
- theDocument.getDoctype();
-
- if(theDoctype != 0)
- {
- const XalanNamedNodeMap* const theEntities =
- theDoctype->getEntities();
-
- if (theEntities != 0)
- {
- const XalanNode* const theNode =
- theEntities->getNamedItem(theName);
-
- if (theNode != 0 && theNode->getNodeType() ==
XalanNode::ENTITY_NODE)
- {
- const XalanEntity* theEntity =
-#if defined(XALAN_OLD_STYLE_CASTS)
- (const XalanEntity*)theNode;
-#else
- static_cast<const
XalanEntity*>(theNode);
-#endif
-
- const XalanDOMString
theNotationName(theEntity->getNotationName());
-
- if(isEmpty(theNotationName) == false) // then
it's unparsed
- {
- // The draft says: "The XSLT processor
may use the public
- // identifier to generate a URI for the
entity instead of the URI
- // specified in the system identifier.
If the XSLT processor does
- // not use the public identifier to
generate the URI, it must use
- // the system identifier; if the system
identifier is a relative
- // URI, it must be resolved into an
absolute URI using the URI of
- // the resource containing the entity
declaration as the base
- // URI [RFC2396]."
- // So I'm falling a bit short here.
- theURI = theEntity->getSystemId();
-
- if(isEmpty(theURI) == true)
- {
- theURI =
theEntity->getPublicId();
- }
- else
- {
- // This should be resolved to
an absolute URL, but that's hard
- // to do from here.
- }
- }
- }
- }
- }
-
- return theURI;
+ return m_DOMSupport.getUnparsedEntityURI(theName, theDocument);
}
1.9 +1 -1 xml-xalan/c/src/XPath/XPathSupportDefault.hpp
Index: XPathSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupportDefault.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XPathSupportDefault.hpp 2000/11/02 01:46:03 1.8
+++ XPathSupportDefault.hpp 2000/12/15 23:25:56 1.9
@@ -129,7 +129,7 @@
virtual bool
getProcessNamespaces() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getUnparsedEntityURI(
const XalanDOMString& theName,
const XalanDocument& theDocument) const;
1.13 +1 -1 xml-xalan/c/src/XSLT/FunctionUnparsedEntityURI.cpp
Index: FunctionUnparsedEntityURI.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/FunctionUnparsedEntityURI.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- FunctionUnparsedEntityURI.cpp 2000/12/06 21:19:38 1.12
+++ FunctionUnparsedEntityURI.cpp 2000/12/15 23:25:56 1.13
@@ -118,7 +118,7 @@
context->getOwnerDocument();
assert(doc != 0);
- const XalanDOMString uri =
executionContext.getUnparsedEntityURI(name, *doc);
+ const XalanDOMString& uri =
executionContext.getUnparsedEntityURI(name, *doc);
return executionContext.getXObjectFactory().createString(uri);
}
1.41 +1 -1 xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- StylesheetExecutionContext.hpp 2000/12/05 17:41:33 1.40
+++ StylesheetExecutionContext.hpp 2000/12/15 23:25:56 1.41
@@ -1472,7 +1472,7 @@
virtual XalanDocument*
getDOMFactory() const = 0;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getUnparsedEntityURI(
const XalanDOMString& theName,
const XalanDocument& theDocument) const = 0;
1.45 +1 -1
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- StylesheetExecutionContextDefault.cpp 2000/12/05 15:32:40 1.44
+++ StylesheetExecutionContextDefault.cpp 2000/12/15 23:25:57 1.45
@@ -1618,7 +1618,7 @@
-XalanDOMString
+const XalanDOMString&
StylesheetExecutionContextDefault::getUnparsedEntityURI(
const XalanDOMString& theName,
const XalanDocument& theDocument) const
1.41 +1 -1
xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file:
/home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- StylesheetExecutionContextDefault.hpp 2000/12/04 20:48:35 1.40
+++ StylesheetExecutionContextDefault.hpp 2000/12/15 23:25:57 1.41
@@ -701,7 +701,7 @@
virtual XalanDocument*
getDOMFactory() const;
- virtual XalanDOMString
+ virtual const XalanDOMString&
getUnparsedEntityURI(
const XalanDOMString& theName,
const XalanDocument& theDocument) const;
1.4 +10 -0 xml-xalan/c/src/XercesParserLiaison/XercesDOMSupport.cpp
Index: XercesDOMSupport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDOMSupport.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesDOMSupport.cpp 2000/11/02 01:46:43 1.3
+++ XercesDOMSupport.cpp 2000/12/15 23:25:57 1.4
@@ -116,3 +116,13 @@
{
return m_domSupportDefault.getExpandedAttributeName(attr);
}
+
+
+
+const XalanDOMString&
+XercesDOMSupport::getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const
+{
+ return m_domSupportDefault.getUnparsedEntityURI(theName, theDocument);
+}
1.3 +5 -0 xml-xalan/c/src/XercesParserLiaison/XercesDOMSupport.hpp
Index: XercesDOMSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesDOMSupport.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesDOMSupport.hpp 2000/11/02 01:46:43 1.2
+++ XercesDOMSupport.hpp 2000/12/15 23:25:57 1.3
@@ -112,6 +112,11 @@
virtual const XalanDOMString&
getExpandedAttributeName(const XalanAttr& attr) const;
+ virtual const XalanDOMString&
+ getUnparsedEntityURI(
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const;
+
private:
DOMSupportDefault m_domSupportDefault;