public ElementCriteria element(String name) { List<Record> records = new ArrayList<Record>(); List<ElementRecord> elements = lookup(); for (ElementRecord elementRecord : elements) { records.addAll(elementRecord.getChildren()); } return new ElementCriteria(records, name); }
private ElementRecord lookupSingleElement() throws NotFoundException { List<ElementRecord> result = lookup(); if (0 == result.size()) { throw new NotFoundException("No element found for criteria " + toString()); } else if(result.size()>1){ throw new NotFoundException("More then one element found for criteria " + toString()); } return result.get(0); }
public String getName() throws NotFoundException { return lookupSingleElement().getName(); }
public boolean matches(){ return lookup().size()>0; }
public ElementCriteria element(String name) { return new ElementCriteria(content, name); }
public String getName() throws NotFoundException { return lookupSingleElement().getName(); }
private List<ElementRecord> lookup() { List<ElementRecord> result = new ArrayList<ElementRecord>(); for (Record record : base) { result.addAll(lookup(record, 0,0)); } return result; }
public ElementCriteria element(String name) { return new ElementCriteria(content, name); }
public ElementCriteria element(String name) { List<Record> records = new ArrayList<Record>(); List<ElementRecord> elements = lookup(); for (ElementRecord elementRecord : elements) { records.addAll(elementRecord.getChildren()); } return new ElementCriteria(records, name); }
private ElementRecord lookupSingleElement() throws NotFoundException { List<ElementRecord> result = lookup(); if (0 == result.size()) { throw new NotFoundException("No element found for criteria " + toString()); } else if(result.size()>1){ throw new NotFoundException("More then one element found for criteria " + toString()); } return result.get(0); }
public String getText() throws NotFoundException { return lookupSingleElement().getText(); }
public boolean matches(){ return lookup().size()>0; }
public String getText() throws NotFoundException { return lookupSingleElement().getText(); }
private List<ElementRecord> lookup() { List<ElementRecord> result = new ArrayList<ElementRecord>(); for (Record record : base) { result.addAll(lookup(record, 0,0)); } return result; }
public Object getAttribute(String name) throws NotFoundException { ElementRecord elementRecord = lookupSingleElement(); if (elementRecord.containsAttribute(name)) { return elementRecord.getAttribute(name).getValue(); } else { throw new NotFoundException("Element " + elementRecord.getName() + " has no attribute " + name); } }
public Object getAttribute(String name) throws NotFoundException { ElementRecord elementRecord = lookupSingleElement(); if (elementRecord.containsAttribute(name)) { return elementRecord.getAttribute(name).getValue(); } else { throw new NotFoundException("Element " + elementRecord.getName() + " has no attribute " + name); } }