Package org.dom4j

Examples of org.dom4j.Node


   
    protected void marshalContent(List content)
        throws JiBXException, IOException {
        int size = content.size();
        for (int i = 0; i < size; i++) {
            Node node = (Node)content.get(i);
            switch (node.getNodeType()) {
               
                case Node.CDATA_SECTION_NODE:
                    m_xmlWriter.writeCData(node.getText());
                    break;
               
                case Node.COMMENT_NODE:
                    m_xmlWriter.writeComment(node.getText());
                    break;
               
                case Node.ELEMENT_NODE:
                    marshalElement((Element)node);
                    break;
               
                case Node.ENTITY_REFERENCE_NODE:
                    m_xmlWriter.writeEntityRef(node.getName());
                    break;
               
                case Node.PROCESSING_INSTRUCTION_NODE:
                    m_xmlWriter.writePI(((ProcessingInstruction)node).
                        getTarget(), node.getText());
                    break;
               
                case Node.TEXT_NODE:
                    m_xmlWriter.writeTextContent(node.getText());
                    break;
               
                default:
                    break;
            }
View Full Code Here


        ArrayList nss = null;
        boolean hascontent = false;
        int defind = -1;
        String defuri = null;
        for (int i = 0; i < size; i++) {
            Node node = element.node(i);
            if (node instanceof Namespace) {
                Namespace dns = (Namespace)node;
                if (findNamespaceIndex(dns) < 0) {
                    if (nss == null) {
                        nss = new ArrayList();
View Full Code Here

        {
            XMLWriter xmlWriter = new XMLWriter(stringWriter);

            for (final Iterator iterator = element.nodeIterator(); iterator.hasNext();)
            {
                Node childElement = (Node)iterator.next();
                xmlWriter.write(childElement.getText());
            }

            xmlWriter.flush();
            xmlWriter.close();
        }
View Full Code Here

        }
    }

    public void loadJobNode(Node arg0) throws LoadJobException {
        try {
            Node firstNode = (Node) arg0.selectSingleNode("first/@value");
            if (firstNode != null && firstNode.getText().length() > 0) {
                Node firstPwd = (Node) arg0.selectSingleNode("first/@password");
                selectionPanel.getLoader().addFile(new File(firstNode.getText()),
                        (firstPwd != null) ? firstPwd.getText() : null);
            }
            Node secondNode = (Node) arg0.selectSingleNode("second/@value");
            if (secondNode != null && secondNode.getText().length() > 0) {
                Node secondPwd = (Node) arg0.selectSingleNode("second/@password");
                selectionPanel.getLoader().addFile(new File(secondNode.getText()),
                        (secondPwd != null) ? secondPwd.getText() : null);
            }
            Node fileDestination = (Node) arg0.selectSingleNode("destination/@value");
            if (fileDestination != null) {
                destinationTextField.setText(fileDestination.getText());
            }
            Node stepDestination = (Node) arg0.selectSingleNode("step/@value");
            if (stepDestination != null) {
                stepTextField.setText(stepDestination.getText());
            }
            Node secondStepDestination = (Node) arg0.selectSingleNode("secondstep/@value");
            if (secondStepDestination != null) {
                secondStepTextField.setText(secondStepDestination.getText());
            }
            Node fileOverwrite = (Node) arg0.selectSingleNode("overwrite/@value");
            if (fileOverwrite != null) {
                overwriteCheckbox.setSelected(TRUE.equals(fileOverwrite.getText()));
            }
            Node reverseFirst = (Node) arg0.selectSingleNode("reverse_first/@value");
            if (reverseFirst != null) {
                reverseFirstCheckbox.setSelected(TRUE.equals(reverseFirst.getText()));
            }
            Node reverseSecond = (Node) arg0.selectSingleNode("reverse_second/@value");
            if (reverseSecond != null) {
                reverseSecondCheckbox.setSelected(TRUE.equals(reverseSecond.getText()));
            }

            Node fileCompressed = (Node) arg0.selectSingleNode("compressed/@value");
            if (fileCompressed != null && TRUE.equals(fileCompressed.getText())) {
                outputCompressedCheck.doClick();
            }

            Node pdfVersion = (Node) arg0.selectSingleNode("pdfversion/@value");
            if (pdfVersion != null) {
                for (int i = 0; i < versionCombo.getItemCount(); i++) {
                    if (((StringItem) versionCombo.getItemAt(i)).getId().equals(pdfVersion.getText())) {
                        versionCombo.setSelectedIndex(i);
                        break;
                    }
                }
            }
View Full Code Here

   * @param element
   * @param path
   * @return String
   */
  public static String getNodeStringValue(Element element, String path) {
    Node node = element.selectSingleNode(path);
    return node.getText();
  }
View Full Code Here

   * @param element
   * @param path
   * @return
   */
  public static int getNodeIntValue(Element element, String path) {
    Node node = element.selectSingleNode(path);
    if(node != null) {
      if(StringUtils.hasText(node.getText()))
        return Integer.parseInt(node.getText());
      else
        return 0;
    } else
      return 0;
  }
View Full Code Here

   * @param element
   * @param path
   * @return
   */
  public static long getNodeLongValue(Element element, String path) {
    Node node = element.selectSingleNode(path);
    if(node != null) {
      if(StringUtils.hasText(node.getText()))
        return Long.parseLong(node.getText());
      else
        return 0l;
    } else
      return 0l;
  }
View Full Code Here

   * @param element
   * @param path
   * @return
   */
  public static double getNodeDoubleValue(Element element, String path) {
    Node node = element.selectSingleNode(path);
    if(node != null) {
      if("".equals(node.getText()))
        return 0d;
      else
        return Double.parseDouble(node.getText());
    }
    else
      return 0d;
  }
View Full Code Here

   * @param element
   * @param path
   * @return
   */
  public static String getElementLeft(Element tranEl) {
    Node position = tranEl.selectSingleNode("position");
    return ((Element)position).attributeValue("left");
  }
View Full Code Here

   *
   * @param element
   * @return
   */
  public static String getElementTop(Element element) {
    Node position = element.selectSingleNode("position");
    return ((Element)position).attributeValue("top");
  }
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.