Package org.dom4j

Examples of org.dom4j.Node


   * @return the associated description
   * @throws Exception
   */
  private String getTypeDescription(String exceptionTypeKey) throws Exception {
    String retVal = "UNK";
    Node node = document.selectSingleNode("/exception-types/type[@key=\"" + exceptionTypeKey + "\"]/@description");
    if (node != null) {
      retVal = node.getText();
    }
    return retVal;
  }
View Full Code Here


            for(Object obj : doc.selectNodes("object-template/properties/object-property")) {
                logger.debug("obj: " + obj);

                if(obj instanceof Node) {
                    Node node = (Node)obj;

                    ObjectProperty op = objectPropertyFactory.createObjectProperty(baseTemplate.getCampaign(), true);
                    logger.trace("op: " + op);

                    op.setName(node.selectSingleNode("@name").getStringValue());
                    try {
                        op.setTemplate(Boolean.parseBoolean(node.selectSingleNode("@template").getStringValue()));
                    }
                    catch(Exception e) {
                        // ignore
                    }
                    // try {
                    // op.setSequence(Integer.parseInt(node.selectSingleNode("@sequence").getStringValue()));
                    // }
                    // catch(Exception e) {
                    // // ignore
                    // }
                    try {
                        op.setInstanceValueLimit(Integer.parseInt(node.selectSingleNode("@instance-limit")
                                .getStringValue()));
                    }
                    catch(Exception e) {
                        // ignore
                    }

                    // calculator
                    {
                        Node calcNode = node.selectSingleNode("calculator");
                        if(calcNode != null) {
                            op.setCalculatorType(calcNode.selectSingleNode("@type").getStringValue());
                            op.setCalculatorInputs(calcNode.selectSingleNode("@inputs").getStringValue());
                            op.setCalculatorBody(calcNode.getStringValue());
                        }
                    }

                    // formatter
                    {
                        Node formatterNode = node.selectSingleNode("formatter");
                        if(formatterNode != null) {
                            op.setFormatterType(formatterNode.selectSingleNode("@type").getStringValue());
                            op.setFormatterBody(formatterNode.getStringValue());
                        }
                    }

                    // validator
                    {
                        Node validatorNode = node.selectSingleNode("validator");
                        if(validatorNode != null) {
                            op.setValidatorType(validatorNode.selectSingleNode("@type").getStringValue());
                            op.setValidatorBody(validatorNode.getStringValue());
                        }
                    }

                    baseTemplate.addProperty(op);
                    op.setObjectTemplate(baseTemplate);
View Full Code Here

        if ( contextNode instanceof Document )
        {
            return new SingleObjectIterator( contextNode );
        }

        Node node = (Node) contextNode;

        Object parent = node.getParent();

        if ( parent == null )
        {
            parent = node.getDocument();
        }
       
        return new SingleObjectIterator( parent );
    }
View Full Code Here

        {
            return contextNode;
        }
        else if ( contextNode instanceof Node )
        {
            Node node = (Node) contextNode;
            return node.getDocument();
        }
        return null;
    }
View Full Code Here

    public Object getParentNode(Object contextNode)
    {
        if ( contextNode instanceof Node )
        {
            Node node = (Node) contextNode;
            Object answer = node.getParent();
            if ( answer == null )
            {
                answer = node.getDocument();
                if ( answer == null )
                {
                    answer = node;
                }
            }
View Full Code Here

        {
            element = (Element) context;
        }
        else if ( context instanceof Node )
        {
            Node node = (Node) context;
            element = node.getParent();
        }
        if ( element != null )
        {
            Namespace namespace = element.getNamespaceForPrefix( prefix );
View Full Code Here

        /*
         *  find if we have an AST where the xpath expression mathes
         *  for this node
         */

        Node dom4jnode = (Node) node.getNodeImpl();
        SimpleNode sn = null;

        for( int i = 0; i < xpathList.size(); i++ )
        {
            Map m = (Map) xpathList.get(i);
View Full Code Here

        List list = new ArrayList();

        for( int i = 0; i < l.size(); i++)
        {
            Node n = (Node) l.get( i );

            if ( n != null )
            {
                list.add( makeDVSLNode( n ) );
            }
View Full Code Here

        throws Exception {
        String resultStr = "";

        try {
            Document doc = DocumentHelper.parseText(inXml);
            Node node = doc.selectSingleNode(targetName);
            resultStr = node.getText();
        } catch (Exception e) {
          new StrUtils().LOG.error(e.getMessage(), e);
        }

        return resultStr;
View Full Code Here

  public void widgetSelected(SelectionEvent e) {
    if(e.getSource().equals(save)){
      if(element!=null)
        element.attribute("password").setText(password.getText());
      else{
        Node n = rootElement.selectSingleNode("//user[@username='"+uname.getText()+"']");
        if(n!=null){
          MessageDialog dlg = new MessageDialog(window,"Duplicate user",
                              null,
                              "You're trying to create a user who already exists!",
                              SWT.ICON_ERROR,
View Full Code Here

TOP

Related Classes of org.dom4j.Node

Copyright © 2018 www.massapicom. 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.