A single node is read, the namespace attributes are extracted and stored.

@param node
to examine
@param attributesOnly,
if true no recursion happens
481535
private void examineNode(Node node, boolean attributesOnly) {
		while(node != null && node.getNodeType() == Node.COMMENT_NODE) {
			node = node.getNextSibling();
		}
		if(node != null) {
			NamedNodeMap attributes = node.getAttributes();
			if(attributes != null) {
				for (int i = 0; i < attributes.getLength(); i++) {
					Node attribute = attributes.item(i);
					storeAttribute((Attr) attribute);
				}
			}

			if (!attributesOnly) {
				NodeList chields = node.getChildNodes();
				for (int i = 0; i < chields.getLength(); i++) {
					Node chield = chields.item(i);
					if (chield.getNodeType() == Node.ELEMENT_NODE)
						examineNode(chield, false);
				}
			}
		}
	}
695103
private static void getNamespaceBindings(Element element, Map<String, String> namespaceMap) {
    if (element == null) {
      return;
    }
    NamedNodeMap attrs = element.getAttributes();
    for (int i = 0; i < attrs.getLength(); i++) {
      Node node = attrs.item(i);
      String name = node.getNodeName();
      if ((name != null && (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || name.startsWith(XMLConstants.XMLNS_ATTRIBUTE + ":")))) {
        namespaceMap.put(name, node.getNodeValue());
      }
    }
    Node parent = element.getParentNode();
    if (parent instanceof Element) {
      getNamespaceBindings((Element) parent, namespaceMap);
    }
  }
7910
private static Stream<Node> streamAttributes(Node node) {
        final NamedNodeMap attributes = node.getAttributes();
        if (attributes == null) return Stream.empty();
        return IntStream.range(0, attributes.getLength()).mapToObj(attributes::item);
    }
625142
function(node, feature) {
        var name = this.createElementNS(this.namespaces.gpx, 'name');
        name.appendChild(this.createTextNode(
            feature.attributes.name || feature.id));
        node.appendChild(name);
        var desc = this.createElementNS(this.namespaces.gpx, 'desc');
        desc.appendChild(this.createTextNode(
            feature.attributes.description || this.defaultDesc));
        node.appendChild(desc);
        // TBD - deal with remaining (non name/description) attributes.
    }
1055732
function node(name, attributes) {
    "use strict";
    var _node   = document.createElementNS('', name);
    for (var attrName in attributes) {
        var value = attributes[attrName];
        if (attributes.hasOwnProperty(attrName) && isString(attrName)) {
            _node.setAttribute(attrName, value);
        }
    }
    return _node;
}
135957
protected void parse(Node node) {
		NamedNodeMap attributes = node.getAttributes();
		type = getValueRecursive(attributes.getNamedItem("xlink:type"));
		xLink = getValueRecursive(attributes.getNamedItem("xmlns:xlink"));
		href = getValueRecursive(attributes.getNamedItem("xlink:href"));
	}
1320248
protected void addAttributes(SXTag node, Collection<XAttribute> attributes)
			throws IOException {
		SXTag data = node.addChildNode("Data");
		addAttributes(data, "", attributes);
	}
1187874
protected void handleNodeAttributes(Object node, Map attributes) {
        // first, short circuit
        if (node == null) {
            return;
        }

        for (Closure attrDelegate : getProxyBuilder().getAttributeDelegates()) {
            FactoryBuilderSupport builder = this;
            if (attrDelegate.getOwner() instanceof FactoryBuilderSupport) {
                builder = (FactoryBuilderSupport) attrDelegate.getOwner();
            } else if (attrDelegate.getDelegate() instanceof FactoryBuilderSupport) {
                builder = (FactoryBuilderSupport) attrDelegate.getDelegate();
            }

            attrDelegate.call(builder, node, attributes);
        }

        if (getProxyBuilder().getCurrentFactory().onHandleNodeAttributes(getProxyBuilder().getChildBuilder(), node, attributes)) {
            getProxyBuilder().setNodeAttributes(node, attributes);
        }
    }
