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...@apache.org on 2001/08/22 01:02:59 UTC
cvs commit: xml-xalan/c/src/XalanTransformer XalanDefaultDocumentBuilder.cpp XalanDefaultDocumentBuilder.hpp XalanDefaultParsedSource.cpp XalanDefaultParsedSource.hpp XalanDocumentBuilder.hpp XalanParsedSource.hpp XalanTransformer.cpp XercesDOMParsedSource.cpp XercesDOMParsedSource.hpp
dbertoni 01/08/21 16:02:59
Modified: c/src/XalanTransformer XalanDefaultDocumentBuilder.cpp
XalanDefaultDocumentBuilder.hpp
XalanDefaultParsedSource.cpp
XalanDefaultParsedSource.hpp
XalanDocumentBuilder.hpp XalanParsedSource.hpp
XalanTransformer.cpp XercesDOMParsedSource.cpp
XercesDOMParsedSource.hpp
Log:
Make sure documents get registered with the support object.
Revision Changes Path
1.4 +11 -2 xml-xalan/c/src/XalanTransformer/XalanDefaultDocumentBuilder.cpp
Index: XalanDefaultDocumentBuilder.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanDefaultDocumentBuilder.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanDefaultDocumentBuilder.cpp 2001/06/06 21:41:09 1.3
+++ XalanDefaultDocumentBuilder.cpp 2001/08/21 23:02:59 1.4
@@ -67,10 +67,11 @@
-XalanDefaultDocumentBuilder::XalanDefaultDocumentBuilder() :
+XalanDefaultDocumentBuilder::XalanDefaultDocumentBuilder(const XalanDOMString& theURI) :
m_domSupport(),
m_parserLiaison(),
- m_contentHandler(m_parserLiaison.mapDocument(m_parserLiaison.createDocument()))
+ m_contentHandler(m_parserLiaison.mapDocument(m_parserLiaison.createDocument())),
+ m_uri(theURI)
{
m_domSupport.setParserLiaison(&m_parserLiaison);
}
@@ -118,4 +119,12 @@
XalanDefaultDocumentBuilder::getLexicalHandler()
{
return &m_contentHandler;
+}
+
+
+
+const XalanDOMString&
+XalanDefaultDocumentBuilder::getURI() const
+{
+ return m_uri;
}
1.4 +11 -1 xml-xalan/c/src/XalanTransformer/XalanDefaultDocumentBuilder.hpp
Index: XalanDefaultDocumentBuilder.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanDefaultDocumentBuilder.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanDefaultDocumentBuilder.hpp 2001/06/06 21:41:09 1.3
+++ XalanDefaultDocumentBuilder.hpp 2001/08/21 23:02:59 1.4
@@ -82,7 +82,12 @@
{
public:
- XalanDefaultDocumentBuilder();
+ /**
+ * Create a XalanDefaultDocumentBuilder instance,
+ *
+ * @param theURI An optional string to identify the document.
+ */
+ XalanDefaultDocumentBuilder(const XalanDOMString& theURI = XalanDOMString());
virtual
~XalanDefaultDocumentBuilder();
@@ -93,6 +98,9 @@
virtual XalanParsedSourceHelper*
createHelper() const;
+ virtual const XalanDOMString&
+ getURI() const;
+
virtual ContentHandler*
getContentHandler();
@@ -109,6 +117,8 @@
XalanSourceTreeParserLiaison m_parserLiaison;
XalanSourceTreeContentHandler m_contentHandler;
+
+ const XalanDOMString m_uri;
};
1.4 +30 -0 xml-xalan/c/src/XalanTransformer/XalanDefaultParsedSource.cpp
Index: XalanDefaultParsedSource.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanDefaultParsedSource.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanDefaultParsedSource.cpp 2001/06/06 21:41:10 1.3
+++ XalanDefaultParsedSource.cpp 2001/08/21 23:02:59 1.4
@@ -62,6 +62,10 @@
+#include <PlatformSupport/URISupport.hpp>
+
+
+
#include <XalanSourceTree/XalanSourceTreeDocument.hpp>
#include <XalanSourceTree/XalanSourceTreeDOMSupport.hpp>
@@ -170,6 +174,24 @@
assert(m_parsedSource != 0);
m_domSupport.setParserLiaison(&m_parserLiaison);
+
+ const XalanDOMChar* const theSystemID = theInputSource.getSystemId();
+
+ if (theSystemID != 0)
+ {
+ try
+ {
+ m_uri = URISupport::getURLStringFromString(theSystemID);
+ }
+ catch(const XMLException&)
+ {
+ // Assume that any exception here relates to get the url from
+ // the system ID. We'll assume that it's just a fake base identifier
+ // since the parser would have thrown an error if the system ID
+ // wasn't resolved.
+ m_uri = theSystemID;
+ }
+ }
}
@@ -192,4 +214,12 @@
XalanDefaultParsedSource::createHelper() const
{
return new XalanDefaultParsedSourceHelper(m_domSupport);
+}
+
+
+
+const XalanDOMString&
+XalanDefaultParsedSource::getURI() const
+{
+ return m_uri;
}
1.4 +5 -0 xml-xalan/c/src/XalanTransformer/XalanDefaultParsedSource.hpp
Index: XalanDefaultParsedSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanDefaultParsedSource.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanDefaultParsedSource.hpp 2001/06/06 21:41:10 1.3
+++ XalanDefaultParsedSource.hpp 2001/08/21 23:02:59 1.4
@@ -157,6 +157,9 @@
virtual XalanParsedSourceHelper*
createHelper() const;
+ virtual const XalanDOMString&
+ getURI() const;
+
private:
XalanSourceTreeDOMSupport m_domSupport;
@@ -164,6 +167,8 @@
XalanSourceTreeParserLiaison m_parserLiaison;
XalanSourceTreeDocument* const m_parsedSource;
+
+ XalanDOMString m_uri;
};
1.5 +3 -0 xml-xalan/c/src/XalanTransformer/XalanDocumentBuilder.hpp
Index: XalanDocumentBuilder.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanDocumentBuilder.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XalanDocumentBuilder.hpp 2001/06/06 21:41:11 1.4
+++ XalanDocumentBuilder.hpp 2001/08/21 23:02:59 1.5
@@ -97,6 +97,9 @@
virtual XalanParsedSourceHelper*
createHelper() const = 0;
+ virtual const XalanDOMString&
+ getURI() const = 0;
+
// These are new to XalanDocumentBuilder...
virtual ContentHandler*
getContentHandler() = 0;
1.4 +10 -1 xml-xalan/c/src/XalanTransformer/XalanParsedSource.hpp
Index: XalanParsedSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanParsedSource.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanParsedSource.hpp 2001/06/06 21:41:11 1.3
+++ XalanParsedSource.hpp 2001/08/21 23:02:59 1.4
@@ -123,7 +123,7 @@
* @return A pointer to a XalanDocument instance.
*/
virtual XalanDocument*
- getDocument() const = 0;
+ getDocument() const = 0;
/**
* Create the appropriate XalanParsedSourceHelper instance to
@@ -135,6 +135,15 @@
*/
virtual XalanParsedSourceHelper*
createHelper() const = 0;
+
+ /**
+ * Get the URI for the parsed source, if any.
+ * use for transforming with the instance.
+ *
+ * @return A const reference to a string containing the URI
+ */
+ virtual const XalanDOMString&
+ getURI() const = 0;
};
1.30 +23 -3 xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp
Index: XalanTransformer.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XalanTransformer.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- XalanTransformer.cpp 2001/08/20 22:20:03 1.29
+++ XalanTransformer.cpp 2001/08/21 23:02:59 1.30
@@ -227,6 +227,9 @@
try
{
+ XalanDocument* const theSourceDocument = theParsedXML.getDocument();
+ assert(theSourceDocument != 0);
+
// Create the helper object that is necessary for running the processor...
XalanAutoPtr<XalanParsedSourceHelper> theHelper(theParsedXML.createHelper());
assert(theHelper.get() != 0);
@@ -252,9 +255,16 @@
theXSLTProcessorEnvSupport.setProcessor(&theProcessor);
+ const XalanDOMString& theURI = theParsedXML.getURI();
+
+ if (length(theURI) > 0)
+ {
+ theXSLTProcessorEnvSupport.setSourceDocument(theURI, theSourceDocument);
+ }
+
// Create a problem listener and send output to a XalanDOMString.
DOMStringPrintWriter thePrintWriter(theErrorMessage);
-
+
ProblemListenerDefault theProblemListener(&thePrintWriter);
theProcessor.setProblemListener(&theProblemListener);
@@ -301,7 +311,7 @@
// Do the transformation...
theProcessor.process(
- theParsedXML.getDocument(),
+ theSourceDocument,
theStylesheetSource,
tempResultTarget,
theStylesheetConstructionContext,
@@ -390,6 +400,9 @@
try
{
+ XalanDocument* const theSourceDocument = theParsedXML.getDocument();
+ assert(theSourceDocument != 0);
+
// Create the helper object that is necessary for running the processor...
XalanAutoPtr<XalanParsedSourceHelper> theHelper(theParsedXML.createHelper());
assert(theHelper.get() != 0);
@@ -415,6 +428,13 @@
theXSLTProcessorEnvSupport.setProcessor(&theProcessor);
+ const XalanDOMString& theURI = theParsedXML.getURI();
+
+ if (length(theURI) > 0)
+ {
+ theXSLTProcessorEnvSupport.setSourceDocument(theURI, theSourceDocument);
+ }
+
// Create a problem listener and send output to a XalanDOMString.
DOMStringPrintWriter thePrintWriter(theErrorMessage);
@@ -460,7 +480,7 @@
// Do the transformation...
theProcessor.process(
- theParsedXML.getDocument(),
+ theSourceDocument,
tempResultTarget,
*m_stylesheetExecutionContext);
}
1.4 +29 -0 xml-xalan/c/src/XalanTransformer/XercesDOMParsedSource.cpp
Index: XercesDOMParsedSource.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XercesDOMParsedSource.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesDOMParsedSource.cpp 2001/06/06 21:41:12 1.3
+++ XercesDOMParsedSource.cpp 2001/08/21 23:02:59 1.4
@@ -62,6 +62,10 @@
+#include <PlatformSupport/URISupport.hpp>
+
+
+
class XALAN_TRANSFORMER_EXPORT XercesDOMParsedSourceHelper : public XalanParsedSourceHelper
{
public:
@@ -92,6 +96,23 @@
m_parserLiaison(),
m_parsedSource(m_parserLiaison.parseXMLStream(theInputSource))
{
+ const XalanDOMChar* const theSystemID = theInputSource.getSystemId();
+
+ if (theSystemID != 0)
+ {
+ try
+ {
+ m_uri = URISupport::getURLStringFromString(theSystemID);
+ }
+ catch(const XMLException&)
+ {
+ // Assume that any exception here relates to get the url from
+ // the system ID. We'll assume that it's just a fake base identifier
+ // since the parser would have thrown an error if the system ID
+ // wasn't resolved.
+ m_uri = theSystemID;
+ }
+ }
}
@@ -114,4 +135,12 @@
XercesDOMParsedSource::createHelper() const
{
return new XercesDOMParsedSourceHelper;
+}
+
+
+
+const XalanDOMString&
+XercesDOMParsedSource::getURI() const
+{
+ return m_uri;
}
1.4 +5 -0 xml-xalan/c/src/XalanTransformer/XercesDOMParsedSource.hpp
Index: XercesDOMParsedSource.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XalanTransformer/XercesDOMParsedSource.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XercesDOMParsedSource.hpp 2001/06/06 21:41:12 1.3
+++ XercesDOMParsedSource.hpp 2001/08/21 23:02:59 1.4
@@ -96,11 +96,16 @@
virtual XalanParsedSourceHelper*
createHelper() const;
+ virtual const XalanDOMString&
+ getURI() const;
+
private:
XercesParserLiaison m_parserLiaison;
XalanDocument* const m_parsedSource;
+
+ XalanDOMString m_uri;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org