org.xml.sax.Attributes#getQName ( )源码实例Demo

下面列出了org.xml.sax.Attributes#getQName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u60   文件: SynthParser.java
private void startBindKey(Attributes attributes) throws SAXException {
    if (_inputMapID == null) {
        // Not in an inputmap, bail.
        return;
    }
    if (_style != null) {
        String key = null;
        String value = null;
        for(int i = attributes.getLength() - 1; i >= 0; i--) {
            String aKey = attributes.getQName(i);

            if (aKey.equals(ATTRIBUTE_KEY)) {
                key = attributes.getValue(i);
            }
            else if (aKey.equals(ATTRIBUTE_ACTION)) {
                value = attributes.getValue(i);
            }
        }
        if (key == null || value == null) {
            throw new SAXException(
                "bindKey: you must supply a key and action");
        }
        _inputMapBindings.add(key);
        _inputMapBindings.add(value);
    }
}
 
源代码2 项目: Java8CN   文件: SynthParser.java
private void startGraphics(Attributes attributes) throws SAXException {
    SynthGraphicsUtils graphics = null;

    for(int i = attributes.getLength() - 1; i >= 0; i--) {
        String key = attributes.getQName(i);
        if (key.equals(ATTRIBUTE_IDREF)) {
            graphics = (SynthGraphicsUtils)lookup(attributes.getValue(i),
                                             SynthGraphicsUtils.class);
        }
    }
    if (graphics == null) {
        throw new SAXException("graphicsUtils: you must supply an idref");
    }
    if (_style != null) {
        _style.setGraphicsUtils(graphics);
    }
}
 
源代码3 项目: jdk1.8-source-analysis   文件: SynthParser.java
private void startBindKey(Attributes attributes) throws SAXException {
    if (_inputMapID == null) {
        // Not in an inputmap, bail.
        return;
    }
    if (_style != null) {
        String key = null;
        String value = null;
        for(int i = attributes.getLength() - 1; i >= 0; i--) {
            String aKey = attributes.getQName(i);

            if (aKey.equals(ATTRIBUTE_KEY)) {
                key = attributes.getValue(i);
            }
            else if (aKey.equals(ATTRIBUTE_ACTION)) {
                value = attributes.getValue(i);
            }
        }
        if (key == null || value == null) {
            throw new SAXException(
                "bindKey: you must supply a key and action");
        }
        _inputMapBindings.add(key);
        _inputMapBindings.add(value);
    }
}
 
源代码4 项目: openjdk-8-source   文件: SynthParser.java
private void startImageIcon(Attributes attributes) throws SAXException {
 String path = null;
 String id = null;

 for(int i = attributes.getLength() - 1; i >= 0; i--) {
     String key = attributes.getQName(i);

     if (key.equals(ATTRIBUTE_ID)) {
         id = attributes.getValue(i);
     }
     else if (key.equals(ATTRIBUTE_PATH)) {
         path = attributes.getValue(i);
     }
 }
 if (path == null) {
     throw new SAXException("imageIcon: you must specify a path");
 }
 register(id, new LazyImageIcon(getResource(path)));
}
 
源代码5 项目: hottub   文件: AttributesImpl.java
/**
 * Copy an entire Attributes object.
 *
 * <p>It may be more efficient to reuse an existing object
 * rather than constantly allocating new ones.</p>
 *
 * @param atts The attributes to copy.
 */
public void setAttributes (Attributes atts)
{
    clear();
    length = atts.getLength();
    if (length > 0) {
        data = new String[length*5];
        for (int i = 0; i < length; i++) {
            data[i*5] = atts.getURI(i);
            data[i*5+1] = atts.getLocalName(i);
            data[i*5+2] = atts.getQName(i);
            data[i*5+3] = atts.getType(i);
            data[i*5+4] = atts.getValue(i);
        }
    }
}
 
