protected ObjectTree emptyCopy() { return new ObjectTree(); } }
protected ObjectTree emptyCopy() { return new ObjectTree(name); } public boolean isXmlAttribute(String propName){
private Object fromXml(OMElement ele) { if (ele == null) { return null; } if (ele.getFirstElement() == null) { // simple value, return the text return ele.getText(); } else { ObjectTree tree = new ObjectTree(); populateTree(tree, ele); return tree; } }
private Object fromXml(OMElement ele) { if (ele == null) { return null; } if (ele.getFirstElement() == null) { // simple value, return the text return ele.getText(); } else { ObjectTree tree = new ObjectTree(ele.getLocalName()); populateTree(tree, ele); return tree; } }
@Override public void addValue(String key, Object value) { ObjectTree tree = new ObjectTree(key); tree.put(key, checkToCopy(value)); add(tree); }
public void addValue(String key, Object value) { ObjectTree tree = new ObjectTree(); tree.put(key, checkToCopy(value)); add(tree); }
@Override protected Object doInvoke(Context context) throws Exception { Object val = getValue(); if (val == null) { return null; } Map map = (Map) XmlUtils.fromXml(val.toString(), true); String rootName = map.keySet().iterator().next().toString(); Object obj = XmlUtils.extractSingleMapRoot(map); if(!ignoreRootTag){ ObjectTree tree=new ObjectTree(null); tree.addValue(rootName, obj); return tree; } if (obj instanceof Map) { ObjectTree tree = new ObjectTree(rootName); tree.addValues((Map) obj); return tree; } else if (obj instanceof Collection) { ObjectList list = new ObjectList(rootName, true); list.addAll((Collection) obj); return list; } else { return obj; } }
/** * Get a copy of the map keyed with tag names. * * @param mergeParents * true to merge with the map from parent context, false not to. * @param includesRoot * true to include the map from the root context, false not to. * If the current is already root context, set to false will * result in empty map being returned. * @return the map copy. */ public ObjectTree getNameMap(boolean mergeParents, boolean includesRoot) { ObjectTree tree = new ObjectTree(null); if (includesRoot || !isRoot()) { for (Map.Entry<String, Object> entry : idConstsMap.entrySet()) { Object value = entry.getValue(); String id = entry.getKey(); String tagName = idToTagName.get(id); if (tagName != null) { tree.addValue(tagName, value); } } } if (mergeParents && parent != null) { tree.addValues(parent.getNameMap(mergeParents, includesRoot)); } return tree; }
/** * Get a copy of the map keyed with tag names. * * @param mergeParents * true to merge with the map from parent context, false not to. * @param includesRoot * true to include the map from the root context, false not to. * If the current is already root context, set to false will * result in empty map being returned. * @return the map copy. */ public ObjectTree getNameMap(boolean mergeParents, boolean includesRoot) { ObjectTree tree = new ObjectTree(); if (includesRoot || !isRoot()) { for (Map.Entry<String, Object> entry : idConstsMap.entrySet()) { Object value = entry.getValue(); String id = entry.getKey(); String tagName = idToTagName.get(id); if (tagName != null) { tree.addValue(tagName, value); } } } if (mergeParents && parent != null) { tree.addValues(parent.getNameMap(mergeParents, includesRoot)); } return tree; }
private void populateTree(ObjectTree tree, OMElement ele) { if (ele.getFirstElement() == null) { tree.addValue(ele.getLocalName(), ele.getText()); } else { ObjectTree subTree = new ObjectTree(); tree.addValue(ele.getLocalName(), subTree); for (OMElement child : new Elements(ele)) { populateTree(subTree, child); } } }
private void populateTree(ObjectTree tree, OMElement ele) { if (ele.getFirstElement() == null) { tree.addValue(ele.getLocalName(), ele.getText()); } else { ObjectTree subTree = new ObjectTree(ele.getLocalName()); tree.addValue(ele.getLocalName(), subTree); for (OMElement child : new Elements(ele)) { populateTree(subTree, child); } } }
vars.declareVariable(XPATH_NAME_LOCAL_VAR, nameLocal); ObjectTree nameAuto = new ObjectTree(null, nameGlobal); nameAuto.addValues(nameLocal);
vars.declareVariable(XPATH_NAME_LOCAL_VAR, nameLocal); ObjectTree nameAuto = new ObjectTree(nameGlobal); nameAuto.addValues(nameLocal);
ObjectTree tree = new ObjectTree(valueName); tree.addXmlAttributes(attributes); for (Object childResult : childrenResults) { ObjectTree tree = new ObjectTree(valueName); tree.addXmlAttributes(attributes); for (Object childResult : childrenResults) {
ObjectTree tree = new ObjectTree(); for (Object childResult : childrenResults) { ConstNode node = (ConstNode) childResult;