167537
function(node) {
        var attributes = {};
       
        // Extended Data is parsed first.
        var edNodes = node.getElementsByTagName("ExtendedData");
        if (edNodes.length) {
            attributes = this.parseExtendedData(edNodes[0]);
        }
        
        // assume attribute nodes are type 1 children with a type 3 or 4 child
        var child, grandchildren, grandchild;
        var children = node.childNodes;

        for(var i=0, len=children.length; i<len; ++i) {
            child = children[i];
            if(child.nodeType == 1) {
                grandchildren = child.childNodes;
                if(grandchildren.length >= 1 && grandchildren.length <= 3) {
                    var grandchild;
                    switch (grandchildren.length) {
                        case 1:
                            grandchild = grandchildren[0];
                            break;
                        case 2:
                            var c1 = grandchildren[0];
                            var c2 = grandchildren[1];
                            grandchild = (c1.nodeType == 3 || c1.nodeType == 4) ?
                                c1 : c2;
                            break;
                        case 3:
                        default:
                            grandchild = grandchildren[1];
                            break;
                    }
                    if(grandchild.nodeType == 3 || grandchild.nodeType == 4) {
                        var name = (child.prefix) ?
                                child.nodeName.split(":")[1] :
                                child.nodeName;
                        var value = OpenLayers.Util.getXmlNodeValue(grandchild);
                        if (value) {
                            value = value.replace(this.regExes.trimSpace, "");
                            attributes[name] = value;
                        }
                    }
                } 
            }
        }
        return attributes;
    }
927169
private void startElementRootNode(final Attributes attributes) {

        LOG.debug("Found rootNode");
        try {
            this.rootNode = this.newNode(null, attributes);
            this.nodeStack.push(this.rootNode);
        } catch (final RepositoryException e) {
            throw new AssertionError("Could not create node", e);
        }
    }
1071718
function (node) {
      var name = "";

      var n = this.html.indexOf("=", this.currentChar);
      if (n === -1) {
        this.currentChar = this.html.length;
      } else {
        // Read until a '=' character is hit; this will be the attribute key
        name = this.html.substring(this.currentChar, n);
        this.currentChar = n + 1;
      }

      if (!name)
        return;

      // After a '=', we should see a '"' for the attribute value
      var c = this.nextChar();
      if (c !== '"' && c !== "'") {
        this.error("Error reading attribute " + name + ", expecting '\"'");
        return;
      }

      // Read the attribute value (and consume the matching quote)
      var value = this.readString(c);

      node.attributes.push(new Attribute(name, value));

      return;
    }
694876
private String getNamespace(final Attr attribute) {
        final Element parent = attribute.getOwnerElement();
        return parent.getAttribute(NAMESPACE);
    }
1082880
@Override
  protected void visitFieldAccessNode(FieldAccessNode node) {
    // simplify children first
    visitChildren(node);
    ExprNode baseExpr = node.getChild(0);
    if (baseExpr instanceof RecordLiteralNode) {
      RecordLiteralNode recordLiteral = (RecordLiteralNode) baseExpr;
      for (int i = 0; i < recordLiteral.numChildren(); i++) {
        if (recordLiteral.getKey(i).identifier().equals(node.getFieldName())) {
          node.getParent().replaceChild(node, recordLiteral.getChild(i));
          return;
        }
      }
      // replace with null?  this should have been a compiler error.
    } else if (baseExpr instanceof ProtoInitNode) {
      ProtoInitNode protoInit = (ProtoInitNode) baseExpr;
      int fieldIndex = -1;
      for (int i = 0; i < protoInit.getParamNames().size(); i++) {
        if (protoInit.getParamNames().get(i).identifier().equals(node.getFieldName())) {
          fieldIndex = i;
          break;
        }
      }
      if (fieldIndex != -1) {
        node.getParent().replaceChild(node, protoInit.getChild(fieldIndex));
      } else {
        // here we could replace with a default value or null, but for now, do nothing, rather than
        // implement proto default field semantics.
      }
    }
  }
