/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public static NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
public static NodeList getNodes(Node baseNode, String xpathExpression, Element nsElement) { try { NodeList nodeList = XPathAPI.selectNodeList(baseNode, xpathExpression, nsElement); return nodeList; } catch (TransformerException e) { throw new RuntimeException("XPath error: " + e.getMessage(), e); } }
/** * @param xml The starting context (a Node or a Document, for example). * @param NodeListXPath xpath * @return A NodeList containing the nodes that match the NodeListXPath * null if nothing matches the NodeListXPath * @throws XPathExpressionException if xpath error */ public static NodeList getNodeList(Node xml, String NodeListXPath) throws XPathExpressionException { NodeList nodeList = null; try { nodeList = XPathAPI.selectNodeList(xml, NodeListXPath); } catch (TransformerException e) { log.error("Error", e); } return nodeList; }
private static List<String> getStepActionConfigs(Node stepNode) throws TransformerException { NodeList actionConfigNodes = XPathAPI.selectNodeList(stepNode, "actions/action"); List<String> actionConfigIDs = new ArrayList<String>(); for (int i = 0; i < actionConfigNodes.getLength(); i++) { actionConfigIDs.add(actionConfigNodes.item(i).getAttributes().getNamedItem("id").getTextContent()); } return actionConfigIDs; }
public NodeList getNodes(Node base, String xpath) throws ProviderInvocationException { try { return XPathAPI.selectNodeList(base, xpath); } catch (TransformerException e) { throw new ProviderInvocationException(e); } }
public NodeList getNodes(Node base, String xpath) throws ProviderInvocationException { try { return XPathAPI.selectNodeList(base, xpath); } catch (TransformerException e) { throw new ProviderInvocationException(e); } }
protected void loadDublinCore(Context c, Item myitem, String filename) throws SQLException, IOException, ParserConfigurationException, SAXException, TransformerException, AuthorizeException { Document document = loadXML(filename); // Get the schema, for backward compatibility we will default to the // dublin core schema if the schema name is not available in the import // file String schema; NodeList metadata = XPathAPI.selectNodeList(document, "/dublin_core"); Node schemaAttr = metadata.item(0).getAttributes().getNamedItem( "schema"); if (schemaAttr == null) { schema = MetadataSchema.DC_SCHEMA; } else { schema = schemaAttr.getNodeValue(); } // Get the nodes corresponding to formats NodeList dcNodes = XPathAPI.selectNodeList(document, "/dublin_core/dcvalue"); if (!isQuiet) { System.out.println("\tLoading dublin core from " + filename); } // Add each one as a new format to the registry for (int i = 0; i < dcNodes.getLength(); i++) { Node n = dcNodes.item(i); addDCValue(c, myitem, schema, n); } }
protected Map<Integer, String> getStepOutcomes(Node stepNode) throws TransformerException, WorkflowConfigurationException { try { NodeList outcomesNodeList = XPathAPI.selectNodeList(stepNode, "outcomes/step"); Map<Integer, String> outcomes = new HashMap<Integer, String>(); //Add our outcome, should it be null it will be interpreted as the end of the line (last step) for (int i = 0; i < outcomesNodeList.getLength(); i++) { Node outcomeNode = outcomesNodeList.item(i); int index = Integer.parseInt(outcomeNode.getAttributes().getNamedItem("status").getTextContent()); if (index < 0) { throw new WorkflowConfigurationException( "Outcome configuration error for step: " + stepNode.getAttributes().getNamedItem("id") .getTextContent()); } outcomes.put(index, outcomeNode.getTextContent()); } return outcomes; } catch (Exception e) { log.error( "Outcome configuration error for step: " + stepNode.getAttributes().getNamedItem("id").getTextContent(), e); throw new WorkflowConfigurationException( "Outcome configuration error for step: " + stepNode.getAttributes().getNamedItem("id") .getTextContent()); } }
/** * Load Bitstream Format metadata * * @param context DSpace context object * @param filename the filename of the XML file to load * @throws SQLException if database error * @throws IOException if IO error * @throws TransformerException if transformer error * @throws ParserConfigurationException if config error * @throws AuthorizeException if authorization error * @throws SAXException if parser error */ public static void loadBitstreamFormats(Context context, String filename) throws SQLException, IOException, ParserConfigurationException, SAXException, TransformerException, AuthorizeException { Document document = loadXML(filename); // Get the nodes corresponding to formats NodeList typeNodes = XPathAPI.selectNodeList(document, "dspace-bitstream-types/bitstream-type"); // Add each one as a new format to the registry for (int i = 0; i < typeNodes.getLength(); i++) { Node n = typeNodes.item(i); loadFormat(context, n); } log.info(LogManager.getHeader(context, "load_bitstream_formats", "number_loaded=" + typeNodes.getLength())); }
/** * Constructor. * * @param filename selenese script file. (Don't use to open a file. It is used as a label and is used to generate filenames based on it) * @param document Test suite DOM. * @throws InvalidSeleneseException invalid selenese exception. */ public SeleneseTestCaseIterator(String filename, Document document) throws InvalidSeleneseException { super(filename); setName(ParserUtils.getNameFromFilename(filename)); setId(filename); try { this.nodeList = XPathAPI.selectNodeList(document, "//TBODY/TR/TD/A/@href"); } catch (TransformerException e) { throw new InvalidSeleneseException(e, filename, null); } }