Groovy Add Attribute to XML Dynamically

2016-07-03 Thread GroovyBeginner
I'm trying to accomplish adding the attribute dynamically to the current xml node if the attribute `"available"` exists using Groovy and XmlSlurper. Is there a way to do this?Here is the XML structure def books = '''

Add Namespace to the XML attribute

2016-07-04 Thread GroovyBeginner
Hi, I'm trying to accomplish adding the namespace to the attribute . Is there a way to do this?Here is the XML structure. Don Xijote Manuel De Cervantes My Output should get the following: Don Xijote Manuel De Cervantes -- View this message in context: http

Groovy Better Approach to create comma separated string from Database Select Query

2016-07-16 Thread GroovyBeginner
I am trying to connect to oracle database table and pull the data and form the result in the form of comma separated values. I have written a sample code which works fine but wanted to have a better approach if the query is associated with more tables (joins), then the time is taken to get the outp

Oracle Insert Data from one table to another table using Groovy

2016-07-25 Thread GroovyBeginner
I have a requirement of inserting the data from table A into table B and am using Oracle database. My condition is am going to insert only those records which are not present in table B and am facing an issue of retrieving the current row column values. Here is the code am trying. import groov

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-26 Thread GroovyBeginner
I tried this and facing the following issue groovy.lang.MissingPropertyException: No such property: ID for class: oracle.jdbc.driver.OracleResultSetImpl Possible solutions: row at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51) at org.codeh

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-27 Thread GroovyBeginner
I have tried the following code now and seems to be nothing is being inserted into the database table. I have executed the following code and the result is displayed as null. import groovy.sql.Sql; import java.sql.ResultSet; import java.util.Properties; sql = Sql.newInstance("jdbc:oracle:thin:@lo

Better Approach to fetch entire data from the table Groovy Sql

2016-07-27 Thread GroovyBeginner
I am trying to fetch entire data from a table and the outcome should be a comma seperated string. Here is my code which is working fine. import groovy.sql.Sql; import java.sql.ResultSet; def temp=""; def temp1=""; sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1521:XE","username", "passw

Re: Oracle Insert Data from one table to another table using Groovy

2016-07-28 Thread GroovyBeginner
Thanks !! It worked -- View this message in context: http://groovy.329449.n5.nabble.com/Oracle-Insert-Data-from-one-table-to-another-table-using-Groovy-tp5734285p5734338.html Sent from the Groovy Dev mailing list archive at Nabble.com.

Convert JDBC Result sets to xml

2016-07-29 Thread GroovyBeginner
Is there any approach of converting the JDBC result sets to xml dynamically with out specifying the tags in xml as column names. I am using the following code import groovy.sql.Sql; import java.sql.ResultSet; Sql sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1521:XE","username", "password"

Re: Convert JDBC Result sets to xml

2016-07-30 Thread GroovyBeginner
Can I achieve this xml output directly after querying to the db? -- View this message in context: http://groovy.329449.n5.nabble.com/Convert-Oracle-Result-sets-to-xml-tp5734358p5734375.html Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: Convert JDBC Result sets to xml

2016-07-31 Thread GroovyBeginner
I was trying to create the list initially in that case and then to xml with the following code import groovy.sql.Sql; import java.sql.ResultSet; Sql sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1521:XE","username", "password", "oracle.jdbc.driver.OracleDriver") def emptyList = [] sql.e

Iterate ArrayList over XML

2016-08-12 Thread GroovyBeginner
I am iterating an arraylist over xml and forming another xml with the list of values present in arraylist. Here is the code am using import groovy.xml.MarkupBuilder def books=''' 2 *3* 4 ''' def lst=["a","b","c","d"] def sw = new

Iterate ArrayList over XML Groovy

2016-08-13 Thread GroovyBeginner
I am iterating an arraylist over xml and creating another xml with the list of values present in arraylist. Here is the code am using This code is working fine for the xml which does not have child nodes How to get all the child nodes of a parent which is present in the arraylist. For example if

Re: Iterate ArrayList over XML Groovy

2016-08-14 Thread GroovyBeginner
Thanks It worked!! what does refer in the script. Could you please explain me the significance of using '..' in the script? -- View this message in context: http://groovy.329449.n5.nabble.com/Iterate-ArrayList-over-XML-Groovy-tp5734628p5734637.html Sent from the Groovy Dev mailing list archive

Re: Iterate ArrayList over XML Groovy

2016-08-14 Thread GroovyBeginner
Thanks a lot for the explanation :) -- View this message in context: http://groovy.329449.n5.nabble.com/Iterate-ArrayList-over-XML-Groovy-tp5734628p5734639.html Sent from the Groovy Dev mailing list archive at Nabble.com.

Re: Iterate ArrayList over XML Groovy

2016-08-14 Thread GroovyBeginner
In this case If I dont specify the value of e in the list. It is not appearing in the output.How to get all the child nodes of a parent which is present in the arraylist. For example if my list and input has the following Since a and b are present in the list and node e is a part of b and g is n

Re: Iterate ArrayList over XML Groovy

2016-08-16 Thread GroovyBeginner
Hi Paulk, Is there any alternative approach of doing this without XmlUtil.serialize since am facing few jar issues. -- View this message in context: http://groovy.329449.n5.nabble.com/Iterate-ArrayList-over-XML-Groovy-tp5734628p5734680.html Sent from the Groovy Dev mailing list archive at Nabbl

Issue with XML Serialization

2016-08-18 Thread GroovyBeginner
Am facing the issue when serialising the node object. Here is my code but getting an error groovy.util.XmlNodePrinter.setPreserveWhitespace(Z)V and when used getting an -- View this message in context: http://groovy.329449.n5.nabble.com/Issue-with-XML-Serialization-tp5734724.html Sent from

Convert Employee Node object to XML

2016-08-20 Thread GroovyBeginner
I have Employee Node Object of class groovy.util.Node How to convert this object to XML with out using the serialize method IN Groovy? -- View this message in context: http://groovy.329449.n5.nabble.com/Convert-Employee-Node-object-to-XML-tp5734770.html Sent from the Groovy Dev mailing list

Convert Employee Node object to XML Groovy

2016-08-21 Thread GroovyBeginner
I have Employee Node Object of class groovy.util.Node xml=Employees[attributes={}; value=[Employee[attributes={}; value=[ID[attributes={}; value=[123]], Addresses[attributes={}; value=[Address[attributes={}; value=[Country[attributes={}; value=[USA]], ZipCode[attributes={}; value=[40640,

Delete Sub Child XML Nodes

2016-08-24 Thread GroovyBeginner
I am unable to delete the sub child xml Nodes. Here is the input and code am trying with import groovy.xml.*; def employees=''' 123 xyz U