public void startElement(String ns, String localName, String name,
			Attributes atts) throws org.xml.sax.SAXException {

		Element elem;

		// Note that the namespace-aware call must be used to correctly
		// construct a Level 2 DOM, even for non-namespaced nodes.
		if ((null == ns) || (ns.length() == 0))
			elem = m_doc.createElementNS(null, name);
		else
			elem = m_doc.createElementNS(ns, name);

		append(elem);

		try {
			int nAtts = atts.getLength();

			if (0 != nAtts) {
				for (int i = 0; i < nAtts; i++) {

					// System.out.println("type " + atts.getType(i) + " name " +
					// atts.getLocalName(i) );
					// First handle a possible ID attribute
					if (atts.getType(i).equalsIgnoreCase("ID"))
						setIDAttribute(atts.getValue(i), elem);

					String attrNS = atts.getURI(i);

					if ("".equals(attrNS))
						attrNS = null; // DOM represents no-namespace as null

					// System.out.println("attrNS: "+attrNS+", localName: "+atts.getQName(i)
					// +", qname: "+atts.getQName(i)+", value: "+atts.getValue(i));
					// Crimson won't let us set an xmlns: attribute on the DOM.
					String attrQName = atts.getQName(i);

					// In SAX, xmlns[:] attributes have an empty namespace,
					// while in DOM they
					// should have the xmlns namespace
					if (attrQName.startsWith("xmlns:")
							|| attrQName.equals("xmlns")) {
						attrNS = "http://www.w3.org/2000/xmlns/";
					}

					// ALWAYS use the DOM Level 2 call!
					elem.setAttributeNS(attrNS, attrQName, atts.getValue(i));
				}
			}

			// append(elem);

			m_elemStack.push(elem);

			m_currentNode = elem;

			// append(elem);
		} catch (java.lang.Exception de) {
			// de.printStackTrace();
			throw new org.xml.sax.SAXException(de);
		}

	}
public void startElement ( String ns , String localName , String name , Attributes atts ) throws org . xml . sax . SAXException { Element elem ; if ( ( null == ns ) || ( ns . length ( ) == 0 ) ) elem = m_doc . createElementNS ( null , name ) ; else elem = m_doc . createElementNS ( ns , name ) ; append ( elem ) ; try { int nAtts = atts . getLength ( ) ; if ( 0 != nAtts ) { for ( int i = 0 ; i < nAtts ; i ++ ) { if ( atts . getType ( i ) . equalsIgnoreCase ( "ID" ) ) setIDAttribute ( atts . getValue ( i ) , elem ) ; String attrNS = atts . getURI ( i ) ; if ( "" . equals ( attrNS ) ) attrNS = null ; String attrQName = atts . getQName ( i ) ; if ( attrQName . startsWith ( "xmlns:" ) || attrQName . equals ( "xmlns" ) ) { attrNS = "http://www.w3.org/2000/xmlns/" ; } elem . setAttributeNS ( attrNS , attrQName , atts . getValue ( i ) ) ; } } m_elemStack . push ( elem ) ; m_currentNode = elem ; } catch ( java . lang . Exception de ) { throw new org . xml . sax . SAXException ( de ) ; } }
Receive notification of the beginning of an element.

<p>
The Parser will invoke this method at the beginning of every element in
the XML document; there will be a corresponding endElement() event for
every startElement() event (even when the element is empty). All of the
element's content will be reported, in order, before the corresponding
endElement() event.
</p>

<p>
If the element name has a namespace prefix, the prefix will still be
attached. Note that the attribute list provided will contain only
attributes with explicit values (specified or defaulted): #IMPLIED
attributes will be omitted.
</p>


@param ns
The namespace of the node
@param localName
The local part of the qualified name
@param name
The element name.
@param atts
The attributes attached to the element, if any.
@see #endElement
@see org.xml.sax.Attributes