Package org.dom4j

Examples of org.dom4j.Element


  private static void visit(StringBuilder sb, Element elem) {
    sb.append(elem.getTextTrim());
    List children = elem.elements();
    for (Iterator it_ch = children.iterator(); it_ch.hasNext();) {
      Element element = (Element) it_ch.next();
      visit(sb, element);
    }
  }
View Full Code Here


        sw.getBuffer().append(((Node)node).asXML());
    }

    void getChildren(Object node, String localName, String namespaceUri, List result) {
        if(node instanceof Element) {
            Element e = (Element)node;
            if(localName == null) {
                result.addAll(e.elements());
            }
            else {
                result.addAll(e.elements(e.getQName().getDocumentFactory().createQName(localName, "", namespaceUri)));
            }
        }
        else if(node instanceof Document) {
            Element root = ((Document)node).getRootElement();
            if(localName == null || (equal(root.getName(), localName) && equal(root.getNamespaceURI(), namespaceUri))) {
                result.add(root);
            }
        }
    }
View Full Code Here

        }
    }
   
    void getAttributes(Object node, String localName, String namespaceUri, List result) {
        if(node instanceof Element) {
            Element e = (Element)node;
            if(localName == null) {
                result.addAll(e.attributes());
            }
            else {
                Attribute attr = e.attribute(e.getQName().getDocumentFactory().createQName(localName, "", namespaceUri));
                if(attr != null) {
                    result.add(attr);
                }
            }
        }
View Full Code Here

    }

    public Node getJobNode(Node arg0, boolean savePasswords) throws SaveJobException {
        try {
            if (arg0 != null) {
                Element filelist = ((Element) arg0).addElement("filelist");
                PdfSelectionTableItem[] items = selectionPanel.getTableRows();
                for (int i = 0; i < items.length; i++) {
                    Element fileNode = ((Element) filelist).addElement("file");
                    fileNode.addAttribute("name", items[i].getInputFile().getAbsolutePath());
                    fileNode.addAttribute("pageselection", (items[i].getPageSelection() != null) ? items[i]
                            .getPageSelection() : ALL_STRING);
                    if (savePasswords) {
                        fileNode.addAttribute("password", items[i].getPassword());
                    }
                }

                Element fileDestination = ((Element) arg0).addElement("destination");
                fileDestination.addAttribute("value", destinationTextField.getText());

                Element fileOverwrite = ((Element) arg0).addElement("overwrite");
                fileOverwrite.addAttribute("value", overwriteCheckbox.isSelected() ? TRUE : FALSE);

                Element mergeType = ((Element) arg0).addElement("merge_type");
                mergeType.addAttribute("value", mergeTypeCheck.isSelected() ? TRUE : FALSE);

                Element fileCompress = ((Element) arg0).addElement("compressed");
                fileCompress.addAttribute("value", outputCompressedCheck.isSelected() ? TRUE : FALSE);

                Element pdfVersion = ((Element) arg0).addElement("pdfversion");
                pdfVersion.addAttribute("value", ((StringItem) versionCombo.getSelectedItem()).getId());
            }
            return arg0;
        } catch (Exception ex) {
            throw new SaveJobException(ex);
        }
View Full Code Here

         tmp.append("' />");
         return tmp.toString();
      }
      public void writeXML(Element root)
      {
         Element jar = root.addElement("jar");
         jar.addAttribute("name", jarName);
         jar.addAttribute("specVersion", specVersion);
         jar.addAttribute("specVendor", specVendor);
         jar.addAttribute("specTitle", specTitle);
         jar.addAttribute("implVersion", implVersion);
         jar.addAttribute("implVendor", implVendor);
         jar.addAttribute("implTitle", implTitle);
         jar.addAttribute("implVendorID", implVendorID);
         jar.addAttribute("implURL", implURL);
         jar.addAttribute("sealed", ""+sealed);
         jar.addAttribute("md5Digest", md5Digest);
      }
View Full Code Here

      processDir(jbossHome);
      try
      {
         DocumentFactory df = DocumentFactory.getInstance();
         Document doc = df.createDocument();
         Element root = doc.addElement("jar-versions");
         Iterator iter = jars.iterator();
         while( iter.hasNext() )
         {
            JarInfo info = (JarInfo) iter.next();
            info.writeXML(root);
View Full Code Here

  public DefaultNamespaceContext(Element element) {
    this.element = element;
  }

  public static DefaultNamespaceContext create(Object node) {
    Element element = null;

    if (node instanceof Element) {
      element = (Element) node;
    } else if (node instanceof Document) {
      Document doc = (Document) node;
View Full Code Here

    elementFactoryMap.put(element, parentFactory);
  }

  void resolveElementTypes() {
    for (Map.Entry<Element, QName> entry : typedElementMap.entrySet()) {
      Element element = entry.getKey();
      QName elementQName = getQNameOfSchemaElement(element);
      QName type = entry.getValue();

      if (complexTypeMap.containsKey(type)) {
        DocumentFactory factory = (DocumentFactory) complexTypeMap.get(type);
View Full Code Here

  public int size() {
    return lastElementIndex + 1;
  }

  public Element getElement(int depth) {
    Element element;

    try {
      element = (Element) stack[depth];
    } catch (ArrayIndexOutOfBoundsException e) {
      element = null;
View Full Code Here

    XMLTableDefinition answer = new XMLTableDefinition();
    answer.setRowExpression(definition.attributeValue("select"));

    for (Iterator iter = definition.elementIterator("column"); iter
        .hasNext();) {
      Element element = (Element) iter.next();
      String expression = element.attributeValue("select");
      String name = element.getText();
      String typeName = element.attributeValue("type", "string");
      String columnXPath = element.attributeValue("columnNameXPath");
      int type = XMLTableColumnDefinition.parseType(typeName);

      if (columnXPath != null) {
        answer.addColumnWithXPathName(columnXPath, expression, type);
      } else {
View Full Code Here

TOP

Related Classes of org.dom4j.Element

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.