286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 1999-2004 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * This class takes SAX events (in addition to some extra events 286N/A * that SAX doesn't handle yet) and adds the result to a document 286N/A * or document fragment. 286N/A /** The next sibling node */ 286N/A /** First node of document fragment or null if not a DocumentFragment */ 286N/A /** Vector of element nodes */ 286N/A * DOMBuilder instance constructor... it will add the DOM nodes 286N/A * to the document fragment. 286N/A * @param doc Root document 286N/A * @param node Current node 286N/A * DOMBuilder instance constructor... it will add the DOM nodes 286N/A * to the document fragment. 286N/A * @param doc Root document 286N/A * @param docFrag Document fragment 286N/A * DOMBuilder instance constructor... it will add the DOM nodes 286N/A * @param doc Root document 286N/A * Get the root document or DocumentFragment of the DOM being created. 286N/A * @return The root document or document fragment if not null 286N/A * Get the root node of the DOM tree. 286N/A * Get the node currently being processed. 286N/A * @return the current node being processed 286N/A * Set the next sibling node, which is where the result nodes 286N/A * should be inserted before. 286N/A * @param nextSibling the next sibling node. 286N/A * Return the next sibling node. 286N/A * @return the next sibling node. 286N/A * Return null since there is no Writer for this class. 286N/A * Append a node to the current container. 286N/A * @param newNode New node to append 286N/A // System.out.println(newNode.getNodeName()); 286N/A * Receive an object for locating the origin of SAX document events. 286N/A * <p>SAX parsers are strongly encouraged (though not absolutely 286N/A * required) to supply a locator: if it does so, it must supply 286N/A * the locator to the application by invoking this method before 286N/A * invoking any of the other methods in the ContentHandler 286N/A * <p>The locator allows the application to determine the end 286N/A * position of any document-related event, even if the parser is 286N/A * not reporting an error. Typically, the application will 286N/A * use this information for reporting its own errors (such as 286N/A * character content that does not match an application's 286N/A * business rules). The information returned by the locator 286N/A * is probably not sufficient for use with a search engine.</p> 286N/A * <p>Note that the locator will return correct information only 286N/A * during the invocation of the events in this interface. The 286N/A * application should not attempt to use it at any other time.</p> 286N/A * @param locator An object that can return the location of 286N/A * any SAX document event. 286N/A // No action for the moment. 286N/A * Receive notification of the beginning of a document. 286N/A * <p>The SAX parser will invoke this method only once, before any 286N/A * other methods in this interface or in DTDHandler (except for 286N/A * setDocumentLocator).</p> 286N/A // No action for the moment. 286N/A * Receive notification of the end of a document. 286N/A * <p>The SAX parser will invoke this method only once, and it will 286N/A * be the last method invoked during the parse. The parser shall 286N/A * not invoke this method until it has either abandoned parsing 286N/A * (because of an unrecoverable error) or reached the end of 286N/A // No action for the moment. 286N/A * Receive notification of the beginning of an element. 286N/A * <p>The Parser will invoke this method at the beginning of every 286N/A * element in the XML document; there will be a corresponding 286N/A * endElement() event for every startElement() event (even when the 286N/A * element is empty). All of the element's content will be 286N/A * reported, in order, before the corresponding endElement() 286N/A * <p>If the element name has a namespace prefix, the prefix will 286N/A * still be attached. Note that the attribute list provided will 286N/A * contain only attributes with explicit values (specified or 286N/A * defaulted): #IMPLIED attributes will be omitted.</p> 286N/A * @param ns The namespace of the node 286N/A * @param localName The local part of the qualified name 286N/A * @param name The element name. 286N/A * @param atts The attributes attached to the element, if any. 286N/A // Note that the namespace-aware call must be used to correctly 286N/A // construct a Level 2 DOM, even for non-namespaced nodes. 286N/A //System.out.println("type " + atts.getType(i) + " name " + atts.getLocalName(i) ); 286N/A // First handle a possible ID attribute 286N/A // System.out.println("attrNS: "+attrNS+", localName: "+atts.getQName(i) 286N/A // +", qname: "+atts.getQName(i)+", value: "+atts.getValue(i)); 286N/A // Crimson won't let us set an xmlns: attribute on the DOM. 286N/A // In SAX, xmlns[:] attributes have an empty namespace, while in DOM they 286N/A // should have the xmlns namespace 286N/A // ALWAYS use the DOM Level 2 call! 286N/A // de.printStackTrace(); 286N/A * Receive notification of the end of an element. 286N/A * <p>The SAX parser will invoke this method at the end of every 286N/A * element in the XML document; there will be a corresponding 286N/A * startElement() event for every endElement() event (even when the 286N/A * element is empty).</p> 286N/A * <p>If the element name has a namespace prefix, the prefix will 286N/A * still be attached to the name.</p> 286N/A * @param ns the namespace of the element 286N/A * @param localName The local part of the qualified name of the element 286N/A * @param name The element name 286N/A * Set an ID string to node association in the ID table. 286N/A * @param id The ID string. 286N/A * @param elem The associated ID. 286N/A // Do nothing. This method is meant to be overiden. 286N/A * Receive notification of character data. 286N/A * <p>The Parser will call this method to report each chunk of 286N/A * character data. SAX parsers may return all contiguous character 286N/A * data in a single chunk, or they may split it into several 286N/A * chunks; however, all of the characters in any single event 286N/A * must come from the same external entity, so that the Locator 286N/A * provides useful information.</p> 286N/A * <p>The application must not attempt to read from the array 286N/A * outside of the specified range.</p> 286N/A * <p>Note that some parsers will report whitespace using the 286N/A * ignorableWhitespace() method rather than this one (validating 286N/A * parsers must do so).</p> 286N/A * @param ch The characters from the XML document. 286N/A * @param start The start position in the array. 286N/A * @param length The number of characters to read from the array. 286N/A * @see #ignorableWhitespace 286N/A return;
// avoid DOM006 Hierarchy request error 286N/A * If available, when the disable-output-escaping attribute is used, 286N/A * output raw text without escaping. A PI will be inserted in front 286N/A * of the node with the name "lotusxsl-next-is-raw" and a value of 286N/A * @param ch Array containing the characters 286N/A * @param start Index to start of characters in the array 286N/A * @param length Number of characters in the array 286N/A return;
// avoid DOM006 Hierarchy request error 286N/A * Report the beginning of an entity. 286N/A * The start and end of the document entity are not reported. 286N/A * The start and end of the external DTD subset are reported 286N/A * using the pseudo-name "[dtd]". All other events must be 286N/A * @param name The name of the entity. If it is a parameter 286N/A * entity, the name will begin with '%'. 286N/A // Almost certainly the wrong behavior... 286N/A // entityReference(name); 286N/A * Report the end of an entity. 286N/A * @param name The name of the entity that is ending. 286N/A * Receive notivication of a entityReference. 286N/A * @param name name of the entity reference 286N/A * Receive notification of ignorable whitespace in element content. 286N/A * <p>Validating Parsers must use this method to report each chunk 286N/A * of ignorable whitespace (see the W3C XML 1.0 recommendation, 286N/A * section 2.10): non-validating parsers may also use this method 286N/A * if they are capable of parsing and using content models.</p> 286N/A * <p>SAX parsers may return all contiguous whitespace in a single 286N/A * chunk, or they may split it into several chunks; however, all of 286N/A * the characters in any single event must come from the same 286N/A * external entity, so that the Locator provides useful 286N/A * <p>The application must not attempt to read from the array 286N/A * outside of the specified range.</p> 286N/A * @param ch The characters from the XML document. 286N/A * @param start The start position in the array. 286N/A * @param length The number of characters to read from the array. 286N/A return;
// avoid DOM006 Hierarchy request error 286N/A * Tell if the current node is outside the document element. 286N/A * @return true if the current node is outside the document element. 286N/A * Receive notification of a processing instruction. 286N/A * <p>The Parser will invoke this method once for each processing 286N/A * instruction found: note that processing instructions may occur 286N/A * before or after the main document element.</p> 286N/A * <p>A SAX parser should never report an XML declaration (XML 1.0, 286N/A * section 2.8) or a text declaration (XML 1.0, section 4.3.1) 286N/A * using this method.</p> 286N/A * @param target The processing instruction target. 286N/A * @param data The processing instruction data, or null if 286N/A * Report an XML comment anywhere in the document. 286N/A * This callback will be used for comments inside or outside the 286N/A * document element, including comments in the external DTD 286N/A * @param ch An array holding the characters in the comment. 286N/A * @param start The starting position in the array. 286N/A * @param length The number of characters to use from the array. 286N/A /** Flag indicating that we are processing a CData section */ 286N/A * Report the start of a CDATA section. 286N/A * Report the end of a CDATA section. 286N/A * Receive notification of cdata. 286N/A * <p>The Parser will call this method to report each chunk of 286N/A * character data. SAX parsers may return all contiguous character 286N/A * data in a single chunk, or they may split it into several 286N/A * chunks; however, all of the characters in any single event 286N/A * must come from the same external entity, so that the Locator 286N/A * provides useful information.</p> 286N/A * <p>The application must not attempt to read from the array 286N/A * outside of the specified range.</p> 286N/A * <p>Note that some parsers will report whitespace using the 286N/A * ignorableWhitespace() method rather than this one (validating 286N/A * parsers must do so).</p> 286N/A * @param ch The characters from the XML document. 286N/A * @param start The start position in the array. 286N/A * @param length The number of characters to read from the array. 286N/A * @see #ignorableWhitespace 286N/A return;
// avoid DOM006 Hierarchy request error 286N/A * Report the start of DTD declarations, if any. 286N/A * Any declarations are assumed to be in the internal subset 286N/A * unless otherwise indicated. 286N/A * @param name The document type name. 286N/A * @param publicId The declared public identifier for the 286N/A * external DTD subset, or null if none was declared. 286N/A * @param systemId The declared system identifier for the 286N/A * external DTD subset, or null if none was declared. 286N/A * Report the end of DTD declarations. 286N/A * Begin the scope of a prefix-URI Namespace mapping. 286N/A * <p>The information from this event is not necessary for 286N/A * normal Namespace processing: the SAX XML reader will 286N/A * automatically replace prefixes for element and attribute 286N/A * feature is true (the default).</p> 286N/A * <p>There are cases, however, when applications need to 286N/A * use prefixes in character data or in attribute values, 286N/A * where they cannot safely be expanded automatically; the 286N/A * to the application to expand prefixes in those contexts 286N/A * itself, if necessary.</p> 286N/A * guaranteed to be properly nested relative to each-other: 286N/A * all startPrefixMapping events will occur before the 286N/A * corresponding startElement event, and all endPrefixMapping 286N/A * events will occur after the corresponding endElement event, 286N/A * but their order is not guaranteed.</p> 286N/A * @param prefix The Namespace prefix being declared. 286N/A * @param uri The Namespace URI the prefix is mapped to. 286N/A * @see #endPrefixMapping 286N/A // Not sure if this is needed or wanted 286N/A // Also, it fails in the stree. 286N/A if((null != m_currentNode) 286N/A && (m_currentNode.getNodeType() == Node.ELEMENT_NODE)) 286N/A if(((null != prefix) && (prefix.length() == 0)) 286N/A qname = "xmlns:"+prefix; 286N/A Element elem = (Element)m_currentNode; 286N/A String val = elem.getAttribute(qname); // Obsolete, should be DOM2...? 286N/A * End the scope of a prefix-URI mapping. 286N/A * <p>See startPrefixMapping for details. This event will 286N/A * always occur after the corresponding endElement event, 286N/A * but the order of endPrefixMapping events is not otherwise 286N/A * @param prefix The prefix that was being mapping. 286N/A * @see #startPrefixMapping 286N/A * Receive notification of a skipped entity. 286N/A * <p>The Parser will invoke this method once for each entity 286N/A * skipped. Non-validating processors may skip entities if they 286N/A * have not seen the declarations (because, for example, the 286N/A * entity was declared in an external DTD subset). All processors 286N/A * may skip external entities, depending on the values of the 286N/A * @param name The name of the skipped entity. If it is a 286N/A * parameter entity, the name will begin with '%'.