Package fi.luomus.commons.xml.Document

Examples of fi.luomus.commons.xml.Document.Node.addAttribute()


  }

  public static Document createSimpleDarwinRecordSet() {
    Document doc = new Document("SimpleDarwinRecordSet");
    Node root = doc.getRootNode();
    root.addAttribute("xmlns", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/");
    root.addAttribute("xmlns:dc", "http://purl.org/dc/terms/");
    root.addAttribute("xmlns:dwc", "http://rs.tdwg.org/dwc/terms/");
    root.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    root.addAttribute("xsi:schemaLocation", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/ http://rs.tdwg.org/dwc/xsd/tdwg_dwc_simple.xsd");
    return doc;
View Full Code Here


  public static Document createSimpleDarwinRecordSet() {
    Document doc = new Document("SimpleDarwinRecordSet");
    Node root = doc.getRootNode();
    root.addAttribute("xmlns", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/");
    root.addAttribute("xmlns:dc", "http://purl.org/dc/terms/");
    root.addAttribute("xmlns:dwc", "http://rs.tdwg.org/dwc/terms/");
    root.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    root.addAttribute("xsi:schemaLocation", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/ http://rs.tdwg.org/dwc/xsd/tdwg_dwc_simple.xsd");
    return doc;
  }
View Full Code Here

  public static Document createSimpleDarwinRecordSet() {
    Document doc = new Document("SimpleDarwinRecordSet");
    Node root = doc.getRootNode();
    root.addAttribute("xmlns", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/");
    root.addAttribute("xmlns:dc", "http://purl.org/dc/terms/");
    root.addAttribute("xmlns:dwc", "http://rs.tdwg.org/dwc/terms/");
    root.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    root.addAttribute("xsi:schemaLocation", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/ http://rs.tdwg.org/dwc/xsd/tdwg_dwc_simple.xsd");
    return doc;
  }
View Full Code Here

    Document doc = new Document("SimpleDarwinRecordSet");
    Node root = doc.getRootNode();
    root.addAttribute("xmlns", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/");
    root.addAttribute("xmlns:dc", "http://purl.org/dc/terms/");
    root.addAttribute("xmlns:dwc", "http://rs.tdwg.org/dwc/terms/");
    root.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    root.addAttribute("xsi:schemaLocation", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/ http://rs.tdwg.org/dwc/xsd/tdwg_dwc_simple.xsd");
    return doc;
  }

  public static void addRecordToRecordSet(Node recordSet, SimpleDarwinRecord record) {
View Full Code Here

    Node root = doc.getRootNode();
    root.addAttribute("xmlns", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/");
    root.addAttribute("xmlns:dc", "http://purl.org/dc/terms/");
    root.addAttribute("xmlns:dwc", "http://rs.tdwg.org/dwc/terms/");
    root.addAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    root.addAttribute("xsi:schemaLocation", "http://rs.tdwg.org/dwc/xsd/simpledarwincore/ http://rs.tdwg.org/dwc/xsd/tdwg_dwc_simple.xsd");
    return doc;
  }

  public static void addRecordToRecordSet(Node recordSet, SimpleDarwinRecord record) {
    Node entry = recordSet.addChildNode("SimpleDarwinRecord");
View Full Code Here

    List<Double> counts = new LinkedList<Double>();
    int maxCount = 0;
    for (AggregateResponseEntry entry : results) {
      Node entryNode = new Node("entry");
      for (KeyValuePair aggregatedBy : entry.getAggregatedByValues()) {
        entryNode.addAttribute(aggregatedBy.getKey(), aggregatedBy.getValue());
      }
      entryNode.addChildNode(new Node("count").setContents(entry.getCount()));
      entryNode.addChildNode(new Node("individual-count-sum").setContents(entry.getIndividualCountSum()));
      entryNode.addChildNode(new Node("individual-count-max").setContents(entry.getIndividualCountMax()));
      entryNode.addChildNode(new Node("oldest-record").setContents(Utils.toIsoDateFormat(entry.getOldestRecord())));
View Full Code Here

  public static class UsingXMLWriterAndReader extends TestCase {
   
    public void test_() {
      Document document = new Document("root");
      Node root = document.getRootNode();
      root.addAttribute("attribute", "value with \"quotes\" & 'apostrophes' ");
      root.addAttribute("second", "other <value> ");
      String xml = new XMLWriter(document).generateXML();
      String expected = "" +
      "<?xml version='1.0' encoding='utf-8'?>\n" +
      "<root attribute=\"value with &quot;quotes&quot; &amp; &apos;apostrophes&apos;\" second=\"other &lt;value&gt;\" />";
View Full Code Here

   
    public void test_() {
      Document document = new Document("root");
      Node root = document.getRootNode();
      root.addAttribute("attribute", "value with \"quotes\" & 'apostrophes' ");
      root.addAttribute("second", "other <value> ");
      String xml = new XMLWriter(document).generateXML();
      String expected = "" +
      "<?xml version='1.0' encoding='utf-8'?>\n" +
      "<root attribute=\"value with &quot;quotes&quot; &amp; &apos;apostrophes&apos;\" second=\"other &lt;value&gt;\" />";
      assertEquals(expected.trim(), xml.trim());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.