StAXStream2SAX.java revision 286
286N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. 286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 286N/A * This code is free software; you can redistribute it and/or modify it 286N/A * under the terms of the GNU General Public License version 2 only, as 286N/A * published by the Free Software Foundation. Oracle designates this 286N/A * particular file as subject to the "Classpath" exception as provided 286N/A * by Oracle in the LICENSE file that accompanied this code. 286N/A * This code is distributed in the hope that it will be useful, but WITHOUT 286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 286N/A * version 2 for more details (a copy is included in the LICENSE file that 286N/A * accompanied this code). 286N/A * You should have received a copy of the GNU General Public License version 286N/A * 2 along with this work; if not, write to the Free Software Foundation, 286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 286N/A * or visit www.oracle.com if you need additional information or have any 286N/A * @author Padmaja Vedula 286N/A * @author Sunitha Reddy 286N/A //private final static String EMPTYSTRING = ""; 286N/A //private static final String XMLNS_PREFIX = "xmlns"; 286N/A //private Node _dom = null; 286N/A //private Hashtable _nsPrefixes = new Hashtable(); 286N/A //Main Work Starts Here. 286N/A * This class is only used internally so this method should never 286N/A // remembers the nest level of elements to know when we are done. 286N/A // skip over START_DOCUMENT 286N/A // If not a START_ELEMENT (e.g., a DTD), skip to next tag 286N/A // An error if a START_ELEMENT isn't found now 286N/A // These are all of the events listed in the javadoc for 286N/A // The spec only really describes 11 of them. 286N/A // workaround for bugid 5046319 - switch over to commented section 286N/A // below when it is fixed. 286N/A// len = staxStreamReader.getTextCharacters(start, buf, 0, buf.length); 286N/A// _sax.characters(buf, 0, len); 286N/A// } catch (SAXException e) { 286N/A// throw new XMLStreamException(e); 286N/A// } while (len == buf.length); 286N/A //construct prefix:localName from qName 286N/A // end namespace bindings 286N/A // start namespace bindings 286N/A * Get the attributes associated with the given START_ELEMENT or ATTRIBUTE 286N/A * @return the StAX attributes converted to an org.xml.sax.Attributes 286N/A // in SAX, namespace declarations are not part of attributes by default. 286N/A // (there's a property to control that, but as far as we are concerned 286N/A // we don't use it.) So don't add xmlns:* to attributes. 286N/A // gather non-namespace attrs 286N/A // namespace events don't normally occur outside of a startElement 286N/A // attribute events don't normally occur outside of a startElement 286N/A // it seems like we need to pass this info along, but how? 286N/A // this event is listed in the javadoc, but not in the spec. 286N/A // this event is listed in the javadoc, but not in the spec. 286N/A // this event is listed in the javadoc, but not in the spec. 286N/A // this event is listed in the javadoc, but not in the spec. 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never 286N/A * This class is only used internally so this method should never