84319
protected void isAttributeWellFormed(Node node) {
        boolean isNameWF = false;
        if ((fFeatures & NAMESPACES) != 0) {
            isNameWF =
                isValidQName(
                    node.getPrefix(),
                    node.getLocalName(),
                    fIsXMLVersion11);
        } else {
            isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11);
        }

        if (!isNameWF) {
            String msg =
                Utils.messages.createMessage(
                    MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                    new Object[] { "Attr", node.getNodeName()});

            if (fErrorHandler != null) {
                fErrorHandler.handleError(
                    new DOMErrorImpl(
                        DOMError.SEVERITY_FATAL_ERROR,
                        msg,
                        MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                        null,
                        null,
                        null));
            }
        }

        // Check the Attr's node value
        // WFC: No < in Attribute Values
        String value = node.getNodeValue();
        if (value.indexOf('<') >= 0) {
            String msg =
                Utils.messages.createMessage(
                    MsgKey.ER_WF_LT_IN_ATTVAL,
                    new Object[] {
                        ((Attr) node).getOwnerElement().getNodeName(),
                        node.getNodeName()});

            if (fErrorHandler != null) {
                fErrorHandler.handleError(
                    new DOMErrorImpl(
                        DOMError.SEVERITY_FATAL_ERROR,
                        msg,
                        MsgKey.ER_WF_LT_IN_ATTVAL,
                        null,
                        null,
                        null));
            }
        }

        // we need to loop through the children of attr nodes and check their values for
        // well-formedness  
        NodeList children = node.getChildNodes();
        for (int i = 0; i < children.getLength(); i++) {
            Node child = children.item(i);
            // An attribute node with no text or entity ref child for example
            // doc.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:ns");
            // followes by
            // element.setAttributeNodeNS(attribute);
            // can potentially lead to this situation.  If the attribute
            // was a prefix Namespace attribute declaration then then DOM Core 
            // should have some exception defined for this.
            if (child == null) {
                // we should probably report an error
                continue;
            }
            switch (child.getNodeType()) {
                case Node.TEXT_NODE :
                    isTextWellFormed((Text) child);
                    break;
                case Node.ENTITY_REFERENCE_NODE :
                    isEntityReferneceWellFormed((EntityReference) child);
                    break;
                default :
            }
        }

        // TODO:
        // WFC: Check if the attribute prefix is bound to 
        // http://www.w3.org/2000/xmlns/  

        // WFC: Unique Att Spec
        // Perhaps pass a seen boolean value to this method.  serializeAttList will determine
        // if the attr was seen before.
    }
35873
def get_attribute_ns(namespace, name)
      result = nil
      each_attribute() { |attribute|
        if name == attribute.name &&
          namespace == attribute.namespace() &&
          ( !namespace.empty? || !attribute.fully_expanded_name.index(':') )
          # foo will match xmlns:foo, but only if foo isn't also an attribute
          result = attribute if !result or !namespace.empty? or 
                                !attribute.fully_expanded_name.index(':')
        end
      }
      result
    end
1278915
private void parseEntSubAttributes(final Entity ent, final Node node) throws ResourceXMLParserException {
        final Element node1 = (Element) node;
        //load all sub elements called "attribute" as properties
        for (final Object attribute : node1.selectNodes(ATTRIBUTE_TAG)) {
            Element attr=(Element) attribute;
            if(null==attr.selectSingleNode("@" + ATTRIBUTE_NAME_ATTR)) {
                throw new ResourceXMLParserException(
                    ATTRIBUTE_TAG + " element has no '" + ATTRIBUTE_NAME_ATTR + "' attribute: "
                    + reportNodeErrorLocation(attr));
            }
            String attrname = attr.selectSingleNode("@" + ATTRIBUTE_NAME_ATTR).getStringValue();

            String attrvalue;
            //look for "value" attribute
            if(null!=attr.selectSingleNode("@"+ATTRIBUTE_VALUE_ATTR)) {
                attrvalue = attr.selectSingleNode("@" + ATTRIBUTE_VALUE_ATTR).getStringValue();
            }else if(null!= attr.getText()) {
                //look for text content
                attrvalue = attr.getText();
            }else {
                throw new ResourceXMLParserException(
                    ATTRIBUTE_TAG + " element has no '" + ATTRIBUTE_VALUE_ATTR + "' attribute or text content: "
                    + reportNodeErrorLocation(attr));
            }

            ent.properties.setProperty(attrname, attrvalue);
        }
    }
858450
private void checkNoDuplicateKeyAttribute(KeyNode node) {
    SoyNode parentNode = node.getParent();
    if (!(parentNode instanceof HtmlOpenTagNode)) {
      // Error thrown before this.
      return;
    }

    HtmlAttributeNode keyAttrNode = ((HtmlOpenTagNode) parentNode).getDirectAttributeNamed("key");
    if (keyAttrNode != null) {
      errorReporter.report(keyAttrNode.getSourceLocation(), DUPLICATE_KEY_ATTR);
    }
  }