public Element toXMLMetadata(Element root, String name) { Element el = root.addElement(name); el.addAttribute("sectionId", this.getSectionId() + ""); el.addAttribute("sectionName", this.getSectionName()); el.addAttribute("shortName", this.getShortName()); el.addAttribute("aveLongTermSlipRate", this.getOrigAveSlipRate() + ""); el.addAttribute("slipRateStdDev", this.getOrigSlipRateStdDev() + ""); el.addAttribute("aveDip", this.getAveDip() + ""); el.addAttribute("aveRake", this.getAveRake() + ""); el.addAttribute("aveUpperDepth", this.getOrigAveUpperDepth() + ""); el.addAttribute("aveLowerDepth", this.getAveLowerDepth() + ""); el.addAttribute("aseismicSlipFactor", this.getAseismicSlipFactor() + ""); el.addAttribute("couplingCoeff", this.getCouplingCoeff() + ""); el.addAttribute("dipDirection", this.getDipDirection() + ""); String parentSectionName = this.getParentSectionName(); if (parentSectionName != null) el.addAttribute("parentSectionName", parentSectionName); el.addAttribute("parentSectionId", getParentSectionId() + ""); el.addAttribute("connector", isConnector() + ""); if (getZonePolygon() != null) zonePolygon.toXMLMetadata(el, "ZonePolygon"); if (getDateOfLastEvent() > Long.MIN_VALUE) el.addAttribute("dateOfLastEventMillis", getDateOfLastEvent() + ""); if (!Double.isNaN(getSlipInLastEvent())) el.addAttribute("slipInLastEvent", getSlipInLastEvent() + ""); FaultTrace trace = this.getFaultTrace(); Element traceEl = el.addElement("FaultTrace"); traceEl.addAttribute("name", trace.getName()); for (int j = 0; j < trace.getNumLocations(); j++) { Location loc = trace.get(j); traceEl = loc.toXMLMetadata(traceEl); } return root; }