List of usage examples for org.dom4j Element add
void add(Namespace namespace);
Namespace
to this element. From source file:com.ibm.cognos.API.java
License:Open Source License
public void addList(String p_sName) { Element n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents"); if (n == null) { addPageBodyContents();/* w ww. j a v a 2 s . c o m*/ n = (Element) oDocument.selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents"); } Element e = DocumentHelper.createElement("list"); Element eStyle = buildStyle("ls"); e.addAttribute("refQuery", p_sName); e.add(eStyle); n.add(e); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addStyle(String p_sName) { String sName = p_sName;//from w w w .j a v a 2 s .c o m String quotChar = "\'"; if (sName.indexOf(quotChar) >= 0) { quotChar = "\""; } String elementString = "/report/layouts/layout/reportPages/page/pageBody/contents/list[@refQuery=" + quotChar + sName + quotChar + "]"; Element n = (Element) oDocument.selectSingleNode(elementString); if (n == null) { addList(p_sName); n = (Element) oDocument.selectSingleNode(elementString); } Element e = DocumentHelper.createElement("style"); n.add(e); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addCSS(String p_sName) { Element n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents/list/style"); if (n == null) { addStyle();//w w w . j av a 2 s . co m n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents/list/style"); } Element e = DocumentHelper.createElement("CSS"); e.addAttribute("value", p_sName); n.add(e); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public Element buildStyle(String sName) { Element eStyle = DocumentHelper.createElement("style"); Element eDefaultStyles = DocumentHelper.createElement("defaultStyles"); Element eDefinedStyle = DocumentHelper.createElement("defaultStyle"); eDefinedStyle.addAttribute("refStyle", sName); eDefaultStyles.add(eDefinedStyle); eStyle.add(eDefaultStyles);/* ww w . j av a 2s . co m*/ return eStyle; }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addQuery(String p_sName) { Element n = (Element) oDocument.selectSingleNode("/report/queries"); if (n == null) { addQueries();/*from w w w .j av a 2 s . c o m*/ n = (Element) oDocument.selectSingleNode("/report/queries"); } Element eModel = DocumentHelper.createElement("model"); Element eSource = DocumentHelper.createElement("source"); Element e = DocumentHelper.createElement("query"); eSource.add(eModel); e.add(eSource); e.addAttribute("name", p_sName); n.add(e); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addSelection() { Element n = (Element) oDocument.selectSingleNode("/report/queries/query"); if (n == null) { addQuery();/* w w w .j a va 2 s .co m*/ n = (Element) oDocument.selectSingleNode("/report/queries/query"); } Element eSelection = DocumentHelper.createElement("selection"); n.add(eSelection); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addDataItem(String p_sName, String p_sExpression, boolean p_bAggregate, String p_sSort) { Element nSelection = (Element) oDocument.selectSingleNode("/report/queries/query/selection"); if (nSelection == null) { addSelection();/* ww w. j ava 2s .c om*/ nSelection = (Element) oDocument.selectSingleNode("/report/queries/query/selection"); } // Create the dataItem element Element eDataItem = DocumentHelper.createElement("dataItem"); eDataItem.addAttribute("name", p_sName); // Add an aggregation element, if necessary if (p_bAggregate) { eDataItem.addAttribute("aggregate", "true"); } // Add the expression for the dataItem Element eExpression = DocumentHelper.createElement("expression"); eExpression.setText(p_sExpression); eDataItem.add(eExpression); // Add the dataItem to the selection element nSelection.add(eDataItem); // add the sort item to the report, if necessary if (p_sSort != null && !p_sSort.equals("")) { addDataItemSort(p_sName, p_sSort); } }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addModelPath(String p_sName) { Element n = (Element) oDocument.getRootElement(); Element eModelPath = DocumentHelper.createElement("modelPath"); eModelPath.setText(p_sName + "/model[@name='model']"); n.add(eModelPath); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addModel() { Element n = (Element) oDocument.selectSingleNode("/report/queries/query"); if (n == null) { addQuery();/*from w ww . j a v a 2s . c o m*/ n = (Element) oDocument.selectSingleNode("/report/queries/query"); } Element e = DocumentHelper.createElement("model"); n.add(e); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addListGroups() { Element n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents/list/"); if (n == null) { addList();//from w w w .j av a 2 s . c o m n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents/list/"); } Element eListGroups = DocumentHelper.createElement("listGroups"); n.add(eListGroups); }