Exemple #1
0
 /**
  * Creates a DOM representation of the object. Result is appended to the Node <code>parent</code>.
  *
  * @param parent
  */
 public void makeElement(Node parent) {
   Document doc;
   if (parent instanceof Document) {
     doc = (Document) parent;
   } else {
     doc = parent.getOwnerDocument();
   }
   Element element = doc.createElement("fixme");
   int size;
   if (this.author_ != null) {
     URelaxer.setAttributePropertyByString(element, "author", this.author_);
   }
   if (this.id_ != null) {
     URelaxer.setAttributePropertyByString(element, "id", this.id_);
   }
   if (this.xmlLang_ != null) {
     URelaxer.setAttributePropertyByString(element, "xml:lang", this.xmlLang_);
   }
   size = this.content_.size();
   for (int i = 0; i < size; i++) {
     IFdContentMixMixed value = (IFdContentMixMixed) this.content_.get(i);
     value.makeElement(element);
   }
   parent.appendChild(element);
 }
Exemple #2
0
 /**
  * Creates a DOM representation of the object. Result is appended to the Node <code>parent</code>.
  *
  * @param parent
  */
 public void makeElement(Node parent) {
   Document doc;
   if (parent instanceof Document) {
     doc = (Document) parent;
   } else {
     doc = parent.getOwnerDocument();
   }
   Element element = doc.createElement("table");
   int size;
   if (this.id_ != null) {
     URelaxer.setAttributePropertyByString(element, "id", this.id_);
   }
   if (this.xmlLang_ != null) {
     URelaxer.setAttributePropertyByString(element, "xml:lang", this.xmlLang_);
   }
   if (this.caption_ != null) {
     this.caption_.makeElement(element);
   }
   size = this.tr_.size();
   for (int i = 0; i < size; i++) {
     FcTr value = (FcTr) this.tr_.get(i);
     value.makeElement(element);
   }
   parent.appendChild(element);
 }
Exemple #3
0
 /** Internal handler to add the node structure. */
 protected XML appendChild(Node newNode) {
   node.appendChild(newNode);
   XML newbie = new XML(this, newNode);
   if (children != null) {
     children = (XML[]) PApplet.concat(children, new XML[] {newbie});
   }
   return newbie;
 }
 /**
  * Creates a DOM representation of the object. Result is appended to the Node <code>parent</code>.
  *
  * @param parent
  */
 public void makeElement(Node parent) {
   Document doc;
   if (parent instanceof Document) {
     doc = (Document) parent;
   } else {
     doc = parent.getOwnerDocument();
   }
   Element element =
       doc.createElementNS(
           "http://www.iso_relax.org/xmlns/miaou/binaryTreeAutomaton", "textTransition");
   rNSContext_.setupNamespace(element);
   int size;
   URelaxer.setAttributePropertyByInt(element, "target", this.target_);
   URelaxer.setAttributePropertyByInt(element, "right", this.right_);
   parent.appendChild(element);
 }
  /**
   * Creates a DOM representation of the object. Result is appended to the Node <code>parent</code>.
   *
   * @param parent
   */
  public void makeElement(Node parent) {
    Document doc;

    if (parent instanceof Document) {
      doc = (Document) parent;
    } else {
      doc = parent.getOwnerDocument();
    }

    Element element =
        doc.createElementNS("http://www.asahi-net.or.jp/~cs8k-cyu/bulletml", "direction");
    rNSContext_.setupNamespace(element);
    URelaxer.setElementPropertyByString(element, this.content_);

    int size;

    if (this.type_ != null) {
      URelaxer.setAttributePropertyByString(element, "type", this.type_);
    }

    parent.appendChild(element);
  }
