/** * Creates a new instance that wraps the submitted XML document. * * @param doc * xml content * @param systemId * the URL that is the source of the passed doc. If this URL is not available or unknown, the string * should contain the value of XMLFragment.DEFAULT_URL */ public XMLAdapter( OMDocument doc, String systemId ) { this( doc.getOMDocumentElement(), systemId ); }
/** * Parse input stream to get root element. * @param in the input stream * @return the root element */ public static OMElement getRootElement(InputStream in) { return getDocument(in).getOMDocumentElement(); } /**
/** * Parse input stream to get root element. * * @param in * the input stream * @return the root element */ public static OMElement getRootElement(InputStream in) { return getDocument(in).getOMDocumentElement(); }
public static OMElement wrapBoxCarringResponse(OMElement result) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMElement wrapperElement = fac.createOMElement(new QName(DBConstants.WSO2_DS_NAMESPACE, DBConstants.DATA_SERVICE_REQUEST_BOX_RESPONSE_WRAPPER_ELEMENT)); if (result != null) { wrapperElement.addChild(result); } OMDocument doc = fac.createOMDocument(); doc.addChild(wrapperElement); return doc.getOMDocumentElement(); }
public OMElement getDocumentElement(boolean discardDocument) { OMElement element = getDocument().getOMDocumentElement(); if (discardDocument) { ((OMElementEx)element).detachAndDiscardParent(); document = null; } return element; }
private static OMElement generateRequestSuccessElement() { OMFactory fac = OMAbstractFactory.getOMFactory(); OMElement result = fac.createOMElement(new QName(DBConstants.WSO2_DS_NAMESPACE, DBConstants.REQUEST_STATUS_WRAPPER_ELEMENT)); result.setText(DBConstants.REQUEST_STATUS_SUCCESSFUL_MESSAGE); OMDocument doc = fac.createOMDocument(); doc.addChild(result); return doc.getOMDocumentElement(); }
public OMElement getDocumentElement(boolean discardDocument) { OMElement documentElement = getDocument().getOMDocumentElement(); if (discardDocument) { documentElement.detach(); } return documentElement; }
public OMElement getDocumentElement(boolean discardDocument) { OMElement documentElement = getDocument().getOMDocumentElement(); if (discardDocument) { documentElement.detach(); } return documentElement; }
protected OMElement getCategorySeriesElement(String chartText, String chartDatasetText, String chartSeriesText) throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:title//a:" + chartText + "//a:" + chartDatasetText + "//a:" + chartSeriesText); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement aCategorySeries = (OMElement) nodeList.get(0); return aCategorySeries; }
protected OMElement getSubDataSetElement() throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:subDataset"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement element = (OMElement) nodeList.get(0); return element; }
protected OMElement getComponentElement(String componentName) throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:title//a:band//a:" + componentName); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement element = (OMElement) nodeList.get(0); return element; }
private void refreshReport() throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:title"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement element = (OMElement) nodeList.get(0); element.detach(); }
private void setTableHeaderNames() throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:title//a:band//a:componentElement//b:table//b:column" + "//b:columnHeader//a:text"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); xpathExpression.addNamespace("b", "http://jasperreports.sourceforge.net/jasperreports/components"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); for (int i = 0; i < nodeList.size(); i++) { OMElement textElement = (OMElement) nodeList.get(i); tableReport.getColumns()[i].setColumnHeaderName(textElement.getText()); } }
private TableReportDTO setTableOutlines() throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:style//a:box//a:pen"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement penElement = (OMElement) nodeList.get(0); tableReport.setOutLineThickness(Double.parseDouble(penElement.getAttributeValue(new QName("lineWidth")))); tableReport.setOutLineColor(penElement.getAttributeValue(new QName("lineColor"))); return tableReport; }
private void reloadContent(OMElement loadedElement) throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:title"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); List nodeList = xpathExpression.selectNodes(loadedElement); OMElement element = (OMElement) nodeList.get(0); document.getOMDocumentElement().addChild(element); }
protected void setBackgroundColor() throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:background//a:band//a:staticText//a:reportElement"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement element = (OMElement) nodeList.get(0); String backColor = element.getAttributeValue(new QName("backcolor")); report.setBackgroundColour(backColor); }
protected void handleBackgroundColor() throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:background//a:band//a:staticText//a:reportElement"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement element = (OMElement) nodeList.get(0); element.getAttribute(new QName("backcolor")).setAttributeValue(report.getBackgroundColour()); }
private void handleTableOutlines() throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:style//a:box//a:pen"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement penElement = (OMElement) nodeList.get(0); penElement.getAttribute(new QName("lineWidth")).setAttributeValue(String.format("%.1g%n", tableReport.getOutLineThickness())); penElement.getAttribute(new QName("lineColor")).setAttributeValue(tableReport.getOutLineColor()); }
public static OMElement extractElement(XMLStreamReader reader, boolean proceedToNext) { OMDocument document = OMXMLBuilderFactory.createStAXOMBuilder( new XMLFragmentStreamReader(reader, proceedToNext)).getDocument(); document.build(); return document.getOMDocumentElement(); } }
private void addParam(String dsname, String className) throws JaxenException { AXIOMXPath xpathExpression = new AXIOMXPath("//a:parameter"); xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports"); OMElement documentElement = document.getOMDocumentElement(); List nodeList = xpathExpression.selectNodes(documentElement); OMElement element = (OMElement) nodeList.get(0); OMElement newParam = element.cloneOMElement(); newParam.getAttribute(new QName("name")).setAttributeValue(dsname); newParam.getAttribute(new QName("class")).setAttributeValue(className); documentElement.addChild(newParam); }