jkesselm 02/03/20 06:20:13 Modified: java/src/org/apache/xml/dtm/ref TestDTM.java Log: Add Apache header, remove import of discarded TestDTMNode. At some point, we should consider moving this class to the tests directory. Revision Changes Path 1.4 +77 -6 xml-xalan/java/src/org/apache/xml/dtm/ref/TestDTM.java Index: TestDTM.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/TestDTM.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestDTM.java 19 Mar 2002 20:44:27 -0000 1.3 +++ TestDTM.java 20 Mar 2002 14:20:13 -0000 1.4 @@ -1,3 +1,59 @@ +/* + * The Apache Software License, Version 1.1 + * + * + * Copyright (c) 1999 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * 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 + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * 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 "Xalan" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation and was + * originally based on software copyright (c) 1999, Lotus + * Development Corporation., http://www.lotus.com. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ package org.apache.xml.dtm.ref; import javax.xml.transform.Source; @@ -6,7 +62,6 @@ import javax.xml.transform.stream.StreamSource; import org.apache.xml.dtm.DTM; import org.apache.xml.dtm.DTMManager; -import org.apache.xml.dtm.ref.TestDTMNodes; /** @@ -28,7 +83,7 @@ try { // Pick our input source - Source source; + Source source=null; if(argv.length<1) { String defaultSource= @@ -42,11 +97,18 @@ " </dummyDocument>\n"; source=new StreamSource(new java.io.StringReader(defaultSource)); } + else if (argv.length>1 && "X".equalsIgnoreCase(argv[1])) + { + // XNI stream startup goes here + // Remember to perform Schema validation, to obtain PSVI annotations + + } else { - // Read from a URI + // Read from a URI via whatever mechanism the DTMManager prefers source=new StreamSource(argv[0]); } + // Get a DTM manager, and ask it to load the DTM "uniquely", // with no whitespace filtering, nonincremental, but _with_ @@ -136,10 +198,19 @@ // Briefly display this node // Don't bother displaying namespaces or attrs; we do that at the // next level up. + // %REVIEW% Add namespace info, type info, ... + + // Formatting hack -- suppress quotes when value is null, to distinguish + // it from "null". + String value=dtm.getNodeValue(nodeHandle); + String vq=(value==null) ? "" : "\""; + System.out.println(indent+ - "Node "+nodeHandle+": \""+dtm.getNodeName(nodeHandle)+ + "Node "+nodeHandle+": "+ + TYPENAME[dtm.getNodeType(nodeHandle)]+" \""+ + dtm.getNodeName(nodeHandle)+ "\" expandedType="+dtm.getExpandedTypeID(nodeHandle)+ - " ("+TYPENAME[dtm.getNodeType(nodeHandle)]+")\n"+ + "\n"+ indent+ "\tParent=" + dtm.getParent(nodeHandle) + @@ -147,7 +218,7 @@ " NextSib=" + dtm.getNextSibling(nodeHandle)+"\n"+ indent+ - "\tValue=\"" + dtm.getNodeValue(nodeHandle)+"\"" + "\tValue=" + vq + value + vq ); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