源代码6 项目: openjdk-jdk9   文件: SynthParser.java
private void startBindKey(Attributes attributes) throws SAXException {
    if (_inputMapID == null) {
        // Not in an inputmap, bail.
        return;
    }
    if (_style != null) {
        String key = null;
        String value = null;
        for(int i = attributes.getLength() - 1; i >= 0; i--) {
            String aKey = attributes.getQName(i);

            if (aKey.equals(ATTRIBUTE_KEY)) {
                key = attributes.getValue(i);
            }
            else if (aKey.equals(ATTRIBUTE_ACTION)) {
                value = attributes.getValue(i);
            }
        }
        if (key == null || value == null) {
            throw new SAXException(
                "bindKey: you must supply a key and action");
        }
        _inputMapBindings.add(key);
        _inputMapBindings.add(value);
    }
}
 
源代码7 项目: openjdk-jdk9   文件: SynthParser.java
private void startGraphics(Attributes attributes) throws SAXException {
    SynthGraphicsUtils graphics = null;

    for(int i = attributes.getLength() - 1; i >= 0; i--) {
        String key = attributes.getQName(i);
        if (key.equals(ATTRIBUTE_IDREF)) {
            graphics = (SynthGraphicsUtils)lookup(attributes.getValue(i),
                                             SynthGraphicsUtils.class);
        }
    }
    if (graphics == null) {
        throw new SAXException("graphicsUtils: you must supply an idref");
    }
    if (_style != null) {
        _style.setGraphicsUtils(graphics);
    }
}
 
/**
 * Add the contents of the attribute list to this list.
 *
 * @param atts List of attributes to add to this list
 */
public void addAttributes(Attributes atts)
{

  int nAtts = atts.getLength();

  for (int i = 0; i < nAtts; i++)
  {
    String uri = atts.getURI(i);

    if (null == uri)
      uri = "";

    String localName = atts.getLocalName(i);
    String qname = atts.getQName(i);
    int index = this.getIndex(uri, localName);
    // System.out.println("MutableAttrListImpl#addAttributes: "+uri+":"+localName+", "+index+", "+atts.getQName(i)+", "+this);
    if (index >= 0)
      this.setAttribute(index, uri, localName, qname, atts.getType(i),
                        atts.getValue(i));
    else
      addAttribute(uri, localName, qname, atts.getType(i),
                   atts.getValue(i));
  }
}
 
源代码9 项目: openjdk-jdk8u   文件: SynthParser.java
private void startBindKey(Attributes attributes) throws SAXException {
    if (_inputMapID == null) {
        // Not in an inputmap, bail.
        return;
    }
    if (_style != null) {
        String key = null;
        String value = null;
        for(int i = attributes.getLength() - 1; i >= 0; i--) {
            String aKey = attributes.getQName(i);

            if (aKey.equals(ATTRIBUTE_KEY)) {
                key = attributes.getValue(i);
            }
            else if (aKey.equals(ATTRIBUTE_ACTION)) {
                value = attributes.getValue(i);
            }
        }
        if (key == null || value == null) {
            throw new SAXException(
                "bindKey: you must supply a key and action");
        }
        _inputMapBindings.add(key);
        _inputMapBindings.add(value);
    }
}
 
