+++ /dev/null
-/*--------------------------------------------------------------------------\r
- * Copyright 2004 Taro L. Saito\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *--------------------------------------------------------------------------*/\r
-//--------------------------------------\r
-// XerialJ Project\r
-//\r
-// InvertedPathTreeTest.java\r
-// Since: 2005/06/02\r
-//\r
-// $URL: http://www.xerial.org/svn/project/XerialJ/trunk/xerial-core/src/test/java/org/xerial/util/xml/index/InvertedPathTreeTest.java $ \r
-// $Author: leo $\r
-//--------------------------------------\r
-package org.xerial.util.xml.index;\r
-\r
-import java.io.BufferedReader;\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.StringReader;\r
-import java.io.StringWriter;\r
-\r
-import org.xerial.core.XerialException;\r
-import org.xerial.util.io.NullOutputStream;\r
-import org.xerial.util.xml.XMLAttribute;\r
-import org.xerial.util.xml.XMLException;\r
-import org.xerial.util.xml.XMLGenerator;\r
-import org.xerial.util.xml.index.InvertedPathTree;\r
-\r
-import junit.framework.TestCase;\r
-\r
-public class InvertedPathTreeTest extends TestCase\r
-{\r
- public void testInvertedPathTree() throws IOException, XMLException, XerialException\r
- {\r
- // XML\95¶\8f\91\82Ì\8f\80\94õ\r
- StringWriter xmlWriter = new StringWriter();\r
- XMLGenerator xout = new XMLGenerator(xmlWriter);\r
- xout.startTag("booklist");\r
- xout.startTag("book", new XMLAttribute().add("isbn", "20424142342")).\r
- startTag("author").\r
- element("first-name", "Peter").\r
- element("last-name", "Buneman").\r
- endTag().\r
- element("author", new XMLAttribute().add("id", "3214"), "leoleo").\r
- element("year", "2005").\r
- startTag("publisher").\r
- element("name", "Morgan-Kaufmann").\r
- endTag().\r
- endTag();\r
- xout.startTag("book").\r
- startTag("authors").\r
- startTag("author").element("id", "4234").text("taro").endTag().\r
- element("author", "yui").\r
- endTag().\r
- endTag(); \r
- \r
- xout.endTag();\r
- xout.endDocument();\r
- xout.flush();\r
- \r
- Reader xmlSource = new BufferedReader(new StringReader(xmlWriter.getBuffer().toString()));\r
- \r
- InvertedPathTree ipt = new InvertedPathTree();\r
- ipt.generateFrom(xmlSource);\r
- ipt.outputGraphviz(new NullOutputStream());\r
- }\r
-}\r
-\r
-\r
-\r
-\r