private XmlDom getXmlDomReport(final String report) { // System.out.println("############################ 2"); final Document reportDom = DSSXMLUtils.buildDOM(report); return new XmlDom(reportDom); }
/** * This method returns {@code XmlDom} representation of the current {@code XmlNode}. * * @return the {@code XmlDom} representation of the current {@code XmlNode}. */ public XmlDom toXmlDom() { final Document document = toDocument(); final XmlDom xmlDom = new XmlDom(document); return xmlDom; }
public XmlDom getElement(final String xPath, final Object... params) { try { String xPath_ = format(xPath, params); NodeList nodeList = getNodeList(rootElement, xPath_); for (int ii = 0; ii < nodeList.getLength(); ii++) { Node node = nodeList.item(ii); if (node != null && node.getNodeType() == Node.ELEMENT_NODE) { return new XmlDom((Element) node); } } return null; } catch (Exception e) { String message = "XPath error: '" + xPath + "'."; throw new DSSException(message, e); } }
/** * The list of elements corresponding the given XPath query and parameters. * * @param xPath * @param params * @return */ public List<XmlDom> getElements(final String xPath, final Object... params) { try { String xPath_ = format(xPath, params); NodeList nodeList = getNodeList(rootElement, xPath_); List<XmlDom> list = new ArrayList<XmlDom>(); for (int ii = 0; ii < nodeList.getLength(); ii++) { Node node = nodeList.item(ii); if (node != null && node.getNodeType() == Node.ELEMENT_NODE) { list.add(new XmlDom((Element) node)); } } return list; } catch (Exception e) { String message = "XPath error: '" + xPath + "'."; throw new DSSException(message, e); } }
public ValidationPolicy load(InputStream inputStream, InputStream xsdInputStream) throws DSSException { //To clone inputStream byte[] fileInputStream = cloneFileInputStream(inputStream); InputStream inputStreamClone2 = new ByteArrayInputStream(fileInputStream); byte[] fileInputStreamXsd = cloneFileInputStream(xsdInputStream); InputStream xsdStream1 = new ByteArrayInputStream(fileInputStreamXsd); InputSource sourceentree = new InputSource(xsdStream1); final Document document = DSSXMLUtils.buildDOM(inputStreamClone2); //Clean XML XPath xp = XPathFactory.newInstance().newXPath(); NodeList nl = null; try { nl = (NodeList) xp.evaluate("//text()[normalize-space(.)='']", document, XPathConstants.NODESET); } catch (XPathExpressionException e) { e.printStackTrace(); } for (int i = 0; i < nl.getLength(); ++i) { Node node = nl.item(i); node.getParentNode().removeChild(node); } document.normalizeDocument(); document.normalize(); final XmlDom xmlDom = new XmlDom(document); final ValidationPolicy validationPolicy = new ValidationPolicy(xmlDom, xsdUrl, document); return validationPolicy; }
getModel().getValidationPolicy().setXmlDom(new XmlDom(document));
getModel().getValidationPolicy().setXmlDom(new XmlDom(document));
final XmlDom xmlDomElement = new XmlDom(element); if (element != null && xmlDomElement.getText() != null && xmlDomElement.getText().length() > 0) { elementExists = true;