源代码10 项目: datawave   文件: XMLFieldConfigHelper.java
void startNoMatch(String uri, String localName, String qName, Attributes attributes) throws SAXException {
    final int sz = attributes.getLength();
    final Set<String> seenAttr = new HashSet<>(expectedDefaultAttributes);
    
    for (int i = 0; i < sz; i++) {
        final String qn = attributes.getQName(i);
        final String lv = attributes.getValue(i);
        
        if (STORED.equals(qn)) {
            fieldHelper.setNoMatchStored(Boolean.parseBoolean(lv));
            seenAttr.remove(STORED);
        } else if (INDEXED.equals(qn)) {
            fieldHelper.setNoMatchIndexed(Boolean.parseBoolean(lv));
            seenAttr.remove(INDEXED);
        } else if (REVERSE_INDEXED.equals(qn)) {
            fieldHelper.setNoMatchReverseIndexed(Boolean.parseBoolean(lv));
            seenAttr.remove(REVERSE_INDEXED);
        } else if (TOKENIZED.equals(qn)) {
            fieldHelper.setNoMatchTokenized(Boolean.parseBoolean(lv));
            seenAttr.remove(TOKENIZED);
        } else if (REVERSE_TOKENIZED.equals(qn)) {
            fieldHelper.setNoMatchReverseTokenized(Boolean.parseBoolean(lv));
            seenAttr.remove(REVERSE_TOKENIZED);
        } else if (INDEX_TYPE.equals(qn)) {
            if (this.ingestHelper != null) {
                this.ingestHelper.updateDatawaveTypes(null, lv);
            } else {
                log.warn("No BaseIngestHelper set, ignoring type information for nomatch in configuration file");
            }
            seenAttr.remove(INDEX_TYPE);
        } else {
            throw new IllegalArgumentException("Unexpected attribute encounteded in: " + uri + " in 'nomatch' tag: '" + qn + "'");
        }
    }
    
    if (!seenAttr.isEmpty()) {
        throw new IllegalArgumentException("nomatch tag incomplete, '" + seenAttr + "' attributes were missing");
    }
}
 
源代码11 项目: hottub   文件: AttributesImpl.java
/**
 * Copy an entire Attributes object.
 *
 * <p>It may be more efficient to reuse an existing object
 * rather than constantly allocating new ones.</p>
 *
 * @param atts The attributes to copy.
 */
public void setAttributes (Attributes atts)
{
clear();
length = atts.getLength();
data = new String[length*5];
for (int i = 0; i < length; i++) {
    data[i*5] = atts.getURI(i);
    data[i*5+1] = atts.getLocalName(i);
    data[i*5+2] = atts.getQName(i);
    data[i*5+3] = atts.getType(i);
    data[i*5+4] = atts.getValue(i);
}
}
 
源代码12 项目: openjdk-8-source   文件: JAXPValidatorComponent.java
/**
 * Compares the given {@link Attributes} with {@link #fCurrentAttributes}
 * and update the latter accordingly.
 */
private void updateAttributes( Attributes atts ) {
    int len = atts.getLength();
    for( int i=0; i<len; i++ ) {
        String aqn = atts.getQName(i);
        int j = fCurrentAttributes.getIndex(aqn);
        String av = atts.getValue(i);
        if(j==-1) {
            // newly added attribute. add to the current attribute list.

            String prefix;
            int idx = aqn.indexOf(':');
            if( idx<0 ) {
                prefix = null;
            } else {
                prefix = symbolize(aqn.substring(0,idx));
            }

            j = fCurrentAttributes.addAttribute(
                new QName(
                    prefix,
                    symbolize(atts.getLocalName(i)),
                    symbolize(aqn),
                    symbolize(atts.getURI(i))),
                atts.getType(i),av);
        } else {
            // the attribute is present.
            if( !av.equals(fCurrentAttributes.getValue(j)) ) {
                // but the value was changed.
                fCurrentAttributes.setValue(j,av);
            }
        }

        /** Augmentations augs = fCurrentAttributes.getAugmentations(j);
        augs.putItem( Constants.TYPEINFO,
            typeInfoProvider.getAttributeTypeInfo(i) );
        augs.putItem( Constants.ID_ATTRIBUTE,
            typeInfoProvider.isIdAttribute(i)?Boolean.TRUE:Boolean.FALSE ); **/
    }
}
 
源代码13 项目: TencentKona-8   文件: SynthParser.java
private void startInputMap(Attributes attributes) throws SAXException {
    _inputMapBindings.clear();
    _inputMapID = null;
    if (_style != null) {
        for(int i = attributes.getLength() - 1; i >= 0; i--) {
            String key = attributes.getQName(i);

            if (key.equals(ATTRIBUTE_ID)) {
                _inputMapID = attributes.getValue(i);
            }
        }
    }
}
 
