com.sun.tools.xjc.reader.dtd.bindinfo.DOMUtil Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.tools.xjc.reader.dtd.bindinfo;
import java.util.ArrayList;
import java.util.List;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* @author Kohsuke Kawaguchi
*/
public final class DOMUtil {
final static String getAttribute(Element e,String attName) {
if(e.getAttributeNode(attName)==null) return null;
return e.getAttribute(attName);
}
public static String getAttribute(Element e, String nsUri, String local) {
if(e.getAttributeNodeNS(nsUri,local)==null) return null;
return e.getAttributeNS(nsUri,local);
}
public static Element getElement(Element e, String nsUri, String localName) {
NodeList l = e.getChildNodes();
for(int i=0;i getChildElements(Element e) {
List r = new ArrayList();
NodeList l = e.getChildNodes();
for(int i=0;i getChildElements(Element e,String localName) {
List r = new ArrayList();
NodeList l = e.getChildNodes();
for(int i=0;i