Java XML Attribute Namespace countNonNamespaceAttribures(NamedNodeMap attrs)

Here you can find the source of countNonNamespaceAttribures(NamedNodeMap attrs)

Description

count Non Namespace Attribures

License

Open Source License

Declaration

private static int countNonNamespaceAttribures(NamedNodeMap attrs) 

Method Source Code

//package com.java2s;
/*//  w  w w  . j  av a 2  s . co m
 * @(#) NamespaceResolver.java       1.1 14/8/2016
 *
 * Copyright (c)  Provenance Intelligence Consultancy Limited.
 * 
 * This software is the confidential and proprietary information of 
 * Provenance Intelligence Consultancy Limited.  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Provenance Intelligence Consultancy Limited.
 */

import org.w3c.dom.Attr;

import org.w3c.dom.NamedNodeMap;

public class Main {
    private static int countNonNamespaceAttribures(NamedNodeMap attrs) {
        int n = 0;
        for (int i = 0; i < attrs.getLength(); i++) {
            Attr attr = (Attr) attrs.item(i);
            if (!attr.getName().startsWith("xmlns")) {
                n++;
            }
        }
        return n;
    }
}

Related

  1. getNamespaceDeclarationPrefix(Attr attr)
  2. isNamespaceDef(Attr attr)
  3. isNamespaceDefinition(Attr attr)
  4. isNoNamespaceAttribute(final XMLStreamReader reader, final int index)