/**
 * Compares the given {@link Attributes} with {@link #fCurrentAttributes}
 * and update the latter accordingly.
 */
private void updateAttributes( Attributes atts ) {
    int len = atts.getLength();
    for( int i=0; i<len; i++ ) {
        String aqn = atts.getQName(i);
        int j = fCurrentAttributes.getIndex(aqn);
        String av = atts.getValue(i);
        if(j==-1) {
            // newly added attribute. add to the current attribute list.

            String prefix;
            int idx = aqn.indexOf(':');
            if( idx<0 ) {
                prefix = null;
            } else {
                prefix = symbolize(aqn.substring(0,idx));
            }

            j = fCurrentAttributes.addAttribute(
                new QName(
                    prefix,
                    symbolize(atts.getLocalName(i)),
                    symbolize(aqn),
                    symbolize(atts.getURI(i))),
                atts.getType(i),av);
        } else {
            // the attribute is present.
            if( !av.equals(fCurrentAttributes.getValue(j)) ) {
                // but the value was changed.
                fCurrentAttributes.setValue(j,av);
            }
        }

        /** Augmentations augs = fCurrentAttributes.getAugmentations(j);
        augs.putItem( Constants.TYPEINFO,
            typeInfoProvider.getAttributeTypeInfo(i) );
        augs.putItem( Constants.ID_ATTRIBUTE,
            typeInfoProvider.isIdAttribute(i)?Boolean.TRUE:Boolean.FALSE ); **/
    }
}
 
源代码15 项目: netbeans   文件: FxModelBuilder.java
@NbBundle.Messages({
    "# {0} - tag name",
    "ERR_invalidPropertyName=Invalid property name: {0}"
})
private FxNode handlePropertyTag(String propName, Attributes atts) {
    PropertyValue pv;
    
    int errorAttrs = 0;
    for (int i = 0; i < atts.getLength(); i++) {
        String uri = atts.getURI(i);
        if (uri != null) {
            String qn = atts.getQName(i);
            errorAttrs++;
            addAttributeError(qn, 
                "property-namespaced-attribute",
                ERR_propertyElementNamespacedAttribute(qn),
                qn
            );
        }
    }
    
    int stProp = FxXmlSymbols.findStaticProperty(propName);
    switch (stProp) {
        case -1:
            // simple property
            if (!Utilities.isJavaIdentifier(propName)) {
                addError(new ErrorMark(
                    start, end,
                    "invalid-property-name",
                    ERR_invalidPropertyName(propName),
                    propName
                ));
            }
            if (errorAttrs == atts.getLength()) {
                pv = handleSimpleProperty(propName, atts);
            } else {
                pv = handleMapProperty(propName, atts);
            }
            break;
            
        case -2:
            // broken name, but must create a node
            pv = accessor.makeBroken(accessor.createProperty(propName, false));
            // do not add the property to the parent, it's broken beyond repair
            addError(new ErrorMark(
                start, end,
                "invalid-property-name",
                ERR_invalidPropertyName(propName),
                propName
            ));
            break;
            
        default:
            // static property, just ignore for now
            pv = handleStaticProperty(propName.substring(0, stProp), 
                    propName.substring(stProp + 1), atts);
            break;
    }
    
    return pv;
}
 
源代码16 项目: Bytecoder   文件: SAX2DOM.java
public void startElement(String namespace, String localName, String qName,
        Attributes attrs)
    {
        appendTextNode();
        if (needToSetDocumentInfo) {
            setDocumentInfo();
            needToSetDocumentInfo = false;
        }

        final Element tmp = _document.createElementNS(namespace, qName);

        // Add namespace declarations first
        if (_namespaceDecls != null) {
            final int nDecls = _namespaceDecls.size();
            for (int i = 0; i < nDecls; i++) {
                final String prefix = _namespaceDecls.get(i++);

                if (prefix == null || prefix.equals(EMPTYSTRING)) {
                    tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX,
                        _namespaceDecls.get(i));
                }
                else {
                    tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix,
                        _namespaceDecls.get(i));
                }
            }
            _namespaceDecls.clear();
        }

        // Add attributes to element
