@Override void getAsString(Object node, StringWriter sw) { sw.getBuffer().append(((Node) node).asXML()); }
String xPath = "description"; List<Node> nodes = document.selectNodes( xPath ); for (Node node : nodes) { node.asXML() }
public String getXML() { return mathNode.asXML(); }
private void evaluate(Node ctxNode, List<String> errors) { Object obj = ctxNode.selectObject(xpath); if (obj == null) { errors.add(errorMessage + ": " + ctxNode.asXML()); } else if (obj instanceof Boolean && !((Boolean) obj)) { errors.add(errorMessage + ": " + ctxNode.asXML()); } else if (obj instanceof List && ((List<?>) obj).isEmpty()) { errors.add(errorMessage + ": " + ctxNode.asXML()); } } }
@Override void getAsString(Object node, StringWriter sw) { sw.getBuffer().append(((Node) node).asXML()); }
@Override void getAsString(Object node, StringWriter sw) { sw.getBuffer().append(((Node) node).asXML()); }
void getAsString(Object node, StringWriter sw) { sw.getBuffer().append(((Node)node).asXML()); }
static String readAnnotation(Node node) { String annotation = null; //if this is a text node, then match for annotations if (isText(node)) { final Matcher matcher = AnnotationParser.WIDGET_ANNOTATION_REGEX .matcher(node.asXML()); if (matcher.find()) { annotation = matcher.group(); } } return annotation; }
public static String transformSnippet( final Node xForm, final IPentahoSession session, final IDocumentResourceLoader loader ) throws TransformerException { return XForm.transformSnippet( xForm.asXML(), null, session, loader ); }
Document doc = new SAXReader().read(...); Node user = doc.getRootElement() .element("notification") .element("Update") .element("data") .element("user"); String onlyUserXml = user.asXML();
protected DateRange parseDateRange(String hitMapXml) throws Exception { Document dom4jXPath = DocumentHelper.parseText(hitMapXml); Node node = dom4jXPath.selectSingleNode("/response/query/org.jfree.data.time.DateRange"); XStream xStream = new XStream(); xStream.setClassLoader(getClass().getClassLoader()); return (DateRange)xStream.fromXML(node.asXML()); }
public void run(Node node) throws Exception { log("Matched pattern: " + match); log("Node: " + node.asXML()); log("........................................"); // apply any child templates stylesheet.applyTemplates(node); } };
public Claim readClaim(Node claimNode) { String id = claimNode.selectSingleNode("@id").getText(); Claim claim; List<Node> dependentN = claimNode.selectNodes("*/dependent-claim-reference/@depends_on"); if (dependentN != null && !dependentN.isEmpty()) { claim = new Claim(id, claimNode.asXML(), ClaimType.DEPENDENT, textProcessor); Set<String> dependentIds = new HashSet<String>(); for (Node refNode : dependentN) { dependentIds.add(refNode.getText()); } claim.setDependentIds(dependentIds); } else { claim = new Claim(id, claimNode.asXML(), ClaimType.INDEPENDENT, textProcessor); } return claim; }
@Override public Abstract read() { Node abstractN = document.selectSingleNode(FRAGMENT_PATH); if (abstractN == null) { return new Abstract("", textProcessor); } return new Abstract(abstractN.asXML(), textProcessor); } }
@Override public Abstract read() { Node abstractN = document.selectSingleNode(FRAGMENT_PATH); if (abstractN == null) { return new Abstract("", textProcessor); } return new Abstract(abstractN.asXML(), textProcessor); } }
@Override public Abstract read() { Node abstractN = document.selectSingleNode(FRAGMENT_PATH); if (abstractN == null) { return new Abstract("", textProcessor); } return new Abstract(abstractN.asXML(), textProcessor); }
@Override public Abstract read() { Node abstractN = document.selectSingleNode(FRAGMENT_PATH); if (abstractN == null) { return new Abstract("", textProcessor); } return new Abstract(abstractN.asXML(), textProcessor); }
public UspcClassification getUSPC(Node classN) { Node uspcN = classN.selectSingleNode("OCL"); if (uspcN != null) { try { String classStr = uspcN.getText().trim(); UspcClassification uspc = new UspcClassification(); uspc.parseText(classStr); uspc.setIsMainClassification(true); return uspc; } catch (ParseException e) { LOGGER.warn("Failed to Parse USPC Classification: '{}' from : {}", uspcN.getText(), classN.asXML()); } } return null; }
protected void testXPath(String xpathExpression) { NodeFilter nodeFilter = DocumentHelper .createXPathFilter(xpathExpression); assertTrue("No NodeFilter object was created", nodeFilter != null); List list = document.selectNodes("//author"); for (Iterator iter = list.iterator(); iter.hasNext();) { Node node = (Node) iter.next(); if (nodeFilter.matches(node)) { log("Matches node: " + node.asXML()); } else { log("No match for node: " + node.asXML()); } } } }