You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2002/11/13 19:37:06 UTC
cvs commit: xml-xalan/java/src/org/apache/xpath/objects XNodeSet.java XNumber.java
zongaro 2002/11/13 10:37:05
Modified: java/src/org/apache/xalan/templates Tag: XSLTC_DTM
ElemElement.java ElemTemplateElement.java
java/src/org/apache/xalan/transformer Tag: XSLTC_DTM
ResultTreeHandler.java
java/src/org/apache/xml/dtm/ref Tag: XSLTC_DTM
DTMAxisIterNodeList.java DTMNodeList.java
java/src/org/apache/xml/utils Tag: XSLTC_DTM
SystemIDResolver.java
java/src/org/apache/xpath/objects Tag: XSLTC_DTM
XNodeSet.java XNumber.java
Log:
Folding changes from MAIN branch back into XSLTC_DTM branch.
Revision Changes Path
No revision
No revision
1.25.2.2 +6 -2 xml-xalan/java/src/org/apache/xalan/templates/ElemElement.java
Index: ElemElement.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemElement.java,v
retrieving revision 1.25.2.1
retrieving revision 1.25.2.2
diff -u -r1.25.2.1 -r1.25.2.2
--- ElemElement.java 29 Jul 2002 00:01:19 -0000 1.25.2.1
+++ ElemElement.java 13 Nov 2002 18:36:54 -0000 1.25.2.2
@@ -403,7 +403,9 @@
else
{
// Add namespace declarations.
- executeNSDecls(transformer);
+ // Bugzilla 13414: do not startPrefixMapping on 'prefix'
+ // as it is handled below
+ executeNSDecls(transformer, prefix);
if (null != prefix)
{
@@ -429,7 +431,9 @@
{
rhandler.endPrefixMapping(prefix);
}
- unexecuteNSDecls(transformer);
+ // Bugzilla 13414: do not endPrefixMapping on 'prefix'
+ // as it is handled above
+ unexecuteNSDecls(transformer, prefix);
}
}
catch (SAXException se)
1.48.2.3 +31 -3 xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
Index: ElemTemplateElement.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
retrieving revision 1.48.2.2
retrieving revision 1.48.2.3
diff -u -r1.48.2.2 -r1.48.2.3
--- ElemTemplateElement.java 4 Oct 2002 09:24:45 -0000 1.48.2.2
+++ ElemTemplateElement.java 13 Nov 2002 18:36:55 -0000 1.48.2.3
@@ -1217,6 +1217,20 @@
*/
void executeNSDecls(TransformerImpl transformer) throws TransformerException
{
+ executeNSDecls(transformer, null);
+ }
+
+ /**
+ * Send startPrefixMapping events to the result tree handler
+ * for all declared prefix mappings in the stylesheet.
+ *
+ * @param transformer non-null reference to the the current transform-time state.
+ * @param ignorePrefix string prefix to not startPrefixMapping
+ *
+ * @throws TransformerException
+ */
+ void executeNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException
+ {
try
{
@@ -1229,7 +1243,7 @@
{
XMLNSDecl decl = (XMLNSDecl) m_prefixTable.elementAt(i);
- if (!decl.getIsExcluded())
+ if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix)))
{
rhandler.startPrefixMapping(decl.getPrefix(), decl.getURI(), true);
}
@@ -1243,7 +1257,7 @@
}
/**
- * Send startPrefixMapping events to the result tree handler
+ * Send endPrefixMapping events to the result tree handler
* for all declared prefix mappings in the stylesheet.
*
* @param transformer non-null reference to the the current transform-time state.
@@ -1252,6 +1266,20 @@
*/
void unexecuteNSDecls(TransformerImpl transformer) throws TransformerException
{
+ unexecuteNSDecls(transformer, null);
+ }
+
+ /**
+ * Send endPrefixMapping events to the result tree handler
+ * for all declared prefix mappings in the stylesheet.
+ *
+ * @param transformer non-null reference to the the current transform-time state.
+ * @param ignorePrefix string prefix to not endPrefixMapping
+ *
+ * @throws TransformerException
+ */
+ void unexecuteNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException
+ {
try
{
@@ -1264,7 +1292,7 @@
{
XMLNSDecl decl = (XMLNSDecl) m_prefixTable.elementAt(i);
- if (!decl.getIsExcluded())
+ if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix)))
{
rhandler.endPrefixMapping(decl.getPrefix());
}
No revision
No revision
1.55.2.3 +5 -4 xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java
Index: ResultTreeHandler.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java,v
retrieving revision 1.55.2.2
retrieving revision 1.55.2.3
diff -u -r1.55.2.2 -r1.55.2.3
--- ResultTreeHandler.java 26 Sep 2002 13:58:37 -0000 1.55.2.2
+++ ResultTreeHandler.java 13 Nov 2002 18:36:59 -0000 1.55.2.3
@@ -986,7 +986,8 @@
n = dtm.getNextSibling(n))
{
flushPending(true); // I think.
- startPrefixMapping("","");
+ if (dtm.getNamespaceURI(n) == null)
+ startPrefixMapping("","");
dtm.dispatchToEvents(n, this);
}
}
@@ -1108,6 +1109,9 @@
{
String prefix = (String) prefixes.nextElement();
String uri=m_nsSupport.getURI(prefix);
+
+ if (null == uri)
+ uri = "";
// Send event
handler.startPrefixMapping(prefix, uri);
@@ -1123,9 +1127,6 @@
}
else
name = "xmlns:" + prefix;
-
- if (null == uri)
- uri = "";
m_attributes.addAttribute("http://www.w3.org/2000/xmlns/",
prefix, name, "CDATA", uri);
No revision
No revision
1.1.2.2 +1 -1 xml-xalan/java/src/org/apache/xml/dtm/ref/Attic/DTMAxisIterNodeList.java
Index: DTMAxisIterNodeList.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/Attic/DTMAxisIterNodeList.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- DTMAxisIterNodeList.java 5 Nov 2002 10:32:26 -0000 1.1.2.1
+++ DTMAxisIterNodeList.java 13 Nov 2002 18:37:00 -0000 1.1.2.2
@@ -122,7 +122,7 @@
* need this or not, but let's write it and think about it.
*
*/
- DTMAxisIterator getDTMAxisIterator() {
+ public DTMAxisIterator getDTMAxisIterator() {
return m_iter;
}
1.5.12.3 +1 -2 xml-xalan/java/src/org/apache/xml/dtm/ref/DTMNodeList.java
Index: DTMNodeList.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMNodeList.java,v
retrieving revision 1.5.12.2
retrieving revision 1.5.12.3
diff -u -r1.5.12.2 -r1.5.12.3
--- DTMNodeList.java 5 Nov 2002 10:32:26 -0000 1.5.12.2
+++ DTMNodeList.java 13 Nov 2002 18:37:00 -0000 1.5.12.3
@@ -123,10 +123,9 @@
* need this or not, but let's write it and think about it.
*
*/
- DTMIterator getDTMIterator() {
+ public DTMIterator getDTMIterator() {
return m_iter;
}
-
//================================================================
// org.w3c.dom.NodeList API follows
No revision
No revision
1.15.2.3 +64 -39 xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java
Index: SystemIDResolver.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java,v
retrieving revision 1.15.2.2
retrieving revision 1.15.2.3
diff -u -r1.15.2.2 -r1.15.2.3
--- SystemIDResolver.java 5 Nov 2002 10:41:49 -0000 1.15.2.2
+++ SystemIDResolver.java 13 Nov 2002 18:37:00 -0000 1.15.2.3
@@ -92,42 +92,50 @@
*/
public static String getAbsoluteURIFromRelative(String localPath)
{
- // If the local path is absolute, just prepend the scheme part to
- // generate the absolute URI.
- String urlString = localPath;
- if (isAbsolutePath(localPath))
+ if (localPath == null || localPath.length() == 0)
+ return "";
+
+ // If the local path is a relative path, then it is resolved against
+ // the "user.dir" system property.
+ String absolutePath = localPath;
+ if (!isAbsolutePath(localPath))
{
- if (localPath.startsWith(File.separator))
- urlString = "file://" + localPath;
- else
- urlString = "file:///" + localPath;
- }
- // If it is a relative path, the path is resolved against the current
- // "user.dir" system property.
- else
- {
- String absolutePath = localPath;
- try {
- absolutePath = new File(localPath).getAbsolutePath();
+ try
+ {
+ absolutePath = getAbsolutePathFromRelativePath(localPath);
}
// user.dir not accessible from applet
- catch (SecurityException se) {}
-
- if (null != absolutePath)
+ catch (SecurityException se)
{
- if (absolutePath.startsWith(File.separator))
- urlString = "file://" + absolutePath;
- else
- urlString = "file:///" + absolutePath;
+ return "file:" + localPath;
}
+ }
+
+ String urlString;
+ if (null != absolutePath)
+ {
+ if (absolutePath.startsWith(File.separator))
+ urlString = "file://" + absolutePath;
else
- urlString = "file:///" + localPath;
+ urlString = "file:///" + absolutePath;
}
+ else
+ urlString = "file:" + localPath;
- String result = replaceChars(urlString);
- return result;
+ return replaceChars(urlString);
}
-
+
+ /**
+ * Return an absolute path from a relative path.
+ *
+ * @param relativePath A relative path
+ * @return The absolute path
+ */
+ private static String getAbsolutePathFromRelativePath(String relativePath)
+ {
+ return new File(relativePath).getAbsolutePath();
+ }
+
/**
* Return true if the systemId denotes an absolute URI (contains the scheme part).
*
@@ -208,27 +216,43 @@
*/
public static String getAbsoluteURI(String systemId)
{
+ String absoluteURI = systemId;
if (isAbsoluteURI(systemId))
{
// Only process the systemId if it starts with "file:".
if (systemId.startsWith("file:"))
{
- int secondColonIndex = systemId.indexOf(':', 5);
- // If the path contains a drive letter.
- if (secondColonIndex > 5
- && Character.isLetter(systemId.charAt(secondColonIndex-1)))
+ String str = systemId.substring(5);
+
+ // Resolve the absolute path if the systemId starts with "file:///"
+ // or "file:/". Don't do anything if it only starts with "file://".
+ if (str != null && str.startsWith("/"))
{
- String localPath = systemId.substring(secondColonIndex-1);
- if (!isAbsolutePath(localPath))
- return getAbsoluteURIFromRelative(localPath);
+ if (str.startsWith("///") || !str.startsWith("//"))
+ {
+ // A Windows path containing a drive letter can be relative.
+ // A Unix path starting with "file:/" is always absolute.
+ int secondColonIndex = systemId.indexOf(':', 5);
+ if (secondColonIndex > 0)
+ {
+ String localPath = systemId.substring(secondColonIndex-1);
+ try {
+ if (!isAbsolutePath(localPath))
+ absoluteURI = systemId.substring(0, secondColonIndex-1) +
+ getAbsolutePathFromRelativePath(localPath);
+ }
+ catch (SecurityException se) {
+ return systemId;
+ }
+ }
+ }
}
- else if (systemId.charAt(5) != '/')
+ else
{
return getAbsoluteURIFromRelative(systemId.substring(5));
}
-
- String absoluteURI = replaceChars(systemId);
- return absoluteURI;
+
+ return replaceChars(absoluteURI);
}
else
return systemId;
@@ -267,5 +291,6 @@
}
return replaceChars(uri.toString());
- }
+ }
+
}
No revision
No revision
1.21.2.1 +8 -1 xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java
Index: XNodeSet.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java,v
retrieving revision 1.21
retrieving revision 1.21.2.1
diff -u -r1.21 -r1.21.2.1
--- XNodeSet.java 22 Mar 2002 01:04:44 -0000 1.21
+++ XNodeSet.java 13 Nov 2002 18:37:00 -0000 1.21.2.1
@@ -381,7 +381,14 @@
*/
public NodeList nodelist() throws javax.xml.transform.TransformerException
{
- return new org.apache.xml.dtm.ref.DTMNodeList(iter());
+ org.apache.xml.dtm.ref.DTMNodeList nodelist = new org.apache.xml.dtm.ref.DTMNodeList(this);
+ // Creating a DTMNodeList has the side-effect that it will create a clone
+ // XNodeSet with cache and run m_iter to the end. You cannot get any node
+ // from m_iter after this call. As a fix, we call SetVector() on the clone's
+ // cache. See Bugzilla 14406.
+ XNodeSet clone = (XNodeSet)nodelist.getDTMIterator();
+ SetVector(clone.getVector());
+ return nodelist;
}
1.13.2.1 +4 -0 xml-xalan/java/src/org/apache/xpath/objects/XNumber.java
Index: XNumber.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNumber.java,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -r1.13 -r1.13.2.1
--- XNumber.java 22 Mar 2002 01:04:44 -0000 1.13
+++ XNumber.java 13 Nov 2002 18:37:00 -0000 1.13.2.1
@@ -363,6 +363,10 @@
return sign + s.substring(0, 1) + s.substring(2, e)
+ zeros(exp - nDigits);
+ // Eliminate trailing 0's - bugzilla 14241
+ while (s.charAt(e-1) == '0')
+ e--;
+
if (exp > 0)
return sign + s.substring(0, 1) + s.substring(2, 2 + exp) + "."
+ s.substring(2 + exp, e);
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org