You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dl...@locus.apache.org on 2000/03/01 19:07:38 UTC
cvs commit: xml-xalan/src/org/apache/xalan/xpath/dtm DTMLiaison.java DTMNodeLocator.java
dleslie 00/03/01 10:07:38
Modified: src/org/apache/xalan/xpath/dtm DTMLiaison.java
DTMNodeLocator.java
Log:
A small plug for SPR DMAN4FYPWC
Revision Changes Path
1.11 +63 -55 xml-xalan/src/org/apache/xalan/xpath/dtm/DTMLiaison.java
Index: DTMLiaison.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/dtm/DTMLiaison.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DTMLiaison.java 2000/02/23 15:16:15 1.10
+++ DTMLiaison.java 2000/03/01 18:07:38 1.11
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "XSLT4J" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
@@ -71,36 +71,44 @@
import org.apache.xalan.xpath.XLocator;
import org.apache.xalan.xpath.res.XPATHErrorResources;
-
+/**
+ * Liaison to Document Table Model (DTM) XML parser -- the default liaison and parser that XSLTProcessor
+ * uses to perform transformations.
+ * To enhance performance, DTM uses integer arrays to represent a DOM. If you are reading or writing a
+ * DOM, use XercesLiaison.
+ *
+ * @see org.apache.xalan.xslt.XSLTProcessor
+ * @see org.apache.xalan.xpath.xdom.XercesLiaison
+ */
public class DTMLiaison extends XercesLiaison
{
/**
* Flag to tell whether or not the parse is done on a seperate thread,
- * so the transform can occur at the same time. The default
+ * so the transform can occur at the same time. The default
* is true.
*/
private boolean m_doThreading = true;
-
+
/**
* Set whether or not the parse is done on a seperate thread,
- * so the transform can occur at the same time. The default
+ * so the transform can occur at the same time. The default
* is true.
*/
boolean getDoThreading()
{
return m_doThreading;
}
-
+
/**
* Set whether or not the parse is done on a seperate thread,
- * so the transform can occur at the same time. The default
+ * so the transform can occur at the same time. The default
* is true.
*/
void setDoThreading(boolean b)
{
m_doThreading = b;
}
-
+
/**
* Constructor that takes SAX ErrorHandler as an argument. The error handler
* is registered with the XML Parser. Any XML-related errors will be reported
@@ -112,7 +120,7 @@
{
super(errorHandler);
}
-
+
/**
* Construct an instance.
*/
@@ -120,16 +128,16 @@
{
super(envSupport);
}
-
+
/**
* Construct an instance.
*/
public DTMLiaison()
{
}
-
+
/**
- * Set whether or not to expand all entity references in the
+ * Set whether or not to expand all entity references in the
* source and style trees.
* Not supported for DTM. Entities will be expanded by default.
*/
@@ -139,8 +147,8 @@
warn(XPATHErrorResources.WG_EXPAND_ENTITIES_NOT_SUPPORTED);
m_shouldExpandEntityRefs = b;
}
+
-
/**
* Check node to see if it matches this liaison.
*/
@@ -151,7 +159,7 @@
throw new SAXException("DTMLiaison can not handle nodes of type"
+((Object)node).getClass());
}
-
+
/**
* Parse an XML document.
*
@@ -181,7 +189,7 @@
*/
public void parse (InputSource source)
throws SAXException, IOException
- {
+ {
if(null == m_docHandler)
{
DTM domParser = new DTM(this.getProblemListener());
@@ -198,22 +206,22 @@
? "Input XSL" : source.getSystemId();
parser.setErrorHandler(new org.apache.xalan.xpath.xml.DefaultErrorHandler(ident));
}
-
+
if(null != m_entityResolver)
{
// System.out.println("Setting the entity resolver.");
parser.setEntityResolver(m_entityResolver);
}
-
+
if(null != m_locale)
parser.setLocale(m_locale);
-
+
if(getUseValidation())
parser.setFeature("http://xml.org/sax/features/validation", true);
-
+
// Set whether or not to create entity ref nodes
domParser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes", getShouldExpandEntityRefs());
-
+
if(m_doThreading)
{
parser.parse(source);
@@ -231,32 +239,32 @@
throw new SAXException(re.getMessage());
}
}
-
+
m_document = parser.getDocument();
if(null != source.getSystemId())
{
if(null != getSourceDocsTable())
getSourceDocsTable().put(source.getSystemId(), m_document);
}
- }
+ }
}
else
{
super.parse(source);
}
-
+
}
-
+
/**
- * Returns true if the liaison supports the SAX DocumentHandler
- * interface. The default is that the parser does not support
+ * Returns true if the liaison supports the SAX DocumentHandler
+ * interface. The default is that the parser does not support
* the SAX interface.
*/
public boolean supportsSAX()
{
return true;
}
-
+
/**
* Returns the namespace of the given node.
*/
@@ -286,7 +294,7 @@
return super.getLocalNameOfNode(n);
}
}
-
+
/**
* Get the parent of a node.
*/
@@ -302,7 +310,7 @@
return super.getParentOfNode(n);
}
}
-
+
/**
* Given an ID, return the element.
*/
@@ -317,15 +325,15 @@
return super.getElementByID(id, doc);
}
}
-
+
/**
- * The getUnparsedEntityURI function returns the URI of the unparsed
- * entity with the specified name in the same document as the context
- * node (see [3.3 Unparsed Entities]). It returns the empty string if
+ * The getUnparsedEntityURI function returns the URI of the unparsed
+ * entity with the specified name in the same document as the context
+ * node (see [3.3 Unparsed Entities]). It returns the empty string if
* there is no such entity.
* (Should this go here or in the XLocator??)
- * Since it states in the DOM draft: "An XML processor may choose to
- * completely expand entities before the structure model is passed
+ * Since it states in the DOM draft: "An XML processor may choose to
+ * 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.
*/
@@ -349,11 +357,11 @@
}
else
{
- // This should be resolved to an absolute URL, but that's hard
+ // This should be resolved to an absolute URL, but that's hard
// to do from here.
}
}
-
+
return url;
}
catch(ClassCastException cce)
@@ -361,8 +369,8 @@
return super.getUnparsedEntityURI(name, doc);
}
/*
- String url = "";
- DocumentType doctype = doc.getDoctype();
+ String url = "";
+ DocumentType doctype = doc.getDoctype();
if(null != doctype)
{
NamedNodeMap entities = doctype.getEntities();
@@ -370,13 +378,13 @@
String notationName = entity.getNotationName();
if(null != notationName) // 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
+ // 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.
url = entity.getSystemId();
@@ -386,15 +394,15 @@
}
else
{
- // This should be resolved to an absolute URL, but that's hard
+ // This should be resolved to an absolute URL, but that's hard
// to do from here.
}
}
}
return url;
*/
- }
-
+ }
+
/**
* Get a factory to create XPaths.
*/
@@ -402,17 +410,17 @@
{
return DTMNodeLocator.factory();
}
-
+
/**
* Get an XLocator provider keyed by node. This get's
- * the association based on the root of the tree that the
+ * the association based on the root of the tree that the
* node is parented by.
*/
public XLocator getXLocatorFromNode(Node node)
{
return DTMNodeLocator.getDefaultLocator();
}
-
+
/**
* getXLocatorHandler.
*/
1.12 +13 -10 xml-xalan/src/org/apache/xalan/xpath/dtm/DTMNodeLocator.java
Index: DTMNodeLocator.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/dtm/DTMNodeLocator.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DTMNodeLocator.java 2000/02/13 16:36:51 1.11
+++ DTMNodeLocator.java 2000/03/01 18:07:38 1.12
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,15 +18,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "XSLT4J" and "Apache Software Foundation" must
+ * 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
@@ -64,6 +64,9 @@
import org.apache.xalan.xpath.*;
import org.apache.xalan.xpath.res.XPATHErrorResources;
+/**
+ * <meta name="usage" content="advanced"/>
+ */
public class DTMNodeLocator extends SimpleNodeLocator
{
/**
@@ -72,14 +75,14 @@
public DTMNodeLocator()
{
}
-
+
/**
* The singleton instance of this class.
*/
private static DTMNodeLocator m_locater = null;
-
+
/**
- * The the default locator.
+ * The default locator.
*/
public static XLocator getDefaultLocator()
{
@@ -87,7 +90,7 @@
return m_locater;
}
}
-
+
/**
* Override the createXLocatorHandler method.
*/
@@ -97,7 +100,7 @@
{
super(new org.apache.xalan.xpath.xml.ProblemListenerDefault());
}
-
+
/**
* getXLocatorHandler.
*/