@SuppressWarnings("unchecked") public static <T> List<T> selectNodes(Node node, String arg0) { return (List<T>)node.selectNodes(arg0); }
private Map<String, String> readInitParams(Node configData) { Map<String, String> paramMap = new HashMap<>(); List<Node> params = configData.selectNodes("init-params/init-param"); for (Node param : params) { String paramName = param.selectSingleNode("param-name").getStringValue(); String paramValue = param.selectSingleNode("param-value").getStringValue(); paramMap.put(paramName, paramValue); } return paramMap; }
@NotNull private static Map<String, Node> cacheUnitTestNodes(final Node document, final String namespacePrefix) { final Map<String, Node> cachedTestInfo = new HashMap<>(); final List<Element> cachedNodes = document.selectNodes("//" + namespacePrefix + "UnitTest"); for (final Element e : cachedNodes) { cachedTestInfo.put(e.attributeValue("id"), e); } return cachedTestInfo; }
/** * Executes the specified XPath query as a multiple node query, returning the text values of the resulting list of * nodes. */ @SuppressWarnings("unchecked") public static List<String> selectNodeValues(Node node, String xpathQuery) { List<Node> resultNodes = node.selectNodes(xpathQuery); return extractNodeValues(resultNodes); }
private void evaluate(Node e, List<String> errors) { @SuppressWarnings("unchecked") List<Node> contexts = e.selectNodes(contextPattern); if (contexts != null && contexts.size() > 0) { for (Node ctxNode : contexts) { for (RuleTest test : tests) { test.evaluate(ctxNode, errors); } } } } }
String getAllTextContent(Node node) { List<Node> nodes = node.selectNodes("descendant-or-self::text()"); StringBuilder buf = new StringBuilder(); for ( Node n : nodes ) { buf.append(n.getText()); } return buf.toString(); } // usage System.out.println(getAllTextContent(doc.selectSingleNode("//sentence")));
private void continuationPart(Node fragmentNode) { @SuppressWarnings("unchecked") List<Node> continuationPartN = fragmentNode.selectNodes("continuations/continuation-in-part-of/parent-child"); for (Node continuationPart : continuationPartN) { readIds(continuationPart, DocumentIdType.CONTINUATION_IN_PART); } }
private void contionationOf(Node fragmentNode) { @SuppressWarnings("unchecked") List<Node> continuationN = fragmentNode.selectNodes("continuations/continuation-of/parent-child"); for (Node continuation : continuationN) { readIds(continuation, DocumentIdType.CONTINUATION); } }
private List<String> getValues(String mathMLString) { List<String> values = new ArrayList<String>(); List<Node> textNodes = mathNode.selectNodes("//*[text()]"); for (Node node : textNodes) { String value = node.getText().trim(); if (!value.isEmpty() && !"=".equals(value)) { values.add(value); } } return values; }
public void setPaintSequence( final Node paletteNode ) { if ( paletteNode != null ) { List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME ); Paint[] paints = new Paint[colorNodes.size()]; for ( int i = 0; i < colorNodes.size(); i++ ) { paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) ); } setPaintSequence( paints ); } }
public void setPaintSequence( final Node paletteNode ) { if ( paletteNode != null ) { List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME ); Paint[] paints = new Paint[colorNodes.size()]; for ( int i = 0; i < colorNodes.size(); i++ ) { paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) ); } setPaintSequence( paints ); } }
public void setPaintSequence( final Node paletteNode ) { if ( paletteNode != null ) { List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME ); Paint[] paints = new Paint[colorNodes.size()]; for ( int i = 0; i < colorNodes.size(); i++ ) { paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) ); } setPaintSequence( paints ); } }
public void setBarSeries( final Node barSeriesNode ) { if ( barSeriesNode != null ) { List barNodes = barSeriesNode.selectNodes( BarLineChartDefinition.SERIES_NODE_NAME ); String[] bars = new String[barNodes.size()]; for ( int i = 0; i < barNodes.size(); i++ ) { Node barNode = (Node) barNodes.get( i ); bars[i] = barNode.getText(); } setBarColumns( bars ); } }
public void setLineSeries( final Node lineSeriesNode ) { if ( lineSeriesNode != null ) { List lineNodes = lineSeriesNode.selectNodes( BarLineChartDefinition.SERIES_NODE_NAME ); String[] lines = new String[lineNodes.size()]; for ( int i = 0; i < lineNodes.size(); i++ ) { Node lineNode = (Node) lineNodes.get( i ); lines[i] = lineNode.getText(); } setLineColumns( lines ); } }
public void setPaintSequence( final Node paletteNode ) { if ( paletteNode != null ) { List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME ); Paint[] paints = new Paint[colorNodes.size()]; for ( int i = 0; i < colorNodes.size(); i++ ) { paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) ); } setPaintSequence( paints ); } }
public void setPaintSequence( final Node paletteNode ) { if ( paletteNode != null ) { List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME ); Paint[] paints = new Paint[colorNodes.size()]; for ( int i = 0; i < colorNodes.size(); i++ ) { paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) ); } setPaintSequence( paints ); } }
public void setPaintSequence( final Node paletteNode ) { if ( paletteNode != null ) { List colorNodes = paletteNode.selectNodes( ChartDefinition.COLOR_NODE_NAME ); Paint[] paints = new Paint[colorNodes.size()]; for ( int i = 0; i < colorNodes.size(); i++ ) { paints[i] = JFreeChartEngine.getPaint( (Node) colorNodes.get( i ) ); } setPaintSequence( paints ); } }
public void perform(TaskRequest req, TaskResponse res) { Node srcNode = (Node) source.evaluate(req, res); List nodes = srcNode.selectNodes((String) xpath.evaluate(req, res)); String name = (String) attribute_name.evaluate(req, res); for (Iterator it = nodes.iterator(); it.hasNext();) { Node n = (Node) it.next(); res.setAttribute(name, n); super.performSubtasks(req, res); } }
public ClassificationItem parse(Document document) { Node parentClassItemN = document.selectSingleNode("/class-scheme/classification-item"); ClassificationItem parentClassItem = readClassificationItem(parentClassItemN, null); List<Node> childClassItems = parentClassItemN.selectNodes("classification-item"); for (Node childClass: childClassItems){ readClassificationItem(childClass, parentClassItem); } return parentClassItem; }
private void divisionOf(Node fragmentNode) { @SuppressWarnings("unchecked") List<Node> divisionalN = fragmentNode.selectNodes("division-of/parent-child"); for (Node divisional : divisionalN) { readIds(divisional, DocumentIdType.DIVISION); Node parentPNode = divisional.selectSingleNode("parent-patent"); if (parentPNode != null) { DocumentId documentId = new DocumentIdNode(parentPNode).read(); relatedDocIds.add(documentId); } } }