Java XML Attribute Read getLong(Node xmlNode, String attributeLabel)

Here you can find the source of getLong(Node xmlNode, String attributeLabel)

Description

get Long

License

LGPL

Declaration

public static long getLong(Node xmlNode, String attributeLabel) 

Method Source Code

//package com.java2s;
/**//w ww .  ja  va  2s . c o  m
 * Computes the intersection between two lines. The calculated point is approximate, 
 * since integers are used. If you need a more precise result, use doubles
 * everywhere. 
 * (c) 2007 Alexander Hristov. Use Freely (LGPL license). http://www.ahristov.com
 *
 * @param x1 Point 1 of Line 1
 * @param y1 Point 1 of Line 1
 * @param x2 Point 2 of Line 1
 * @param y2 Point 2 of Line 1
 * @param x3 Point 1 of Line 2
 * @param y3 Point 1 of Line 2
 * @param x4 Point 2 of Line 2
 * @param y4 Point 2 of Line 2
 * @return Point where the segments intersect, or null if they don't
 */

import org.w3c.dom.Node;

public class Main {
    public static long getLong(Node xmlNode) {
        return Long.parseLong(xmlNode.getTextContent());
    }

    public static long getLong(Node xmlNode, String attributeLabel) {
        return Long.parseLong(xmlNode.getAttributes().getNamedItem(attributeLabel).getNodeValue());
    }
}

Related

  1. getLong(String attrName, Map runtimeAttributes, Node docElement)
  2. getLongAttribute(NamedNodeMap namedNodeMap, String name)
  3. getLongAttribute(String name, Element el)
  4. getNameAttribute(final Node aNode)