Permalink
Browse files

Trying to bring things in line with what they used to be.

-jh-
  • Loading branch information...
1 parent d0fd403 commit a129b70129f4c9594c178ae114893a4e72702ed6 jhunter committed Jan 23, 2003
Showing with 0 additions and 103 deletions.
  1. +0 −2 contrib/samples/ResultSetBuilderDemo.java
  2. +0 −101 contrib/samples/XPathDemo.java
@@ -83,14 +83,12 @@ public static void main(String[] args) throws Exception {
Connection con =
DriverManager.getConnection("jdbc:cloudscape:rsbd;create=true");
-/*
// Create and fill commands, needed only on the first run
Statement prep = con.createStatement();
prep.executeUpdate(PREP);
Statement fill = con.createStatement();
fill.executeUpdate(FILL);
-*/
Namespace ns = Namespace.getNamespace("xhtml", "http://w3.org/etc");
@@ -1,101 +0,0 @@
-import java.io.*;
-import java.util.*;
-
-import org.jdom.*;
-import org.jdom.input.*;
-import org.jdom.contrib.xpath.XPathElement;
-import org.jdom.contrib.xpath.XPathParseException;
-
-/**
- * Super-simple demo for XPath package.
- *
- * @author Jason Hunter
- */
-public class XPathDemo {
-
- public static void main(String[] args) {
- String doc =
- "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" +
- "<web-app>" +
- " <servlet>" +
- " <servlet-name>" +
- " snoop" +
- " </servlet-name>" +
- " <servlet-class>" +
- " SnoopServlet" +
- " </servlet-class>" +
- " </servlet>" +
- " <servlet>" +
- " <servlet-name>" +
- " file" +
- " </servlet-name>" +
- " <servlet-class>" +
- " ViewFile" +
- " </servlet-class>" +
- " <init-param>" +
- " <param-name>" +
- " initial" +
- " </param-name>" +
- " <param-value>" +
- " 1000" +
- " </param-value>" +
- " <description>" +
- " The initial value for the counter <!-- optional -->" +
- " </description>" +
- " </init-param>" +
- " <description>" +
- " The default file serving servlet" +
- " </description>" +
- " <servlet>" +
- " </servlet>" +
- " <servlet-name>" +
- " filex" +
- " </servlet-name>" +
- " <servlet-class>" +
- " ViewFile" +
- " </servlet-class>" +
- " <init-param>" +
- " <param-name>" +
- " initial" +
- " </param-name>" +
- " <param-value>" +
- " 1000" +
- " </param-value>" +
- " <description>" +
- " The initial value for the counter <!-- optional -->" +
- " </description>" +
- " </init-param>" +
- " <description>" +
- " The default filex serving servlet" +
- " </description>" +
- " </servlet>" +
- "</web-app>";
-
- try {
- Document d = new SAXBuilder().build(new StringReader(doc));
-
- XPathElement xpath = new XPathElement(d.getRootElement());
- List servletNames = xpath.getMatches("servlet/servlet-name/text()");
- System.out.println("Servlet names:");
- Iterator i = servletNames.iterator();
- while (i.hasNext()) {
- System.out.println(i.next());
- }
-
- // Need to change the XPath expression to get the description
- // of the "file" servlet by name, not by index
- String fileDesc = xpath.getTextMatch("servlet[2]/description/text()");
- System.out.println("The \"file\" servlet desc: ");
- System.out.println(fileDesc.trim());
- }
- catch (XPathParseException e) {
- e.printStackTrace();
- }
- catch (JDOMException e) {
- e.printStackTrace();
- }
-
- }
-
-}
-

0 comments on commit a129b70

Please sign in to comment.