List of usage examples for org.w3c.dom Element getAttribute
public String getAttribute(String name);
From source file:Main.java
public static String getAttrValuesByName(Element ele, String attributeName) { return ele.getAttribute(attributeName); }
From source file:Main.java
public static String requiredAttribute(String attributeName, Element node) { String attribute = node.getAttribute(attributeName); if (attribute == null || attribute.trim().isEmpty()) { throw new IllegalStateException( String.format("Required attribute by name '%s' is null or empty", attributeName)); }/*from ww w .j ava2 s . c om*/ return attribute; }
From source file:Main.java
public static String getAttribute(Element node, String attributeName) { return node.getAttribute(attributeName); }
From source file:Main.java
public static int getIntAttribute(Element el, String name) { String s = el.getAttribute(name); if (s != null && s.length() > 0) { return Integer.parseInt(s); }//from ww w . j ava2 s .c o m return 0; }
From source file:ListMoviesXML.java
private static Movie getMovie(Element e) { String yearString = e.getAttribute("year"); int year = Integer.parseInt(yearString); Element tElement = (Element) e.getFirstChild(); String title = getTextValue(tElement).trim(); Element pElement = (Element) tElement.getNextSibling(); String pString = getTextValue(pElement).trim(); double price = Double.parseDouble(pString); return new Movie(title, year, price); }
From source file:Main.java
public static String getAttributeStringValue(Element element, String attributeName) { return element.getAttribute(attributeName); }
From source file:Main.java
public static String getAttrValuesByName(Element ele, String attributeName) { return ele.getAttribute(attributeName); }
From source file:Main.java
public static String getString(Element element, String attributeName) { return element.getAttribute(attributeName); }
From source file:Main.java
public static String getAttribute(Element element, String attributeName) { return element.getAttribute(attributeName); }
From source file:Main.java
/** * Parses the given attribute of this tag and returns it as a boolean. * Essentially compares the lower case textual value to the string "true" *//*from ww w .ja va 2s . com*/ public static boolean getAttribBoolean(Element ele, String name) { String sval = ele.getAttribute(name); return sval.toLowerCase().equals("true"); }