You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/08/11 23:15:52 UTC
cvs commit: xml-xalan/c/src/XSLT Stylesheet.cpp Stylesheet.hpp StylesheetConstructionContext.hpp StylesheetConstructionContextDefault.cpp StylesheetConstructionContextDefault.hpp StylesheetHandler.cpp StylesheetRoot.cpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp
dbertoni 00/08/11 14:15:52
Modified: c/src/XSLT Stylesheet.cpp Stylesheet.hpp
StylesheetConstructionContext.hpp
StylesheetConstructionContextDefault.cpp
StylesheetConstructionContextDefault.hpp
StylesheetHandler.cpp StylesheetRoot.cpp
XSLTEngineImpl.cpp XSLTEngineImpl.hpp
Log:
Changes for new URISupport functions.
Revision Changes Path
1.30 +4 -14 xml-xalan/c/src/XSLT/Stylesheet.cpp
Index: Stylesheet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Stylesheet.cpp 2000/08/10 18:43:07 1.29
+++ Stylesheet.cpp 2000/08/11 21:15:44 1.30
@@ -148,15 +148,10 @@
{
if (length(m_baseIdent) != 0)
{
- typedef StylesheetConstructionContext::URLAutoPtrType URLAutoPtrType;
-
- URLAutoPtrType url(constructionContext.getURLFromString(m_baseIdent));
-
- if (url.get() != 0)
+ const XalanDOMString urlString = constructionContext.getURLStringFromString(m_baseIdent);
+ if (length(urlString) != 0)
{
- m_includeStack.push_back(url.get());
-
- url.release();
+ m_includeStack.push_back(urlString);
}
}
}
@@ -174,11 +169,6 @@
m_imports.end(),
DeleteFunctor<Stylesheet>());
- // Clean up all entries in the include vector.
- for_each(m_includeStack.begin(),
- m_includeStack.end(),
- DeleteFunctor<XMLURL>());
-
// Clean up the atribute sets vector
for_each(m_attributeSets.begin(),
m_attributeSets.end(),
@@ -1175,7 +1165,7 @@
}
else
{
- return m_includeStack.back()->getURLText();
+ return m_includeStack.back();
}
}
1.21 +1 -1 xml-xalan/c/src/XSLT/Stylesheet.hpp
Index: Stylesheet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/Stylesheet.hpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Stylesheet.hpp 2000/08/10 18:43:09 1.20
+++ Stylesheet.hpp 2000/08/11 21:15:44 1.21
@@ -138,7 +138,7 @@
typedef XALAN_STD vector<NamespaceVectorType> NamespacesStackType;
typedef XALAN_STD vector<QName> QNameVectorType;
typedef XALAN_STD vector<const Stylesheet*> StylesheetVectorType;
-typedef XALAN_STD vector<const XMLURL*> URLStackType;
+typedef XALAN_STD vector<XalanDOMString> URLStackType;
typedef XALAN_STD vector<const XPath*> XPathVectorType;
typedef XALAN_STD vector<ElemDecimalFormat*> ElemDecimalFormatVectorType;
1.9 +25 -4 xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp
Index: StylesheetConstructionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContext.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- StylesheetConstructionContext.hpp 2000/06/07 18:35:01 1.8
+++ StylesheetConstructionContext.hpp 2000/08/11 21:15:45 1.9
@@ -184,6 +184,15 @@
* Determine the fully qualified URI for a string.
*
* @param urlString string to qualify
+ * @return string to fully qualified URI
+ */
+ virtual XalanDOMString
+ getURLStringFromString(const XalanDOMString& urlString) = 0;
+
+ /**
+ * Determine the fully qualified URI for a string.
+ *
+ * @param urlString string to qualify
* @param base base location for URI
* @return auto pointer to fully qualified URI
*/
@@ -193,6 +202,18 @@
const XalanDOMString& base) = 0;
/**
+ * Determine the fully qualified URI for a string.
+ *
+ * @param urlString string to qualify
+ * @param base base location for URI
+ * @return string to fully qualified URI
+ */
+ virtual XalanDOMString
+ getURLStringFromString(
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) = 0;
+
+ /**
* Retrieve the URI for the current XSLT namespace, for example,
* "http://www.w3.org/1999/XSL/Transform"
*
@@ -264,7 +285,7 @@
* and register the document in a table. If the document has already been
* read in, it will not be reparsed.
*
- * @param url location of the XML
+ * @param urlString location of the XML
* @param docHandler pointer to SAX event handler
* @param docToRegister if using a SAX event handler, the object to register in the source docs table.
* @return document object, which represents the parsed XML
@@ -272,9 +293,9 @@
*/
virtual XalanDocument*
parseXML(
- const XMLURL& url,
- DocumentHandler* docHandler,
- XalanDocument* docToRegister) = 0;
+ const XalanDOMString& urlString,
+ DocumentHandler* docHandler,
+ XalanDocument* docToRegister) = 0;
/**
* Given an XSL tag name, return an integer token that corresponds to
1.10 +22 -4 xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp
Index: StylesheetConstructionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StylesheetConstructionContextDefault.cpp 2000/08/10 18:43:10 1.9
+++ StylesheetConstructionContextDefault.cpp 2000/08/11 21:15:45 1.10
@@ -232,6 +232,14 @@
+XalanDOMString
+StylesheetConstructionContextDefault::getURLStringFromString(const XalanDOMString& urlString)
+{
+ return URISupport::getURLStringFromString(urlString);
+}
+
+
+
StylesheetConstructionContextDefault::URLAutoPtrType
StylesheetConstructionContextDefault::getURLFromString(
const XalanDOMString& urlString,
@@ -242,6 +250,16 @@
+XalanDOMString
+StylesheetConstructionContextDefault::getURLStringFromString(
+ const XalanDOMString& urlString,
+ const XalanDOMString& base)
+{
+ return URISupport::getURLStringFromString(urlString, base);
+}
+
+
+
const XalanDOMString&
StylesheetConstructionContextDefault::getXSLTNamespaceURI() const
{
@@ -318,11 +336,11 @@
XalanDocument*
StylesheetConstructionContextDefault::parseXML(
- const XMLURL& url,
- DocumentHandler* docHandler,
- XalanDocument* docToRegister)
+ const XalanDOMString& urlString,
+ DocumentHandler* docHandler,
+ XalanDocument* docToRegister)
{
- return m_processor.parseXML(url, docHandler, docToRegister);
+ return m_processor.parseXML(urlString, docHandler, docToRegister);
}
1.11 +11 -3 xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp
Index: StylesheetConstructionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- StylesheetConstructionContextDefault.hpp 2000/08/10 18:43:11 1.10
+++ StylesheetConstructionContextDefault.hpp 2000/08/11 21:15:46 1.11
@@ -159,11 +159,19 @@
virtual URLAutoPtrType
getURLFromString(const XalanDOMString& urlString);
+ virtual XalanDOMString
+ getURLStringFromString(const XalanDOMString& urlString);
+
virtual URLAutoPtrType
getURLFromString(
const XalanDOMString& urlString,
const XalanDOMString& base);
+ virtual XalanDOMString
+ getURLStringFromString(
+ const XalanDOMString& urlString,
+ const XalanDOMString& base);
+
virtual const XalanDOMString&
getXSLTNamespaceURI() const;
@@ -191,9 +199,9 @@
virtual XalanDocument*
parseXML(
- const XMLURL& url,
- DocumentHandler* docHandler,
- XalanDocument* docToRegister);
+ const XalanDOMString& urlString,
+ DocumentHandler* docHandler,
+ XalanDocument* docToRegister);
virtual int
getElementToken(const XalanDOMString& name) const;
1.37 +19 -41 xml-xalan/c/src/XSLT/StylesheetHandler.cpp
Index: StylesheetHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetHandler.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- StylesheetHandler.cpp 2000/08/03 15:27:45 1.36
+++ StylesheetHandler.cpp 2000/08/11 21:15:46 1.37
@@ -1094,7 +1094,7 @@
static bool
stackContains(
const Stylesheet::URLStackType& stack,
- const XMLURL& url)
+ const XalanDOMString& urlString)
{
const int n = stack.size();
@@ -1102,7 +1102,7 @@
for(int i = 0; i < n && contains == false; i++)
{
- if(*stack[i] == url)
+ if(equals(stack[i], urlString))
{
contains = true;
}
@@ -1144,39 +1144,30 @@
Stylesheet::URLStackType& includeStack = m_stylesheet.getIncludeStack();
assert(includeStack.size() > 0);
- typedef StylesheetConstructionContext::URLAutoPtrType URLAutoPtrType;
+ const XalanDOMString hrefUrl = m_constructionContext.getURLStringFromString(href, includeStack.back());
+ assert(length(hrefUrl) != 0);
- URLAutoPtrType hrefUrl = m_constructionContext.getURLFromString(href, includeStack.back()->getURLText());
- assert(hrefUrl.get() != 0);
-
Stylesheet::URLStackType& importStack = m_stylesheet.getStylesheetRoot().getImportStack();
- if(stackContains(importStack, *hrefUrl.get()))
+ if(stackContains(importStack, hrefUrl))
{
- XalanDOMString msg(XalanDOMString(hrefUrl->getURLText()) + " is directly or indirectly importing itself!");
+ XalanDOMString msg(hrefUrl + " is directly or indirectly importing itself!");
throw SAXException(toCharArray(msg));
}
-
- importStack.push_back(hrefUrl.get());
-
- // We have to release this right now, since the stylesheet
- // will delete it during its destructor. However, once we
- // pop it off the stack, we'll need to delete it.
- const XMLURL* const hrefUrlptr = hrefUrl.release();
- const XalanDOMString theImportURI(hrefUrlptr->getURLText());
-
+ importStack.push_back(hrefUrl);
+
// This will take care of cleaning up the stylesheet if an exception
// is thrown.
auto_ptr<Stylesheet> importedStylesheet(
m_constructionContext.create(
m_stylesheet.getStylesheetRoot(),
- theImportURI));
+ hrefUrl));
StylesheetHandler tp(*importedStylesheet.get(), m_constructionContext);
- m_constructionContext.parseXML(*hrefUrlptr, &tp, importedStylesheet.get());
+ m_constructionContext.parseXML(hrefUrl, &tp, importedStylesheet.get());
// Add it to the front of the imports
m_stylesheet.addImport(importedStylesheet.get(), true);
@@ -1185,12 +1176,9 @@
// release the auto_ptr.
importedStylesheet.release();
- assert(importStack.back() == hrefUrlptr);
- importStack.pop_back();
+ assert(equals(importStack.back(), hrefUrl));
+ importStack.pop_back();
- // The stylesheet is now done with it, so delete it...
- delete hrefUrlptr;
-
m_stylesheet.setXSLTNamespaceURI(saved_XSLNameSpaceURL);
}
else if(!isAttrOK(aname, atts, i))
@@ -1227,33 +1215,23 @@
PushPopIncludeState theStateHandler(*this);
const XalanDOMString href = atts.getValue(i);
-
- typedef StylesheetConstructionContext::URLAutoPtrType URLAutoPtrType;
-
+
assert(m_stylesheet.getIncludeStack().back() != 0);
- URLAutoPtrType hrefUrl = m_constructionContext.getURLFromString(href, m_stylesheet.getIncludeStack().back()->getURLText());
+ const XalanDOMString hrefUrl = m_constructionContext.getURLStringFromString(href, m_stylesheet.getIncludeStack().back());
- if(stackContains(m_stylesheet.getIncludeStack(), *hrefUrl.get()))
+ if(stackContains(m_stylesheet.getIncludeStack(), hrefUrl))
{
- XalanDOMString msg(XalanDOMString(hrefUrl->getURLText()) + " is directly or indirectly including itself!");
+ XalanDOMString msg(hrefUrl + " is directly or indirectly including itself!");
throw SAXException(toCharArray(msg));
}
- m_stylesheet.getIncludeStack().push_back(hrefUrl.get());
+ m_stylesheet.getIncludeStack().push_back(hrefUrl);
- // We have to release this right now, since the stylesheet
- // will delete it during its destructor. However, once we
- // pop it off the stack, we'll need to delete it.
- const XMLURL* const hrefUrlptr = hrefUrl.release();
+ m_constructionContext.parseXML(hrefUrl, this, &m_stylesheet);
- m_constructionContext.parseXML(*hrefUrlptr, this, &m_stylesheet);
-
- assert(m_stylesheet.getIncludeStack().back() == hrefUrlptr);
+ assert(equals(m_stylesheet.getIncludeStack().back(), hrefUrl));
m_stylesheet.getIncludeStack().pop_back();
-
- // The stylesheet is now done with it, so delete it...
- delete hrefUrlptr;
}
else if(!isAttrOK(aname, atts, i))
{
1.21 +3 -28 xml-xalan/c/src/XSLT/StylesheetRoot.cpp
Index: StylesheetRoot.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetRoot.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- StylesheetRoot.cpp 2000/08/01 19:44:34 1.20
+++ StylesheetRoot.cpp 2000/08/11 21:15:46 1.21
@@ -139,31 +139,11 @@
m_defaultRule(0),
m_defaultRootRule(0)
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::auto_ptr;
-#endif
-
- if (length(baseIdentifier) != 0)
- {
- typedef StylesheetConstructionContext::URLAutoPtrType URLAutoPtrType;
-
- URLAutoPtrType url(constructionContext.getURLFromString(m_baseIdent));
-
- if (url.get() != 0)
+ const XalanDOMString urlString = constructionContext.getURLStringFromString(m_baseIdent);
+ if (length(urlString) != 0)
{
- m_baseIdent = url->getURLText();
-
- URLAutoPtrType url2(constructionContext.getURLFromString(m_baseIdent));
-
- if (url2.get() != 0)
- {
- m_importStack.push_back(url2.get());
-
- // Release the auto_ptr<>...
- url2.release();
- }
+ m_importStack.push_back(urlString);
}
- }
}
@@ -173,11 +153,6 @@
#if !defined(XALAN_NO_NAMESPACES)
using std::for_each;
#endif
-
- // Clean up all entries in the vector.
- for_each(m_importStack.begin(),
- m_importStack.end(),
- DeleteFunctor<XMLURL>());
delete m_defaultRule;
delete m_defaultTextRule;
1.57 +5 -6 xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- XSLTEngineImpl.cpp 2000/08/11 15:17:22 1.56
+++ XSLTEngineImpl.cpp 2000/08/11 21:15:47 1.57
@@ -667,18 +667,17 @@
XalanDocument*
XSLTEngineImpl::parseXML(
- const XMLURL& url,
- DocumentHandler* docHandler,
- XalanDocument* docToRegister)
+ const XalanDOMString& urlString,
+ DocumentHandler* docHandler,
+ XalanDocument* docToRegister)
{
- const XalanDOMString& urlString = url.getURLText();
-
+
XalanDocument* doc =
m_xpathEnvSupport.getSourceDocument(urlString);
if(doc == 0)
{
- XSLTInputSource inputSource(url.getURLText());
+ XSLTInputSource inputSource(c_wstr(urlString));
if(0 != docHandler)
{
1.43 +4 -4 xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
Index: XSLTEngineImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- XSLTEngineImpl.hpp 2000/08/10 18:43:12 1.42
+++ XSLTEngineImpl.hpp 2000/08/11 21:15:47 1.43
@@ -329,7 +329,7 @@
* and register the document in a table. If the document has already been
* read in, it will not be reparsed.
*
- * @param url location of the XML
+ * @param urlString location of the XML
* @param docHandler pointer to SAX event handler
* @param docToRegister if using a SAX event handler, the object to register in the source docs table.
* @return document object, which represents the parsed XML
@@ -337,9 +337,9 @@
*/
XalanDocument*
parseXML(
- const XMLURL& url,
- DocumentHandler* docHandler,
- XalanDocument* docToRegister);
+ const XalanDOMString& urlString,
+ DocumentHandler* docHandler,
+ XalanDocument* docToRegister);
/**
* Reset the state of the XSL processor by reading in a new XSL stylesheet