Exemple #1
0
 private void addCountsToResult(TestSummary testSummary, Element resultElement) {
   Element counts = testResultsDocument.createElement("counts");
   resultElement.appendChild(counts);
   XmlUtil.addTextNode(testResultsDocument, counts, "right", Integer.toString(testSummary.right));
   XmlUtil.addTextNode(testResultsDocument, counts, "wrong", Integer.toString(testSummary.wrong));
   XmlUtil.addTextNode(
       testResultsDocument, counts, "ignores", Integer.toString(testSummary.ignores));
   XmlUtil.addTextNode(
       testResultsDocument, counts, "exceptions", Integer.toString(testSummary.exceptions));
 }
Exemple #2
0
 protected void startHtml() throws Exception {
   if (response.isXmlFormat()) {
     testResultsDocument = XmlUtil.newDocument();
     testResultsElement = testResultsDocument.createElement("testResults");
     testResultsDocument.appendChild(testResultsElement);
     XmlUtil.addTextNode(testResultsDocument, testResultsElement, "rootPath", page.getName());
   } else {
     buildHtml();
     addToResponse(formatter.head());
   }
 }
Exemple #3
0
  protected void addTestResultsToXmlDocument(TestSummary testSummary, String pageName)
      throws Exception {
    Element resultElement = testResultsDocument.createElement("result");
    testResultsElement.appendChild(resultElement);
    addCountsToResult(testSummary, resultElement);

    XmlUtil.addCdataNode(testResultsDocument, resultElement, "content", outputBuffer.toString());
    outputBuffer = null;

    XmlUtil.addTextNode(testResultsDocument, resultElement, "relativePageName", pageName);
  }
Exemple #4
0
    private Document buildDocumentWithRssHeader() throws Exception {
      Document rssDocument = XmlUtil.newDocument();
      Element rssDocumentElement = rssDocument.createElement("rss");
      rssDocument.appendChild(rssDocumentElement);
      channelElement = rssDocument.createElement("channel");
      rssDocumentElement.setAttribute("version", "2.0");
      rssDocumentElement.appendChild(channelElement);
      XmlUtil.addTextNode(channelElement, "title", "FitNesse:");

      return rssDocument;
    }
Exemple #5
0
 private Document buildRssHeader() {
   Document rssDocument = XmlUtil.newDocument();
   Element rssDocumentElement = rssDocument.createElement("rss");
   rssDocument.appendChild(rssDocumentElement);
   channelElement = rssDocument.createElement("channel");
   rssDocumentElement.setAttribute("version", "2.0");
   rssDocumentElement.appendChild(channelElement);
   return rssDocument;
 }
 public void loadFromXml(String xml) {
   Document document;
   try {
     document = XmlUtil.newDocument(xml);
   } catch (Exception e) {
     throw new WikiPageLoadException("Unable to parse XML from string " + xml, e);
   }
   Element root = document.getDocumentElement();
   loadFromRootElement(root);
 }
 public void loadFromXmlStream(InputStream inputStream) {
   Document document;
   try {
     document = XmlUtil.newDocument(inputStream);
   } catch (Exception e) {
     throw new WikiPageLoadException("Unable to parse XML from stream", e);
   }
   Element root = document.getDocumentElement();
   loadFromRootElement(root);
 }
Exemple #8
0
    public void addItem(RecentChangesPageEntry line) throws Exception {
      Map<String, String> itemProperties = line.getItemProperties();
      Element itemElement = document.createElement("item");
      makeNodes(itemElement, itemProperties);
      linkPrefixBuilder.buildLink(itemElement, itemProperties.get("path"));

      String description = makeDescription(itemProperties);
      XmlUtil.addTextNode(itemElement, "description", description);
      channelElement.appendChild(itemElement);
    }
 public String toXml() throws IOException {
   Document document = XmlUtil.newDocument();
   document.appendChild(makeRootElement(document));
   return XmlUtil.xmlAsString(document);
 }
Exemple #10
0
    public void buildLink(Element itemElement, String pageName) throws Exception {
      String prefix = getRssLinkPrefix();
      String link = prefix + pageName;

      XmlUtil.addTextNode(itemElement, "link", link);
    }
Exemple #11
0
 private static void makeNodes(Element itemElement, Map<String, String> itemProperties) {
   XmlUtil.addTextNode(itemElement, "title", itemProperties.get("path"));
   XmlUtil.addTextNode(itemElement, "author", itemProperties.get("author"));
   XmlUtil.addTextNode(itemElement, "pubDate", itemProperties.get("pubDate"));
 }