List of usage examples for org.w3c.dom DOMException printStackTrace
public void printStackTrace(PrintStream s)
From source file:org.sakaiproject.tool.assessment.qti.helper.ExtractionHelper.java
/** * Look up a List of Section XML from Assessment Xml * @return a List of Section XML objects *///from w w w . ja va 2 s. com public List getSectionXmlList(Assessment assessmentXml) { List nodeList = assessmentXml.selectNodes("//section"); List sectionXmlList = new ArrayList(); // now convert our list of Nodes to a list of section xml for (int i = 0; i < nodeList.size(); i++) { try { Node node = (Node) nodeList.get(i); // create a document for a section xml object Document sectionDoc = XmlUtil.createDocument(); // Make a copy for inserting into the new document Node importNode = sectionDoc.importNode(node, true); // Insert the copy into sectionDoc sectionDoc.appendChild(importNode); Section sectionXml = new Section(sectionDoc, this.getQtiVersion()); // add the new section xml object to the list sectionXmlList.add(sectionXml); } catch (DOMException ex) { log.error(ex); ex.printStackTrace(System.out); } } return sectionXmlList; }
From source file:org.sakaiproject.tool.assessment.qti.helper.ExtractionHelper.java
/** * Look up a List of Item XML from Section Xml * @param Section sectionXml//www . jav a2 s. c o m * @return a List of Item XML objects */ public List getItemXmlList(Section sectionXml) { String itemElementName = qtiVersion == QTIVersion.VERSION_1_2 ? "//item" : "//assessmentItem"; // now convert our list of Nodes to a list of section xml List nodeList = sectionXml.selectNodes(itemElementName); List itemXmlList = new ArrayList(); for (int i = 0; i < nodeList.size(); i++) { try { Node node = (Node) nodeList.get(i); // create a document for a item xml object Document itemDoc = XmlUtil.createDocument(); // Make a copy for inserting into the new document Node importNode = itemDoc.importNode(node, true); // Insert the copy into itemDoc itemDoc.appendChild(importNode); Item itemXml = new Item(itemDoc, this.getQtiVersion()); // add the new section xml object to the list itemXmlList.add(itemXml); } catch (DOMException ex) { log.error(ex); ex.printStackTrace(System.out); } } return itemXmlList; }