Package nu.xom

Examples of nu.xom.Elements


    try {
      Util.requireDDMSValue("element", element);
      setXOMElement(element, false);

      _requesterInfos = new ArrayList<RequesterInfo>();
      Elements infos = element.getChildElements(RequesterInfo.getName(getDDMSVersion()), getNamespace());
      for (int i = 0; i < infos.size(); i++) {
        _requesterInfos.add(new RequesterInfo(infos.get(i)));
      }
      _addressees = new ArrayList<Addressee>();
      Elements addressees = element.getChildElements(Addressee.getName(getDDMSVersion()), getNamespace());
      for (int i = 0; i < addressees.size(); i++) {
        _addressees.add(new Addressee(addressees.get(i)));
      }
      Element description = element.getFirstChildElement(Description.getName(getDDMSVersion()), getNamespace());
      if (description != null)
        _description = new Description(description);
      Element taskID = element.getFirstChildElement(TaskID.getName(getDDMSVersion()), getNamespace());
View Full Code Here


      Util.requireDDMSValue("element", element);
      setXOMElement(element, false);
      Element innerElement = getInnerElement();
      if (innerElement != null) {
        _links = new ArrayList<Link>();
        Elements links = innerElement.getChildElements(Link.getName(getDDMSVersion()), getNamespace());
        for (int i = 0; i < links.size(); i++)
          _links.add(new Link(links.get(i)));
      }
      _securityAttributes = new SecurityAttributes(element);
      validate();
    }
    catch (InvalidDDMSException e) {
View Full Code Here

  /**
   * @see AbstractBaseComponent#validateWarnings()
   */
  protected void validateWarnings() {
    if (!getDDMSVersion().isAtLeast("4.0.1")) {
      Elements elements = getXOMElement().getChildElements(OLD_INNER_NAME, getNamespace());
      if (elements.size() > 1)
        addWarning("A ddms:RelatedResources element contains more than 1 ddms:relatedResource. "
          + "To ensure consistency between versions of DDMS, each ddms:RelatedResources element "
          + "should contain only 1 ddms:RelatedResource. DDMSence will only process the first child.");
    }
    super.validateWarnings();
View Full Code Here

   */
  public RevisionRecall(Element element) throws InvalidDDMSException {
    try {
      setXOMElement(element, false);
      _links = new ArrayList<Link>();
      Elements links = element.getChildElements(Link.getName(getDDMSVersion()), getNamespace());
      for (int i = 0; i < links.size(); i++) {
        _links.add(new Link(links.get(i)));
      }
      _details = new ArrayList<Details>();
      Elements details = element.getChildElements(Details.getName(getDDMSVersion()), getNamespace());
      for (int i = 0; i < details.size(); i++) {
        _details.add(new Details(details.get(i)));
      }
      String revisionID = element.getAttributeValue(REVISION_ID_NAME, getNamespace());
      if (!Util.isEmpty(revisionID)) {
        _revisionID = Integer.valueOf(revisionID);
      }
View Full Code Here

  public MetacardInfo(Element element) throws InvalidDDMSException {
    try {
      setXOMElement(element, false);
      DDMSVersion version = getDDMSVersion();
      _identifiers = new ArrayList<Identifier>();
      Elements components = element.getChildElements(Identifier.getName(version), getNamespace());
      for (int i = 0; i < components.size(); i++) {
        _identifiers.add(new Identifier(components.get(i)));
      }
      Element component = element.getFirstChildElement(Dates.getName(version), getNamespace());
      if (component != null)
        _dates = new Dates(component);
      components = element.getChildElements(Creator.getName(version), getNamespace());
      for (int i = 0; i < components.size(); i++)
        _creators.add(new Creator(components.get(i)));
      components = element.getChildElements(Publisher.getName(version), getNamespace());
      for (int i = 0; i < components.size(); i++)
        _publishers.add(new Publisher(components.get(i)));
      components = element.getChildElements(Contributor.getName(version), getNamespace());
      for (int i = 0; i < components.size(); i++)
        _contributors.add(new Contributor(components.get(i)));
      components = element.getChildElements(PointOfContact.getName(version), getNamespace());
      for (int i = 0; i < components.size(); i++)
        _pointOfContacts.add(new PointOfContact(components.get(i)));
      component = element.getFirstChildElement(Description.getName(version), getNamespace());
      if (component != null)
        _description = new Description(component);
      components = element.getChildElements(ProcessingInfo.getName(version), getNamespace());
      for (int i = 0; i < components.size(); i++)
        _processingInfos.add(new ProcessingInfo(components.get(i)));
      component = element.getFirstChildElement(RevisionRecall.getName(getDDMSVersion()), getNamespace());
      if (component != null)
        _revisionRecall = new RevisionRecall(component);
      component = element.getFirstChildElement(RecordsManagementInfo.getName(getDDMSVersion()), getNamespace());
      if (component != null)
View Full Code Here

      Element revisionRecall = element.getFirstChildElement(RevisionRecall.getName(getDDMSVersion()),
        getNamespace());
      if (revisionRecall != null)
        _revisionRecall = new RevisionRecall(revisionRecall);
      _taskingInfos = new ArrayList<TaskingInfo>();
      Elements taskingInfos = element.getChildElements(TaskingInfo.getName(getDDMSVersion()), getNamespace());
      for (int i = 0; i < taskingInfos.size(); i++) {
        _taskingInfos.add(new TaskingInfo(taskingInfos.get(i)));
      }
      _processingInfos = new ArrayList<ProcessingInfo>();
      Elements processingInfos = element.getChildElements(ProcessingInfo.getName(getDDMSVersion()),
        getNamespace());
      for (int i = 0; i < processingInfos.size(); i++) {
        _processingInfos.add(new ProcessingInfo(processingInfos.get(i)));
      }
      _securityAttributes = new SecurityAttributes(element);
      validate();
    }
    catch (InvalidDDMSException e) {
View Full Code Here

    union.addAll(s2);
    return intersection.size() * 1.0 / union.size();
  }
 
  public static Map<String,Collection<String>> getFeatures(Element elem) {
    Elements elems = elem.getChildElements();
   
    Map<String,Collection<String>> features = new HashMap<String,Collection<String>>();
   
    for(int i=0;i<elems.size();i++) {
      String name = elems.get(i).getAttributeValue("word");
      System.out.println(name);
      if(name.endsWith("ase") || name.endsWith("ases")) continue;
      //if(name.endsWith("in")) continue;
      Elements lineElems = elems.get(i).getChildElements();
      //List<String> wordsForWord = new ArrayList<String>();
      Set<String> wordsForWord = new HashSet<String>();
      for(int j=0;j<lineElems.size();j++) {
        String lineVal = lineElems.get(j).getValue();
        TokenSequence t = Tokeniser.getInstance().tokenise(lineVal);
        boolean found = false;
        List<String> tl = new ArrayList<String>();
        for(String s : t.getTokenStringList()) {
          if(s.compareToIgnoreCase(name) == 0) {
View Full Code Here

      totals.add(Integer.parseInt(p));
    }
   
    featuresByClass = new ArrayList<Bag<String>>();
    Element fbcElem = elem.getFirstChildElement("featuresByClass");
    Elements ee = fbcElem.getChildElements("features");
    for(i=0;i<ee.size();i++) {
      Bag<String> fb = new Bag<String>();
      featuresByClass.add(fb);
      String fStr = ee.get(i).getValue();
      for(String line : StringTools.arrayToList(fStr.split("\n"))) {
        if(line.matches("\\S+\t\\S+")) {
          String [] sa = line.split("\t");
          fb.add(sa[0].intern(), Integer.parseInt(sa[1]));
        }
View Full Code Here

    }
    return e;
  }
 
  private void load(Element rootElem) throws Exception {
    Elements ee = rootElem.getChildElements("classifier");
    classifiers = new HashMap<String,GISModel>();
    for(int i=0;i<ee.size();i++) {
      String type = ee.get(i).getAttributeValue("type");
      StringGISModelReader sgmr = new StringGISModelReader(ee.get(i).getValue());
      classifiers.put(type, sgmr.getModel());
    }
  }
View Full Code Here

    for(int i=0;i<a.size();i++) {
      Element e = (Element)a.get(i);
      typeNames.add(e.getAttributeValue("name"));
      List<String> stList = new ArrayList<String>();
      subTypes.put(e.getAttributeValue("name"), stList);
      Elements st = e.getChildElements("subtype");
      for(int j=0;j<st.size();j++) {
        stList.add(st.get(j).getAttributeValue("name"));
      }
    }
    priority = new HashMap<String,Integer>();
    priority.put(STOP, 11);
    priority.put(LOCANTPREFIX, 10);
View Full Code Here

TOP

Related Classes of nu.xom.Elements

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.