Exemple #6
0
 /**
  * Creates a DOM representation of the object. Result is appended to the Node <code>parent</code>.
  *
  * @param parent
  */
 public void makeElement(Node parent) {
   Document doc;
   if (parent instanceof Document) {
     doc = (Document) parent;
   } else {
     doc = parent.getOwnerDocument();
   }
   Element element = doc.createElement("header");
   int size;
   if (this.id_ != null) {
     URelaxer.setAttributePropertyByString(element, "id", this.id_);
   }
   if (this.xmlLang_ != null) {
     URelaxer.setAttributePropertyByString(element, "xml:lang", this.xmlLang_);
   }
   this.title_.makeElement(element);
   if (this.subtitle_ != null) {
     this.subtitle_.makeElement(element);
   }
   if (this.version_ != null) {
     this.version_.makeElement(element);
   }
   if (this.type_ != null) {
     this.type_.makeElement(element);
   }
   if (this.authors_ != null) {
     this.authors_.makeElement(element);
   }
   size = this.notice_.size();
   for (int i = 0; i < size; i++) {
     FtNotice value = (FtNotice) this.notice_.get(i);
     value.makeElement(element);
   }
   if (this.abstract_ != null) {
     this.abstract_.makeElement(element);
   }
   parent.appendChild(element);
 }
  /**
   * @param list
   * @param document
   * @param parent
   */
  void addAttributesFromListToNode(AttributeList list, Document document, Node parent) {
    DicomDictionary dictionary = list.getDictionary();
    Iterator i = list.values().iterator();
    while (i.hasNext()) {
      Attribute attribute = (Attribute) i.next();
      AttributeTag tag = attribute.getTag();

      String elementName = dictionary.getNameFromTag(tag);
      if (elementName == null) {
        elementName = makeElementNameFromHexadecimalGroupElementValues(tag);
      }
      Node node = document.createElement(elementName);
      parent.appendChild(node);

      {
        Attr attr = document.createAttribute("group");
        attr.setValue(HexDump.shortToPaddedHexString(tag.getGroup()));
        node.getAttributes().setNamedItem(attr);
      }
      {
        Attr attr = document.createAttribute("element");
        attr.setValue(HexDump.shortToPaddedHexString(tag.getElement()));
        node.getAttributes().setNamedItem(attr);
      }
      {
        Attr attr = document.createAttribute("vr");
        attr.setValue(ValueRepresentation.getAsString(attribute.getVR()));
        node.getAttributes().setNamedItem(attr);
      }

      if (attribute instanceof SequenceAttribute) {
        int count = 0;
        Iterator si = ((SequenceAttribute) attribute).iterator();
        while (si.hasNext()) {
          SequenceItem item = (SequenceItem) si.next();
          Node itemNode = document.createElement("Item");
          Attr numberAttr = document.createAttribute("number");
          numberAttr.setValue(Integer.toString(++count));
          itemNode.getAttributes().setNamedItem(numberAttr);
          node.appendChild(itemNode);
          addAttributesFromListToNode(item.getAttributeList(), document, itemNode);
        }
      } else {
        // Attr attr = document.createAttribute("value");
        // attr.setValue(attribute.getDelimitedStringValuesOrEmptyString());
        // node.getAttributes().setNamedItem(attr);

        // node.appendChild(document.createTextNode(attribute.getDelimitedStringValuesOrEmptyString()));

        String values[] = null;
        try {
          values = attribute.getStringValues();
        } catch (DicomException e) {
          // e.printStackTrace(System.err);
        }
        if (values != null) {
          for (int j = 0; j < values.length; ++j) {
            Node valueNode = document.createElement("value");
            Attr numberAttr = document.createAttribute("number");
            numberAttr.setValue(Integer.toString(j + 1));
            valueNode.getAttributes().setNamedItem(numberAttr);
            valueNode.appendChild(document.createTextNode(values[j]));
            node.appendChild(valueNode);
          }
        }
      }
    }
  }
Exemple #8
0
 private void appendNodes(Document doc, Node target, NodeList nodes) {
   for (int i = 0; i < nodes.getLength(); i++) {
     Node node = nodes.item(i);
     target.appendChild(doc.importNode(node, true));
   }
 }
  public boolean runTest(Test test) throws Exception {
    String filename = test.file.toString();
    if (this.verbose) {
      System.out.println(
          "Running "
              + filename
              + " against "
              + this.host
              + ":"
              + this.port
              + " with "
              + this.browser);
    }
    this.document = parseDocument(filename);

    if (this.baseUrl == null) {
      NodeList links = this.document.getElementsByTagName("link");
      if (links.getLength() != 0) {
        Element link = (Element) links.item(0);
        setBaseUrl(link.getAttribute("href"));
      }
    }
    if (this.verbose) {
      System.out.println("Base URL=" + this.baseUrl);
    }

    Node body = this.document.getElementsByTagName("body").item(0);
    Element resultContainer = document.createElement("div");
    resultContainer.setTextContent("Result: ");
    Element resultElt = document.createElement("span");
    resultElt.setAttribute("id", "result");
    resultElt.setIdAttribute("id", true);
    resultContainer.appendChild(resultElt);
    body.insertBefore(resultContainer, body.getFirstChild());

    Element executionLogContainer = document.createElement("div");
    executionLogContainer.setTextContent("Execution Log:");
    Element executionLog = document.createElement("div");
    executionLog.setAttribute("id", "log");
    executionLog.setIdAttribute("id", true);
    executionLog.setAttribute("style", "white-space: pre;");
    executionLogContainer.appendChild(executionLog);
    body.appendChild(executionLogContainer);

    NodeList tableRows = document.getElementsByTagName("tr");
    Element theadRow = (Element) tableRows.item(0);
    test.name = theadRow.getTextContent();
    appendCellToRow(theadRow, "Result");

    this.commandProcessor =
        new HtmlCommandProcessor(this.host, this.port, this.browser, this.baseUrl);
    String resultState;
    String resultLog;
    test.result = true;
    try {
      this.commandProcessor.start();
      test.commands = new Command[tableRows.getLength() - 1];
      for (int i = 1; i < tableRows.getLength(); i++) {
        Element stepRow = (Element) tableRows.item(i);
        Command command = executeStep(stepRow);
        appendCellToRow(stepRow, command.result);
        test.commands[i - 1] = command;
        if (command.error) {
          test.result = false;
        }
        if (command.failure) {
          test.result = false;
          // break;
        }
      }
      resultState = test.result ? "PASSED" : "FAILED";
      resultLog = (test.result ? "Test Complete" : "Error");
      this.commandProcessor.stop();
    } catch (Exception e) {
      test.result = false;
      resultState = "ERROR";
      resultLog = "Failed to initialize session\n" + e;
      e.printStackTrace();
    }
    document.getElementById("result").setTextContent(resultState);
    Element log = document.getElementById("log");
    log.setTextContent(log.getTextContent() + resultLog + "\n");
    return test.result;
  }