XML.iterateElement = function()

in asdoc/XML.js [532:575]


XML.iterateElement = function(node, xml) {
  var /** @type {number} */ i = 0;
  if (!XML.isInitStatic) {
    XML.hasNodeGetAttributeNames = (node["getAttributeNames"] ? true : false);
    XML.isInitStatic = true;
  }
  //var /** @type {number} */ i = 0;
  var /** @type {Array} */ attrNames = (XML.hasNodeGetAttributeNames ? node["getAttributeNames"]() : XML.polyFillNodeGetAttributeNames(node));
  var /** @type {number} */ len = (attrNames.length) >> 0;
  var /** @type {string} */ localName = node.nodeName;
  var /** @type {string} */ prefix = node.prefix;
  if (prefix && localName.indexOf(prefix + ":") == 0) {
    localName = localName.substr(prefix.length + 1);
  }
  xml._name = XML.getQName(localName, prefix, node.namespaceURI, false);
  var /** @type {Namespace} */ ns;
  for (i = 0; i < len; i++) {
    var /** @type {Attr} */ att = node.getAttributeNode(org.apache.royale.utils.Language.string(attrNames[i]));
    if ((att.name == 'xmlns' || att.prefix == 'xmlns') && att.namespaceURI == 'http://www.w3.org/2000/xmlns/') {
      if (att.prefix) {
        ns = new Namespace(att.localName, att.nodeValue);
      } else {
        ns = new Namespace('', att.nodeValue);
      }
      xml.addNamespace(ns);
    }
    else
      XML.insertAttribute(att, xml);
  }
  for (var /** @type {Node} */ nativeNode = node.firstChild; nativeNode; nativeNode = nativeNode.nextSibling) {
    
/**
 * @const
 * @type {number}
 */
var nodeType = nativeNode.nodeType;
    if ((nodeType == 7 && XML.ignoreProcessingInstructions) || (nodeType == 8 && XML.ignoreComments)) {
      continue;
    }
    var /** @type {XML} */ child = XML.fromNode(nativeNode);
    if (child)
      xml.addChildInternal(child);
  }
};