dleslie 00/02/11 15:10:58
Modified: samples/ValidateXPath ValidateXPath.java
Added: samples/ValidateXPath readme.html
Log:
Remove old sample folders, so can add updated samples in moslty new folders
Revision Changes Path
1.3 +21 -23 xml-xalan/samples/ValidateXPath/ValidateXPath.java
Index: ValidateXPath.java
===================================================================
RCS file: /home/cvs/xml-xalan/samples/ValidateXPath/ValidateXPath.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ValidateXPath.java 1999/11/09 14:55:24 1.2
+++ ValidateXPath.java 2000/02/11 23:10:55 1.3
@@ -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 [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -65,46 +65,44 @@
import org.apache.xerces.dom.DocumentImpl;
/**
- * Simple sample code to show how to run the XSL processor
- * from the API.
+ * Validate the XPath expression input to main().
*/
public class ValidateXPath
{
public static void main(String[] args)
- throws java.io.IOException,
- java.net.MalformedURLException,
+ throws java.io.IOException,
+ java.net.MalformedURLException,
org.xml.sax.SAXException
{
+ // Print the input argument.
System.out.println(args[0]);
-
+
// Since we don't have a XML Parser involved here, install some default
support
// for things like namespaces, etc.
XPathSupportDefault xpathSupport = new XPathSupportDefault();
-
+
// Create the XPath object.
XPath xpath = new XPath(xpathSupport, null);
-
- // Since raw XPath doesn't have a document function, you have to
- // install one. The same will be true of a few other functions
- // that are currently built-in to XPath.
+
+ // Since raw XPath doesn't have a document function, install one.
xpath.installFunction("document", new
org.apache.xalan.xslt.FuncDocument());
-
- // Create a XPath parser.
+
+ // Create an XPath parser.
XPathProcessorImpl parser = new XPathProcessorImpl(xpathSupport);
-
- // Create a dummy document for namespace resolution.
- // You may want to use a real document node here from the XSL Stylesheet
for namespace resolution.
+
+ // Create a dummy document for namespace resolution. You could use a real
+ // document node here from the XSL Stylesheet for namespace resolution.
Document doc = new DocumentImpl();
Element docElem = doc.createElement("dummy");
doc.appendChild(docElem);
-
+
try
{
// Parse the XPath.
parser.initXPath(xpath, args[0], null);
System.out.println("XPath is valid");
-
- // This may have bugs in it, but it basically dumps the parse tree to
System.out.
+
+ // Dump the parse tree to System.out.
parser.diagnoseXPathString2(args[0]);
}
catch(XPathException xpe)
1.1 xml-xalan/samples/ValidateXPath/readme.html
Index: readme.html
===================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Xalan Samples</title>
</head>
<body>
<h2>Xalan Samples</h2>
<p>For information about the samples (what they illustrate and how to run
them), see <a href="../../docs/samples.html">Samples</a>.</p>
</body>
</html>