List of usage examples for org.dom4j DocumentHelper createElement
public static Element createElement(String name)
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();// ww w. j ava2s . 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 addListColumnRowSpan(String p_sName) { String sName = p_sName;/*from ww w . j a va 2 s .c om*/ String quotChar = "\'"; if (sName.indexOf(quotChar) >= 0) { quotChar = "\""; } // Need to find the column corresponding to the referenced data item String elementString = "/report/layouts/layout/reportPages/page/pageBody/contents/list/" + "listColumns/listColumn/listColumnBody/contents/textItem/dataSource/" + "dataItemValue[@refDataItem=" + quotChar + sName + quotChar + "]"; Element n = (Element) oDocument.selectSingleNode(elementString); // Need to add a listColumnRowSpan node to listColumnBody for that // column (4 levels up) Element eColumnBody = n.getParent().getParent().getParent().getParent(); Element eListColumnRowSpan = DocumentHelper.createElement("listColumnRowSpan"); eListColumnRowSpan.addAttribute("refDataItem", sName); }
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 ww .j a v 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); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addListGroup(String p_sName) { Element n = (Element) oDocument.selectSingleNode( "/report/layouts/layout/reportPages/page/pageBody/contents/list/" + "listColumns/listGroups"); if (n == null) { addListGroups();/*from w ww .j a va 2s . co m*/ n = (Element) oDocument.selectSingleNode( "/report/layouts/layout/reportPages/page/pageBody/contents/list/" + "listColumns/listGroups"); } // Add the listGroup node to listGroups Element eListGroup = DocumentHelper.createElement("listGroup"); n.addAttribute("refDataItem", p_sName); n.add(eListGroup); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addDetailFilter() { Element n = (Element) oDocument.selectSingleNode("/report/queries/query"); if (n == null) { addQuery();//from w ww . ja v a 2s. c o m n = (Element) oDocument.selectSingleNode("/report/queries/query"); } Element eDetailFilter = DocumentHelper.createElement("detailFilter"); n.add(eDetailFilter); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addFilter() { Element n = (Element) oDocument.selectSingleNode("/report/queries/query/detailFilter"); if (n == null) { addDetailFilter();//from w w w.ja va 2 s.c o m n = (Element) oDocument.selectSingleNode("/report/queries/query/detailFilter"); } Element eFilter = DocumentHelper.createElement("filter"); eFilter.addAttribute("use", "required"); n.add(eFilter); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addFilterExpression(String filter) { Element n = (Element) oDocument.selectSingleNode("/report/queries/query/detailFilter/filter"); if (n == null) { addFilter();// w w w. j a v a 2 s.c o m n = (Element) oDocument.selectSingleNode("/report/queries/query/detailFilter/filter"); } Element eFilterExpression = DocumentHelper.createElement("filterExpression"); eFilterExpression.setText(filter); n.add(eFilterExpression); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addSortList() { Element n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents/list"); if (n == null) { addList();// w w w. j a v a2 s.co m n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents/list"); } Element eSortList = DocumentHelper.createElement("sortList"); n.add(eSortList); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void addDataItemSort(String p_sElementName, String p_sSort) { Element n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents/list/sortList"); if (n == null) { addSortList();/* w w w . j av a 2s .com*/ n = (Element) oDocument .selectSingleNode("/report/layouts/layout/reportPages/page/pageBody/contents/list/sortList"); } Element eSort = DocumentHelper.createElement("sortItem"); eSort.addAttribute("refDataItem", p_sElementName); eSort.addAttribute("sortOrder", p_sSort); n.add(eSort); }
From source file:com.ibm.cognos.API.java
License:Open Source License
public void modifyTitle(String title, String newTitle) { Element n = null;/*from w w w. j a va2s.c o m*/ String quotChar = "\'"; if (title.indexOf(quotChar) >= 0) { quotChar = "\""; } String nodeDataItemTitle = "/report/layouts/layout/reportPages/page/pageBody/contents/list/listColumns/" + "listColumn/listColumnTitle/contents/textItem/dataSource/dataItemLabel[@refDataItem=" + quotChar + title + quotChar + "]"; String nodeStaticTitle = "/report/layouts/layout/reportPages/page/pageBody/contents/list/listColumns/" + "listColumn/listColumnTitle/contents/textItem/dataSource/staticValue"; n = (Element) oDocument.selectSingleNode(nodeDataItemTitle); if (n == null) { n = (Element) oDocument.selectSingleNode(nodeStaticTitle); if (n == null) { System.out.println("Modify column title failed for " + title + " title not found."); return; } } Element nDataSource = n.getParent(); n.detach(); Element eTitle = DocumentHelper.createElement("staticValue"); eTitle.setText(newTitle); nDataSource.add(eTitle); }