/** * create new instance in context of parent, overridable by subclasses. * * @param parent * parent of element to be constructed (ignored by default) * @return CMLMetadataList */ public CMLElement makeElementInContext(Element parent) { return new CMLMetadataList(); }
/** * gets metadata elements with a given name. if name is null returns empty * list * * @param name * value of name attribute * @return filtered list */ @SuppressWarnings("unused") private List<CMLMetadata> getMetadataDescendantsByName(String name) { return getMetadataDescendantsByName(this.getMetadataDescendants(), name); }
/** * gets all nested metadata descendants of arbitrary CMLElement. * * recurses through all metadataList and metadata children, adding the * latter to the list. Order is not preserved. * * @return list of all descendants */ public List<CMLMetadata> getMetadataDescendants() { List<CMLMetadata> mList = new ArrayList<CMLMetadata>(); CMLElements<CMLMetadataList> metadataLists = this .getMetadataListElements(); for (CMLMetadataList ml : metadataLists) { mList.addAll(ml.getMetadataDescendants()); } CMLElements<CMLMetadata> metadatas = this.getMetadataElements(); for (CMLMetadata m : metadatas) { mList.add(m); } return mList; }
/** * gets all nested metadata descendants of arbitrary CMLElement. * * recurses through all metadataList and metadata children, adding the * latter to the list. Order is not preserved. * * @param parent * with metadata(List) children * @return list of all descendants */ public static List<CMLMetadata> getMetadataDescendants(CMLElement parent) { List<CMLMetadata> mList = new ArrayList<CMLMetadata>(); Elements metadataLists = parent .getChildCMLElements(CMLMetadataList.TAG); for (int i = 0; i < metadataLists.size(); i++) { CMLMetadataList metadataList = (CMLMetadataList) metadataLists .get(i); mList.addAll(metadataList.getMetadataDescendants()); } // generally metadata should be under metadataList parent Elements metadatas = parent.getChildCMLElements(CMLMetadata.TAG); for (int i = 0; i < metadatas.size(); i++) { mList.add((CMLMetadata) metadatas.get(i)); } return mList; }
/** * copy node . * * @return Node */ public Node copy() { return new CMLMetadataList(this); }
Element metadataList = new CMLMetadataList(); metadataList.addNamespaceDeclaration(QSAR_NAMESPACE, QSAR_URI); property.addAttribute(new Attribute("convention", QSAR_NAMESPACE + ":" + "DescriptorValue")); Element paramSettings = new CMLMetadataList(); paramSettings.addAttribute(new Attribute("title", QSAR_NAMESPACE + ":" + "descriptorParameters")); for (int i = 0; i < params.length; i++) {