Package org.dom4j

Examples of org.dom4j.Element.attributeValue()


            while (iter.hasNext()) {
                Element element = (Element) iter.next();
                if ("settings".equals(element.getName())) {
                    readElements(element, settings);
                } else if ("objects".equals(element.getName())) {
                    Class clazz = Class.forName(element.attributeValue("class"));
                    readGeneric(clazz, element);
                }
            }
        } catch (Exception ex) {
            throw new RuntimeException(ex);
View Full Code Here


                } else if ("eventsMap".equals(element.getName())) {
                    Map map = FastMap.newInstance();
                    for (Object evEl : element.elements()) {
                        Element evElement = (Element) evEl;
                        long ref = getRef(evElement);
                        Role role = Role.valueOf(evElement.attributeValue("role"));
                        map.put(getObject(ref, Event.class), role);
                    }
                    return (T) map;
                }
            } else if (Event.class.isAssignableFrom(obj.getClass())) {
View Full Code Here

            Element element = (Element) obj;
            Constraint constraint = null;

            if (RasterConstraint.class.getSimpleName().equals(element.getName())) {
                BitSet bs = getResult(obj, BitSet.class, element);
                int length = Integer.parseInt(element.attributeValue("length"));
                constraint = new RasterConstraint(new WeekRasterImpl(
                        new BitRasterImpl(bs, length)));

            } else if (EventOrderConstraint.class.getSimpleName().equals(element.getName())) {
                UnsupportedOperationException excFirstEl = new UnsupportedOperationException(
View Full Code Here

            List list = document.getRootElement().elements();
            Iterator iter = list.iterator();
            while (iter.hasNext()) {
                Element element = (Element) iter.next();
                try {
                    Class clazz = Class.forName(element.attributeValue("class"));
                    Parsing p = objParsing.getParsing(clazz);
                    Object obj = p.parse(element.getText());
                    setObject(element.getName(), obj);
                } catch (Exception ex) {
                    throw new UnsupportedOperationException("Couldn't read property:"
View Full Code Here

          File conf = new File(catalinaBase, "conf");
          File serverXML = new File(conf, "server.xml");
          SAXReader reader = new SAXReader();
          Document doc = reader.read(serverXML);
          Element serverElement = (Element) doc.selectSingleNode("/Server");
          String serverPort = serverElement.attributeValue("port", "8005");
          String shutdownCommand = serverElement.attributeValue("shutdown", "SHUTDOWN");
         
          // send shutdown command to specified port
          Socket socket = new Socket();
          socket.connect(new InetSocketAddress("127.0.0.1", Integer.parseInt(serverPort)), 1000);
View Full Code Here

          File serverXML = new File(conf, "server.xml");
          SAXReader reader = new SAXReader();
          Document doc = reader.read(serverXML);
          Element serverElement = (Element) doc.selectSingleNode("/Server");
          String serverPort = serverElement.attributeValue("port", "8005");
          String shutdownCommand = serverElement.attributeValue("shutdown", "SHUTDOWN");
         
          // send shutdown command to specified port
          Socket socket = new Socket();
          socket.connect(new InetSocketAddress("127.0.0.1", Integer.parseInt(serverPort)), 1000);
          socket.setSoTimeout(5000);
View Full Code Here

     * @return true if the field was removed.
     */
    public boolean removeField(String variable) {
        for (Iterator it = element.elementIterator("field"); it.hasNext();) {
            Element field = (Element) it.next();
            String fieldVariable = field.attributeValue("var");
            if (variable.equals(fieldVariable)) {
                return element.remove(field);
            }
        }
        return false;
View Full Code Here

     * @return the language code of the text description, if it exists.
     */
    public String getTextLang() {
        Element textElement = element.element("text");
        if (textElement != null) {
            return textElement.attributeValue(QName.get("lang", "xml",
                        "http://www.w3.org/XML/1998/namespace"));
        }
        return null;
    }

View Full Code Here

    public static Element getChild(Element parent, String tagName, String attribute, String attributeValue) {
        Element childElement = null;
        Iterator iterator = parent.elements(tagName).iterator();
        while (iterator.hasNext() && childElement == null) {
            childElement = (Element) iterator.next();
            String actualValue = childElement.attributeValue(attribute);
            if (!attributeValue.equals(actualValue)) {
                childElement = null;
            }
        }
        return childElement;
View Full Code Here

        List<Element> children = new ArrayList<Element>();

        Iterator iterator = parent.elements(tagName).iterator();
        while (iterator.hasNext()) {
            Element childElement = (Element) iterator.next();
            String actualValue = childElement.attributeValue(attribute);
            if (attributeValue.equals(actualValue)) {
                children.add(childElement);
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.