Fri, 23 Aug 2013 09:57:21 +0100
8022885: Update JAX-WS RI integration to 2.2.9-b14140
8013016: Rebase 8009009 against the latest jdk8/jaxws
Reviewed-by: alanb, chegar
1 /*
2 * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 *
25 * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
26 */
28 package com.sun.xml.internal.fastinfoset.tools;
30 import com.sun.xml.internal.fastinfoset.QualifiedName;
31 import java.io.File;
33 import javax.xml.parsers.SAXParser;
34 import javax.xml.parsers.SAXParserFactory;
36 import com.sun.xml.internal.fastinfoset.util.CharArrayArray;
37 import com.sun.xml.internal.fastinfoset.util.ContiguousCharArrayArray;
38 import com.sun.xml.internal.fastinfoset.util.PrefixArray;
39 import com.sun.xml.internal.fastinfoset.util.QualifiedNameArray;
40 import com.sun.xml.internal.fastinfoset.util.StringArray;
41 import com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary;
44 public class PrintTable {
46 /** Creates a new instance of PrintTable */
47 public PrintTable() {
48 }
50 public static void printVocabulary(ParserVocabulary vocabulary) {
51 printArray("Attribute Name Table", vocabulary.attributeName);
52 printArray("Attribute Value Table", vocabulary.attributeValue);
53 printArray("Character Content Chunk Table", vocabulary.characterContentChunk);
54 printArray("Element Name Table", vocabulary.elementName);
55 printArray("Local Name Table", vocabulary.localName);
56 printArray("Namespace Name Table", vocabulary.namespaceName);
57 printArray("Other NCName Table", vocabulary.otherNCName);
58 printArray("Other String Table", vocabulary.otherString);
59 printArray("Other URI Table", vocabulary.otherURI);
60 printArray("Prefix Table", vocabulary.prefix);
61 }
63 public static void printArray(String title, StringArray a) {
64 System.out.println(title);
66 for (int i = 0; i < a.getSize(); i++) {
67 System.out.println("" + (i + 1) + ": " + a.getArray()[i]);
68 }
69 }
71 public static void printArray(String title, PrefixArray a) {
72 System.out.println(title);
74 for (int i = 0; i < a.getSize(); i++) {
75 System.out.println("" + (i + 1) + ": " + a.getArray()[i]);
76 }
77 }
79 public static void printArray(String title, CharArrayArray a) {
80 System.out.println(title);
82 for (int i = 0; i < a.getSize(); i++) {
83 System.out.println("" + (i + 1) + ": " + a.getArray()[i]);
84 }
85 }
87 public static void printArray(String title, ContiguousCharArrayArray a) {
88 System.out.println(title);
90 for (int i = 0; i < a.getSize(); i++) {
91 System.out.println("" + (i + 1) + ": " + a.getString(i));
92 }
93 }
95 public static void printArray(String title, QualifiedNameArray a) {
96 System.out.println(title);
98 for (int i = 0; i < a.getSize(); i++) {
99 QualifiedName name = a.getArray()[i];
100 System.out.println("" + (name.index + 1) + ": " +
101 "{" + name.namespaceName + "}" +
102 name.prefix + ":" + name.localName);
103 }
104 }
106 /**
107 * @param args the command line arguments
108 */
109 public static void main(String[] args) {
110 try {
111 SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
112 saxParserFactory.setNamespaceAware(true);
114 SAXParser saxParser = saxParserFactory.newSAXParser();
116 ParserVocabulary referencedVocabulary = new ParserVocabulary();
118 VocabularyGenerator vocabularyGenerator = new VocabularyGenerator(referencedVocabulary);
119 File f = new File(args[0]);
120 saxParser.parse(f, vocabularyGenerator);
122 printVocabulary(referencedVocabulary);
123 } catch (Exception e) {
124 e.printStackTrace();
125 }
126 }
127 }