List of usage examples for org.dom4j Node selectNodes
List<Node> selectNodes(String xpathExpression);
selectNodes
evaluates an XPath expression and returns the result as a List
of Node
instances or String
instances depending on the XPath expression.
From source file:it.eng.spagobi.jpivotaddins.crossnavigation.SpagoBICrossNavigationConfig.java
License:Mozilla Public License
private void init(Node node) { targets = new ArrayList<Target>(); List targetNodes = node.selectNodes("TARGET"); if (targetNodes != null && !targetNodes.isEmpty()) { for (int i = 0; i < targetNodes.size(); i++) { Target target = new Target((Node) targetNodes.get(i)); if (target != null) { targets.add(target);/*from ww w . j a v a2 s. c o m*/ } } } }
From source file:it.eng.spagobi.studio.chart.editors.model.chart.ChartModel.java
License:Mozilla Public License
public void fillStyleParameters() throws Exception { logger.debug("Filling style configurations from actual file, otherwise from template"); String upperCaseNameSl = type.toUpperCase(); String upperCaseNamePl = upperCaseNameSl + "S"; logger.debug("Read all styles parameters from config file and record"); Node commonConfig = configDocument .selectSingleNode("//" + upperCaseNamePl + "/" + upperCaseNameSl + "[@name='commons']"); if (commonConfig == null) throw new Exception("No common configuration set"); List allStyles = commonConfig.selectNodes("//STYLES/STYLE"); // Iterate over the styles filling StyleParametersEditors for (Iterator iterator = allStyles.iterator(); iterator.hasNext();) { Element styleEl = (Element) iterator.next(); Style toInsert = new Style(); String nameStyle = styleEl.valueOf("@name"); toInsert.setName(nameStyle);/*from w w w .ja v a 2 s .c o m*/ String descriptionStyle = styleEl.valueOf("@description"); if (descriptionStyle == null || descriptionStyle.equalsIgnoreCase("")) { descriptionStyle = nameStyle; } toInsert.setDescription(descriptionStyle); String tooltipStyle = styleEl.valueOf("@tooltip"); toInsert.setTooltip(tooltipStyle); toInsert.setHasFont(true); toInsert.setHasSize(true); toInsert.setHasColor(true); toInsert.setHasOrientation(true); // first I must check wich of these parameters are configurable Node fontNode1 = commonConfig .selectSingleNode("//STYLES/STYLE[@name='" + nameStyle + "']/STYLE_INFO[@name='font']"); if (fontNode1 == null) { toInsert.setHasFont(false); } Node colorNode1 = commonConfig .selectSingleNode("//STYLES/STYLE[@name='" + nameStyle + "']/STYLE_INFO[@name='color']"); if (colorNode1 == null) { toInsert.setHasFont(false); } Node orientationNode1 = commonConfig .selectSingleNode("//STYLES/STYLE[@name='" + nameStyle + "']/STYLE_INFO[@name='orientation']"); if (orientationNode1 == null) { toInsert.setHasOrientation(false); } Node sizeNode1 = commonConfig .selectSingleNode("//STYLES/STYLE[@name='" + nameStyle + "']/STYLE_INFO[@name='size']"); if (sizeNode1 == null) { toInsert.setHasSize(false); } // Fill the style values!! boolean useThisDocument = false; Node thisStyleNode = thisDocument .selectSingleNode("//" + type.toUpperCase() + "/" + nameStyle.toUpperCase()); if (thisStyleNode != null) useThisDocument = true; if (toInsert.isHasFont()) { String fontVal = null; if (useThisDocument == true) { fontVal = thisStyleNode.valueOf("@font"); } else { Node fontNode = commonConfig .selectSingleNode("//STYLES/STYLE[@name='" + nameStyle + "']/STYLE_INFO[@name='font']"); if (fontNode != null) { fontVal = fontNode.valueOf("@defaultValue"); } } if (fontVal != null) toInsert.setFont(fontVal); } if (toInsert.isHasOrientation()) { String orientationVal = null; if (useThisDocument == true) { orientationVal = thisStyleNode.valueOf("@orientation"); } else { Node orientationNode = commonConfig.selectSingleNode( "//STYLES/STYLE[@name='" + nameStyle + "']/STYLE_INFO[@name='orientation']"); if (orientationNode != null) { orientationVal = orientationNode.valueOf("@defaultValue"); } } if (orientationVal != null) toInsert.setOrientation(orientationVal); } if (toInsert.isHasColor()) { String colorVal = null; if (useThisDocument == true) { colorVal = thisStyleNode.valueOf("@color"); } else { Node colorNode = commonConfig.selectSingleNode( "//STYLES/STYLE[@name='" + nameStyle + "']/STYLE_INFO[@name='color']"); if (colorNode != null) { colorVal = colorNode.valueOf("@defaultValue"); } } if (colorVal != null) toInsert.setColor(ChartEditor.convertHexadecimalToRGB(colorVal)); } if (toInsert.isHasSize()) { String sizeVal = null; if (useThisDocument == true) { sizeVal = thisStyleNode.valueOf("@size"); } else { Node sizeNode = commonConfig .selectSingleNode("//STYLES/STYLE[@name='" + nameStyle + "']/STYLE_INFO[@name='size']"); if (sizeNode != null) { sizeVal = sizeNode.valueOf("@defaultValue"); } } if (sizeVal != null) { Integer intt = null; try { intt = Integer.valueOf(sizeVal); } catch (Exception e) { intt = 10; } toInsert.setSize(intt); } } styleParametersEditors.put(toInsert.getName(), toInsert); } }
From source file:it.eng.spagobi.studio.chart.editors.model.chart.ChartModel.java
License:Mozilla Public License
/** Record commons configuration parameters, then fills model with values in actuale or in template file * /*from w ww .j a va 2 s . c om*/ * @throws Exception */ public void fillCommonsConfParameters() throws Exception { logger.debug("Start recording commons configuration parameters"); // search for the root String upperCaseNameSl = type.toUpperCase(); String upperCaseNamePl = upperCaseNameSl + "S"; Node commonConfig = configDocument .selectSingleNode("//" + upperCaseNamePl + "/" + upperCaseNameSl + "[@name='commons']"); if (commonConfig == null) throw new Exception("No common configuration set"); List allSections = commonConfig .selectNodes("//" + upperCaseNamePl + "/" + upperCaseNameSl + "[@name='commons']/CONF/SECTION"); // Iterate over the section for (Iterator iterator = allSections.iterator(); iterator.hasNext();) { Element section = (Element) iterator.next(); String nameSection = section.valueOf("@name"); // iterate over the parameters for the current section List configuredParameters = section.selectNodes("//" + upperCaseNamePl + "/" + upperCaseNameSl + "[@name='commons']/CONF/SECTION[@name='" + nameSection + "']/PARAMETER"); for (int j = 0; j < configuredParameters.size(); j++) { Node aConfiguredParameter = (Node) configuredParameters.get(j); String namePar = aConfiguredParameter.valueOf("@name"); String description = aConfiguredParameter.valueOf("@description"); String typeStr = aConfiguredParameter.valueOf("@type"); String toolTipStr = aConfiguredParameter.valueOf("@tooltip"); ArrayList<String> predefinedValues = null; int type; if (typeStr.equals("INTEGER")) type = Parameter.INTEGER_TYPE; else if (typeStr.equals("FLOAT")) type = Parameter.FLOAT_TYPE; else if (typeStr.equals("STRING")) type = Parameter.STRING_TYPE; else if (typeStr.equals("COLOR")) type = Parameter.COLOR_TYPE; else if (typeStr.equals("BOOLEAN")) type = Parameter.BOOLEAN_TYPE; else if (typeStr.equals("COMBO")) { type = Parameter.COMBO_TYPE; predefinedValues = new ArrayList<String>(); String valueString = aConfiguredParameter.valueOf("@values"); StringTokenizer st = new StringTokenizer(valueString, ","); while (st.hasMoreTokens()) { String val = st.nextToken(); predefinedValues.add(val); } } else throw new Exception("Parameter type for parameter " + namePar + " not supported"); Parameter par = new Parameter(namePar, "", description, type); par.setTooltip(toolTipStr); if (predefinedValues != null) { par.setPredefinedValues(predefinedValues); } // Add parameter in confParameterEditor if (!confParametersEditor.containsKey(par)) { confParametersEditor.put(par.getName(), par); // add in section information, a map that gets name section and list of parameters in her. if (confSectionParametersEditor.get(nameSection) == null) { confSectionParametersEditor.put(nameSection, new ArrayList<String>()); } ArrayList<String> list = confSectionParametersEditor.get(nameSection); list.add(par.getName()); } // Get the value, search first in thisDocument, otherwise in configDocument as defaultValue Node parameterNode = thisDocument.selectSingleNode( "//" + this.type.toUpperCase() + "/CONF/PARAMETER[@name='" + par.getName() + "'"); String val = null; if (parameterNode != null && parameterNode.valueOf("@value") != null) { val = parameterNode.valueOf("@value"); } else // search in config { parameterNode = configDocument .selectSingleNode("//" + this.type.toUpperCase() + "S/" + this.type.toUpperCase() + "[@name='commons']/CONF/SECTION/PARAMETER[@name='" + par.getName() + "']"); if (parameterNode != null && parameterNode.valueOf("@defaultValue") != null) { val = parameterNode.valueOf("@defaultValue"); } } if (type == Parameter.INTEGER_TYPE) { // if it is not a number (maybe empty) don't fill anything try { Integer d = Integer.valueOf(val); par.setValue(d); } catch (Exception e) { logger.warn("Not a number"); } } else if (type == Parameter.FLOAT_TYPE) { // if it is not a number (maybe empty) don't fill anything try { Double d = Double.valueOf(val); par.setValue(d); } catch (Exception e) { logger.warn("Not a number"); } } else if (type == Parameter.STRING_TYPE || type == Parameter.COMBO_TYPE) { par.setValue(val); } else if (type == Parameter.COLOR_TYPE) { try { RGB d = ChartEditor.convertHexadecimalToRGB(val); par.setValue(d); } catch (Exception e) { logger.warn("Not a Hexadecimal color rapresentation"); } } else if (type == Parameter.BOOLEAN_TYPE) { try { Boolean d = Boolean.valueOf(val); par.setValue(d); } catch (Exception e) { logger.warn("Not a bool, set default false"); par.setValue(new Boolean("false")); } } } } return; }
From source file:it.eng.spagobi.studio.chart.editors.model.chart.ChartModel.java
License:Mozilla Public License
/** Fill the specific conf parameters founf in the actual document, otherwise in the template docuement * //from www .ja v a2 s . co m * @throws Exception */ public void fillSpecificConfParameters() throws Exception { logger.debug("Record and fill specific conf parameters"); // search for the root String upperCaseNameSl = getType().toUpperCase(); String upperCaseNamePl = upperCaseNameSl + "S"; Node specificConfig = configDocument .selectSingleNode("//" + upperCaseNamePl + "/" + upperCaseNameSl + "[@name='" + subType + "']"); if (specificConfig == null) throw new Exception("No specific configuration set"); List allSections = specificConfig .selectNodes("//" + type.toUpperCase() + "[@name='" + subType + "']/CONF/SECTION"); // Iterate over the section for (Iterator iterator = allSections.iterator(); iterator.hasNext();) { Element section = (Element) iterator.next(); String nameSection = section.valueOf("@name"); // iterate over the parameters for the current section List configuredParameters = section .selectNodes("//" + type.toString() + "[@name='" + subType + "']/CONF/SECTION/PARAMETER"); for (int j = 0; j < configuredParameters.size(); j++) { Node aConfiguredParameter = (Node) configuredParameters.get(j); // System.out.println(aConfiguredParameter.asXML()); String namePar = aConfiguredParameter.valueOf("@name"); String description = aConfiguredParameter.valueOf("@description"); String typeStr = aConfiguredParameter.valueOf("@type"); String tooltipStr = aConfiguredParameter.valueOf("@tooltip"); ArrayList<String> predefinedValues = null; int type; if (typeStr.equals("INTEGER")) type = Parameter.INTEGER_TYPE; else if (typeStr.equals("FLOAT")) type = Parameter.FLOAT_TYPE; else if (typeStr.equals("STRING")) type = Parameter.STRING_TYPE; else if (typeStr.equals("COLOR")) type = Parameter.COLOR_TYPE; else if (typeStr.equals("BOOLEAN")) type = Parameter.BOOLEAN_TYPE; else if (typeStr.equals("COMBO")) { type = Parameter.COMBO_TYPE; predefinedValues = new ArrayList<String>(); String valueString = aConfiguredParameter.valueOf("@values"); StringTokenizer st = new StringTokenizer(valueString, ","); while (st.hasMoreTokens()) { String val = st.nextToken(); predefinedValues.add(val); } } else throw new Exception("Parameter type for parameter " + namePar + " not supported"); Parameter par = new Parameter(namePar, "", description, type); par.setTooltip(tooltipStr); if (predefinedValues != null) { par.setPredefinedValues(predefinedValues); } if (!confSpecificParametersEditor.containsKey(par)) { confSpecificParametersEditor.put(par.getName(), par); // add in section information if (confSpecificSectionParametersEditor.get(nameSection) == null) { confSpecificSectionParametersEditor.put(nameSection, new ArrayList<String>()); } ArrayList<String> list = confSpecificSectionParametersEditor.get(nameSection); list.add(par.getName()); } // Get the value, search first in thisDocument, otherwise in configDocument as defaultValue Node parameterNode = thisDocument.selectSingleNode( "//" + this.type.toUpperCase() + "/CONF/PARAMETER[@name='" + par.getName() + "'"); String val = null; if (parameterNode != null && parameterNode.valueOf("@value") != null) { val = parameterNode.valueOf("@value"); } else // search in config { //parameterNode=thisDocument.selectSingleNode("//"+this.type.toUpperCase()+"/CONF/PARAMETER[@name='"+par.getName()+"'"); parameterNode = configDocument.selectSingleNode( "//" + this.type.toUpperCase() + "S/" + this.type.toUpperCase() + "[@name='" + this.subType + "']/CONF/SECTION/PARAMETER[@name='" + par.getName() + "']"); if (parameterNode != null && parameterNode.valueOf("@defaultValue") != null) { val = parameterNode.valueOf("@defaultValue"); } } if (type == Parameter.INTEGER_TYPE) { // if it is not a number (maybe empty) don't fill anything try { Integer d = Integer.valueOf(val); par.setValue(d); } catch (Exception e) { logger.warn("Not a number"); } } else if (type == Parameter.FLOAT_TYPE) { // if it is not a number (maybe empty) don't fill anything try { Double d = Double.valueOf(val); par.setValue(d); } catch (Exception e) { logger.warn("Not a number"); } } else if (type == Parameter.STRING_TYPE || type == Parameter.COMBO_TYPE) { par.setValue(val); } else if (type == Parameter.COLOR_TYPE) { try { RGB d = ChartEditor.convertHexadecimalToRGB(val); par.setValue(d); } catch (Exception e) { logger.warn("Not a Hexadecimal color rapresentation"); } } else if (type == Parameter.BOOLEAN_TYPE) { try { Boolean d = Boolean.valueOf(val); par.setValue(d); } catch (Exception e) { logger.warn("Not a bool, set default false"); par.setValue(new Boolean("false")); } } } } return; }
From source file:it.eng.spagobi.studio.dashboard.editors.model.dashboard.Configuration.java
License:Mozilla Public License
public Parameter[] getConfigurationParametersForMovie(String dashboardMovie, Document document) throws Exception { Parameter[] toReturn = null;// w ww. ja v a2 s. c o m List dashboards = document.selectNodes("//DASHBOARDS/DASHBOARD"); if (dashboards == null || dashboards.size() == 0) throw new Exception("No dashboards configured"); for (int i = 0; i < dashboards.size(); i++) { Node dashboard = (Node) dashboards.get(i); String movie = dashboard.valueOf("@movie"); if (dashboardMovie.equals(movie)) { List configuredParameters = dashboard.selectNodes("CONF/PARAMETER"); toReturn = new Parameter[configuredParameters.size()]; for (int j = 0; j < configuredParameters.size(); j++) { Node aConfiguredParameter = (Node) configuredParameters.get(j); String name = aConfiguredParameter.valueOf("@name"); String description = aConfiguredParameter.valueOf("@description"); String typeStr = aConfiguredParameter.valueOf("@type"); int type; if (typeStr.equals("NUMBER")) type = Parameter.NUMBER_TYPE; else if (typeStr.equals("STRING")) type = Parameter.STRING_TYPE; else if (typeStr.equals("COLOR")) type = Parameter.COLOR_TYPE; else if (typeStr.equals("BOOLEAN")) type = Parameter.BOOLEAN_TYPE; else throw new Exception("Parameter type for parameter " + name + " not supported"); toReturn[j] = new Parameter(name, "", description, type); } break; } } return toReturn; }
From source file:it.eng.spagobi.studio.dashboard.editors.model.dashboard.Data.java
License:Mozilla Public License
public Parameter[] getDataParametersForMovie(String dashboardMovie, Document document) throws Exception { Parameter[] toReturn = null;//from w w w . j a v a 2 s .c o m List dashboards = document.selectNodes("//DASHBOARDS/DASHBOARD"); if (dashboards == null || dashboards.size() == 0) throw new Exception("No dashboards configured"); for (int i = 0; i < dashboards.size(); i++) { Node dashboard = (Node) dashboards.get(i); String movie = dashboard.valueOf("@movie"); if (dashboardMovie.equals(movie)) { List configuredParameters = dashboard.selectNodes("DATA/PARAMETER"); toReturn = new Parameter[configuredParameters.size()]; for (int j = 0; j < configuredParameters.size(); j++) { Node aConfiguredParameter = (Node) configuredParameters.get(j); String name = aConfiguredParameter.valueOf("@name"); String description = aConfiguredParameter.valueOf("@description"); String typeStr = aConfiguredParameter.valueOf("@type"); int type; if (typeStr.equals("NUMBER")) type = Parameter.NUMBER_TYPE; else if (typeStr.equals("STRING")) type = Parameter.STRING_TYPE; else if (typeStr.equals("COLOR")) type = Parameter.COLOR_TYPE; else if (typeStr.equals("BOOLEAN")) type = Parameter.BOOLEAN_TYPE; else throw new Exception("Parameter type for parameter " + name + " not supported"); toReturn[j] = new Parameter(name, "", description, type); } break; } } return toReturn; }
From source file:it.pdfsam.plugin.coverfooter.GUI.CoverFooterMainGUI.java
License:Open Source License
public void loadJobNode(Node arg) throws LoadJobException { final Node arg0 = arg; final Thread loadnode_thread = new Thread(add_or_run_threads, "load") { private String wip_text; public void run() { try { Node cover_node = (Node) arg0.selectSingleNode("cover/@value"); if (cover_node != null) { cover_text_field.setText(cover_node.getText()); }/*from w w w.j a va 2 s .com*/ Node footer_node = (Node) arg0.selectSingleNode("footer/@value"); if (footer_node != null) { footer_text_field.setText(footer_node.getText()); } Node file_destination = (Node) arg0.selectSingleNode("destination/@value"); if (file_destination != null) { destination_text_field.setText(file_destination.getText()); } Node file_overwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (file_overwrite != null) { overwrite_checkbox.setSelected(file_overwrite.getText().equals("true")); } Node file_compressed = (Node) arg0.selectSingleNode("compressed/@value"); if (file_compressed != null) { output_compressed_check.setSelected(file_compressed.getText().equals("true")); } modello_cover_table.clearData(); List file_list = arg0.selectNodes("filelist/file"); wip_text = GettextResource.gettext(i18n_messages, "Please wait while reading ") + " ..."; addWipText(wip_text); for (int i = 0; file_list != null && i < file_list.size(); i++) { Node file_node = (Node) file_list.get(i); addTableRowsFromNode(file_node); } removeWipText(wip_text); fireLogPropertyChanged(GettextResource.gettext(i18n_messages, "CoverAndFooter section loaded."), LogPanel.LOG_INFO); } catch (Exception ex) { fireLogPropertyChanged(GettextResource.gettext(i18n_messages, "Error: ") + ex.getMessage(), LogPanel.LOG_ERROR); } } }; loadnode_thread.start(); }
From source file:it.pdfsam.plugin.encrypt.GUI.EncryptMainGUI.java
License:Open Source License
public void loadJobNode(Node arg0) throws LoadJobException { try {//from w ww . ja v a2 s.co m Node file_source = (Node) arg0.selectSingleNode("source/@value"); if (file_source != null) { source_text_field.setText(file_source.getText()); } Node allow_all = (Node) arg0.selectSingleNode("allowall/@value"); if (allow_all != null && allow_all.getText().equals("true")) { allowall_check.doClick(); } else { Node permissions = (Node) arg0.selectSingleNode("permissions"); if (permissions != null) { List listEnab = permissions.selectNodes("enabled"); for (int j = 0; listEnab != null && j < listEnab.size(); j++) { Node enabledNode = (Node) listEnab.get(j); if (enabledNode != null) { permissions_check[Integer.parseInt(enabledNode.selectSingleNode("@value").getText())] .doClick(); } } } } Node enc_type = (Node) arg0.selectSingleNode("enctype/@value"); if (enc_type != null) { encrypt_type.setSelectedItem((String) enc_type.getText()); } Node user_pwd = (Node) arg0.selectSingleNode("usrpwd/@value"); if (user_pwd != null) { user_pwd_field.setText(user_pwd.getText()); } Node owner_pwd = (Node) arg0.selectSingleNode("ownerpwd/@value"); if (owner_pwd != null) { owner_pwd_field.setText(owner_pwd.getText()); } Node file_destination = (Node) arg0.selectSingleNode("destination/@value"); if (file_destination != null) { dest_folder_text.setText(file_destination.getText()); choose_a_folder_radio.doClick(); } else { same_as_source_radio.doClick(); } Node file_overwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (file_overwrite != null) { overwrite_checkbox.setSelected(file_overwrite.getText().equals("true")); } Node file_compressed = (Node) arg0.selectSingleNode("compressed/@value"); if (file_compressed != null) { output_compressed_check.setSelected(file_compressed.getText().equals("true")); } Node file_prefix = (Node) arg0.selectSingleNode("prefix/@value"); if (file_prefix != null) { out_prefix_text.setText(file_prefix.getText()); } fireLogPropertyChanged(GettextResource.gettext(i18n_messages, "Encrypt section loaded."), LogPanel.LOG_INFO); } catch (Exception ex) { fireLogPropertyChanged(GettextResource.gettext(i18n_messages, "Error: ") + ex.getMessage(), LogPanel.LOG_ERROR); } }
From source file:it.pdfsam.plugin.merge.GUI.MergeMainGUI.java
License:Open Source License
public void loadJobNode(Node arg) throws LoadJobException { final Node arg0 = arg; final Thread loadnode_thread = new Thread(add_or_run_threads, "load") { private String wip_text; public void run() { try { Node file_destination = (Node) arg0.selectSingleNode("destination/@value"); if (file_destination != null) { destination_text_field.setText(file_destination.getText()); }/* w ww .j av a2 s .c o m*/ Node file_overwrite = (Node) arg0.selectSingleNode("overwrite/@value"); if (file_overwrite != null) { overwrite_checkbox.setSelected(file_overwrite.getText().equals("true")); } Node merge_type = (Node) arg0.selectSingleNode("merge_type/@value"); if (merge_type != null) { merge_type_check.setSelected(merge_type.getText().equals("true")); } modello_merge_table.clearData(); List file_list = arg0.selectNodes("filelist/file"); wip_text = GettextResource.gettext(i18n_messages, "Please wait while reading ") + " ..."; addWipText(wip_text); for (int i = 0; file_list != null && i < file_list.size(); i++) { Node file_node = (Node) file_list.get(i); addTableRowsFromNode(file_node); } Node file_compressed = (Node) arg0.selectSingleNode("compressed/@value"); if (file_compressed != null) { output_compressed_check.setSelected(file_compressed.getText().equals("true")); } removeWipText(wip_text); fireLogPropertyChanged(GettextResource.gettext(i18n_messages, "Merge section loaded."), LogPanel.LOG_INFO); } catch (Exception ex) { fireLogPropertyChanged(GettextResource.gettext(i18n_messages, "Error: ") + ex.getMessage(), LogPanel.LOG_ERROR); } } }; loadnode_thread.start(); }
From source file:itslearning.platform.restapi.sdk.learningtoolapp.LearningObjectServicetRestClient.java
/** * xml looks like this/*from w w w .j a v a2s.com*/ <ArrayOfRubricCriteriaItem xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <RubricCriteriaItem> <Id>1</Id> <Title>First criteria item</Title> <LearningObjectiveId>33</LearningObjectiveId> <AchievementLevels> <RubricAchievementLevel> <Id>1</Id> <Text>Advanced</Text> <OrderNo>1</OrderNo> </RubricAchievementLevel> <RubricAchievementLevel> <Id>2</Id> <Text>Proficient</Text> <OrderNo>2</OrderNo> </RubricAchievementLevel> <RubricAchievementLevel> <Id>3</Id> <Text>Basic</Text> <OrderNo>4</OrderNo> </RubricAchievementLevel> <RubricAchievementLevel> <Id>4</Id> <Text>Below basic</Text> <OrderNo>4</OrderNo> </RubricAchievementLevel> </AchievementLevels> <UniqueId>12341234</UniqueId> </RubricCriteriaItem> </ArrayOfRubricCriteriaItem> * * @param responseBodyAsStream * @return */ private List<RubricCriteriaItem> deserializeXMLToCriteria(InputStream xmlStream) throws DocumentException { List<RubricCriteriaItem> result = new ArrayList<RubricCriteriaItem>(); SAXReader reader = new SAXReader(); Document doc = reader.read(xmlStream); String lElem = "//loi:ArrayOfRubricCriteriaItem"; doc.getRootElement().setQName(new QName(doc.getRootElement().getQName().getName(), new Namespace("loi", doc.getRootElement().getNamespaceURI()))); Element root = doc.getRootElement(); List<Node> nodes = root.selectNodes(lElem + "/loi:RubricCriteriaItem"); for (Node n : nodes) { RubricCriteriaItem rubric = new RubricCriteriaItem(); Node node = n.selectSingleNode("loi:Id"); if (node.hasContent()) { rubric.setId(Integer.parseInt(node.getStringValue())); } node = n.selectSingleNode("loi:Title"); if (node.hasContent()) { rubric.setTitle(node.getStringValue()); } node = n.selectSingleNode("loi:LearningObjectiveId"); if (node.hasContent()) { rubric.setLearningObjectiveId(Integer.parseInt(node.getStringValue())); } node = n.selectSingleNode("loi:AchievementLevels"); if (node.hasContent()) { rubric.setAchievementLevels( getRubricAchievementLevelsFromXml(n.selectNodes("loi:RubricAchievementLevel"))); } node = n.selectSingleNode("loi:UniqueId"); if (node.hasContent()) { rubric.setUniqueId(node.getStringValue()); } result.add(rubric); } return result; }