Package org.openntf.domino.utils.xml

Examples of org.openntf.domino.utils.xml.XMLNode


@SuppressWarnings("serial")
public abstract class DXLItemObject extends AbstractDXLItem {

  protected static DXLItemObject create(final XMLNode node, final int dupItemId) {
    XMLNode objectNode = node.getFirstChildElement();
    XMLNode objectDataNode = objectNode.getFirstChildElement();
    String objectDataNodeName = objectDataNode.getNodeName();
    if("file".equals(objectDataNodeName)) {
      return new DXLItemObjectFile(node, dupItemId);
    } else {
      throw new UnsupportedOperationException("Unsupported object type " + objectDataNodeName);
    }
View Full Code Here


      noteClass = "replformula";
    }
    noteClass_ = NoteClass.valueOf(noteClass.toUpperCase());
    default_ = "true".equals(node.getAttribute("default"));

    XMLNode noteInfo = node.selectSingleNode("noteinfo");
    noteId_ = Integer.parseInt(noteInfo.getAttribute("noteid"), 16);
    universalId_ = noteInfo.getAttribute("unid");
    sequence_ = Integer.parseInt(noteInfo.getAttribute("sequence"), 10);

    if (DEBUG)
      System.out.println("\tUNID: " + universalId_);

    for (XMLNode itemNode : node.selectNodes("./item")) {
View Full Code Here

  private final double value_;

  protected DXLItemNumber(final XMLNode node, final int dupItemId) {
    super(node, dupItemId);

    XMLNode dataNode = node.selectSingleNode("./number");
    value_ = Double.parseDouble(dataNode.getText());
  }
View Full Code Here

    }

    XMLNodeList dateRangeNodes = node.selectNodes("./datetimelist/datetimepair");
    dateRangeValues_ = new NSFDateRange[dateRangeNodes.size()];
    for(int i = 0; i < dateRangeNodes.size(); i++) {
      XMLNode startNode = dateRangeNodes.get(i).getFirstChildElement();
      NSFDateTime start = DXLItemFactory.createDateTime(startNode);
      XMLNode endNode = startNode.getNextSiblingElement();
      NSFDateTime end = DXLItemFactory.createDateTime(endNode);
      dateRangeValues_[i] = new NSFDateRange(start, end);
    }
  }
View Full Code Here

  private final byte[] compiledFormula_;

  protected DXLItemFormula(final XMLNode node, final int dupItemId) {
    super(node, dupItemId);

    XMLNode dataNode = node.getFirstChildElement();
    if("true".equals(dataNode.getAttribute("compiled"))) {
      formula_ = null;
      compiledFormula_ = parseBase64Binary(dataNode.getText());
    } else {
      formula_ = dataNode.getText();
      compiledFormula_ = null;
    }
  }
View Full Code Here

  private final NSFDateTime value_;

  protected DXLItemTime(final XMLNode node, final int dupItemId) {
    super(node, dupItemId);

    XMLNode dataNode = node.getFirstChildElement();
    value_ = DXLItemFactory.createDateTime(dataNode);
  }
View Full Code Here

  private final String value_;

  protected DXLItemText(final XMLNode node, final int dupItemId) {
    super(node, dupItemId);

    XMLNode dataNode = node.selectSingleNode("./text");
    value_ = dataNode.getText();
  }
View Full Code Here

  public void setName(final String name) {
    getDocumentElement().setAttribute("name", name);
  }

  protected void setItemValue(final String itemName, final Object value) {
    XMLNode node = getDxl().selectSingleNode("//item[@name='" + XMLDocument.escapeXPathValue(itemName) + "']");
    if (node == null) {
      node = getDxl().selectSingleNode("/*").addChildElement("item");
      node.setAttribute("name", itemName);
    } else {
      node.removeChildren();
    }

    if (value instanceof Iterable) {
      Object first = ((Iterable<?>) value).iterator().next();
      XMLNode list = node.addChildElement(first instanceof Number ? "numberlist" : "textlist");

      for (Object val : (Iterable<?>) value) {
        appendItemValueNode(list, val);
      }
    } else {
View Full Code Here

      appendItemValueNode(node, value);
    }
  }

  private void appendItemValueNode(final XMLNode node, final Object value) {
    XMLNode child;
    if (value instanceof Number) {
      child = node.addChildElement("number");
    } else {
      child = node.addChildElement("text");
    }
    child.setText(String.valueOf(value));
  }
View Full Code Here

    child.setText(String.valueOf(value));
  }

  protected List<Object> getItemValue(final String itemName) {
    List<Object> result = new ArrayList<Object>();
    XMLNode node = getDxl().selectSingleNode("//item[@name='" + XMLDocument.escapeXPathValue(itemName) + "']");
    if (node != null) {
      List<XMLNode> nodes = node.selectNodes(".//number | .//text");
      for (XMLNode child : nodes) {
        if (child.getNodeName().equals("number")) {
          result.add(Double.parseDouble(child.getText()));
        } else {
          result.add(child.getText());
View Full Code Here

TOP

Related Classes of org.openntf.domino.utils.xml.XMLNode

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.