1 package com.neuronrobotics.sdk.addons.kinematics.xml;
2 import java.io.IOException;
3 import java.io.InputStream;
5 import javax.xml.parsers.DocumentBuilder;
6 import javax.xml.parsers.DocumentBuilderFactory;
7 import javax.xml.parsers.ParserConfigurationException;
9 import org.w3c.dom.Document;
10 import org.w3c.dom.Element;
11 import org.w3c.dom.Node;
12 import org.w3c.dom.NodeList;
13 import org.xml.sax.SAXException;
28 return XmlFactory.class.getResourceAsStream(file);
39 DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
40 DocumentBuilder dBuilder;
43 dBuilder = dbFactory.newDocumentBuilder();
44 doc = dBuilder.parse(config);
45 doc.getDocumentElement().normalize();
46 }
catch (ParserConfigurationException e) {
47 throw new RuntimeException(e);
48 }
catch (SAXException e) {
49 throw new RuntimeException(e);
50 }
catch (IOException e) {
51 throw new RuntimeException(e);
67 return doc.getElementsByTagName(sTag);
77 public static String
getTagValue(String sTag, Element eElement){
79 NodeList nlList= eElement.getElementsByTagName(sTag).item(0).getChildNodes();
80 Node nValue = (Node) nlList.item(0);
82 return nValue.getNodeValue();
93 NodeList nlList= eElement.getElementsByTagName(sTag).item(0).getChildNodes();
94 Node nValue = (Node) nlList.item(0);
96 return Double.parseDouble(nValue.getNodeValue());
static Double getTagValueDouble(String sTag, Element eElement)
static String getTagValue(String sTag, Element eElement)
static InputStream getDefaultConfigurationStream(String file)
static Document getAllNodesDocument(InputStream config)
static NodeList getAllNodesFromTag(String sTag, InputStream config)