/*      final int nattrs = attrs.getLength();
        for (int i = 0; i < nattrs; i++) {
            if (attrs.getLocalName(i) == null) {
                tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
            }
            else {
                tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i),
                    attrs.getValue(i));
            }
        } */


        // Add attributes to element
        final int nattrs = attrs.getLength();
        for (int i = 0; i < nattrs; i++) {
            // checking if Namespace processing is being done
            String attQName = attrs.getQName(i);
            String attURI = attrs.getURI(i);
            String type = (attrs.getType(i) == null) ?
                    XMLSymbols.fCDATASymbol : attrs.getType(i);
            if (attrs.getLocalName(i).equals("")) {
                tmp.setAttribute(attQName, attrs.getValue(i));
                if (type.equals("ID")) {
                    tmp.setIdAttribute(attQName, true);
                }
            } else {
                tmp.setAttributeNS(attURI, attQName, attrs.getValue(i));
                if (type.equals("ID")) {
                    tmp.setIdAttributeNS(attURI, attrs.getLocalName(i), true);
                }
            }
        }


        // Append this new node onto current stack node
        Node last = _nodeStk.peek();

        // If the SAX2DOM is created with a non-null next sibling node,
        // insert the result nodes before the next sibling under the root.
        if (last == _root && _nextSibling != null)
            last.insertBefore(tmp, _nextSibling);
        else
            last.appendChild(tmp);

        // Push this node onto stack
        _nodeStk.push(tmp);
        _lastSibling = null;
    }
 
源代码17 项目: tomcatsrc   文件: SetPropertyRule.java
/**
 * Process the beginning of this element.
 *
 * @param namespace the namespace URI of the matching element, or an 
 *   empty string if the parser is not namespace aware or the element has
 *   no namespace
 * @param theName the local name if the parser is namespace aware, or just 
 *   the element name otherwise
 * @param attributes The attribute list for this element
 * 
 * @exception NoSuchMethodException if the bean does not
 *  have a writable property of the specified name
 */
@Override
public void begin(String namespace, String theName, Attributes attributes)
        throws Exception {

    // Identify the actual property name and value to be used
    String actualName = null;
    String actualValue = null;
    for (int i = 0; i < attributes.getLength(); i++) {
        String name = attributes.getLocalName(i);
        if ("".equals(name)) {
            name = attributes.getQName(i);
        }
        String value = attributes.getValue(i);
        if (name.equals(this.name)) {
            actualName = value;
        } else if (name.equals(this.value)) {
            actualValue = value;
        }
    }

    // Get a reference to the top object
    Object top = digester.peek();

    // Log some debugging information
    if (digester.log.isDebugEnabled()) {
        digester.log.debug("[SetPropertyRule]{" + digester.match +
                "} Set " + top.getClass().getName() + " property " +
                actualName + " to " + actualValue);
    }

    // Set the property (with conversion as necessary)
    if (!digester.isFakeAttribute(top, actualName) 
            && !IntrospectionUtils.setProperty(top, actualName, actualValue) 
            && digester.getRulesValidation()) {
        digester.log.warn("[SetPropertyRule]{" + digester.match +
                "} Setting property '" + name + "' to '" +
                value + "' did not find a matching property.");
    }

}
 
源代码18 项目: jdk1.8-source-analysis   文件: DOMBuilder.java
/**
 * 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
 */
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);
  }

}
 
源代码19 项目: Bytecoder   文件: DOMBuilder.java
/**
 * 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
 */
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);
  }

}
 
源代码20 项目: openjdk-jdk8u-backup   文件: DOMBuilder.java
/**
 * 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
 */
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);
  }

}