Hi, Try using toXMLString() method.
Thanks, On Thu, Feb 26, 2015 at 10:17 PM, Bhathiya Jayasekara <[email protected]> wrote: > Hi all, > > I'm facing some issues while trying to read some values from a datasource > XML. My code is like this. > > 1 var stub = new > org.wso2.carbon.ndatasource.ui.stub.NDataSourceAdminStub('https://localhost:9443/services/NDataSourceAdmin'); > 2 var client = stub._getServiceClient(); > 3 var options = client.getOptions(); > 4 var authenticator = new > org.apache.axis2.transport.http.HttpTransportProperties.Authenticator(); > 5 authenticator.setUsername(username); > 6 authenticator.setPassword(password); > 7 authenticator.setPreemptiveAuthentication(true); > 8 > options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, > authenticator); > 9 client.setOptions(options); > > 10 var dsName = "WSO2_STAT_DB"; > > 11 var dataSource = > stub.getDataSource(dsName).getDsMetaInfo().getDefinition().getDsXMLConfiguration(); > 12 //var dataSource = > <configuration><url>https://localhost:9445</url><username>admin</username><password>admin</password><driverClassName>com.mysql.jdbc.Driver</driverClassName></configuration>; > 13 var dataSourceXml = new XML(dataSource); > > Above code gives below error. > > [2015-02-26 22:09:57,153] ERROR - RhinoEngine > org.mozilla.javascript.EvaluatorException: The choice of Java method > java.lang.String.replace matching JavaScript argument types (function,string) > is ambiguous; candidate methods are: > class java.lang.String > replace(java.lang.CharSequence,java.lang.CharSequence) > class java.lang.String replace(char,char) (xml#4) > [2015-02-26 22:09:57,153] ERROR - WebAppManager > org.mozilla.javascript.EvaluatorException: The choice of Java method > java.lang.String.replace matching JavaScript argument types (function,string) > is ambiguous; candidate methods are: > class java.lang.String > replace(java.lang.CharSequence,java.lang.CharSequence) > class java.lang.String replace(char,char) (xml#4) > org.jaggeryjs.scriptengine.exceptions.ScriptException: > org.mozilla.javascript.EvaluatorException: The choice of Java method > java.lang.String.replace matching JavaScript argument types (function,string) > is ambiguous; candidate methods are: > class java.lang.String > replace(java.lang.CharSequence,java.lang.CharSequence) > class java.lang.String replace(char,char) (xml#4) > > > If I uncomment *line 12* and comment *line 11*, I don't get above error. > but if I log both lines (11 and 12), they still give the same output. How > do I get *line 11 *working like *line 12*? > > Thanks, > Bhathiya > > > > > > var dataSourceXml = new XML("'" + dataSource + "'"); > > > -- > *Bhathiya Jayasekara* > *Software Engineer,* > *WSO2 inc., http://wso2.com <http://wso2.com>* > > *Phone: +94715478185 <%2B94715478185>* > *LinkedIn: http://www.linkedin.com/in/bhathiyaj > <http://www.linkedin.com/in/bhathiyaj>* > *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>* > *Blog: http://movingaheadblog.blogspot.com > <http://movingaheadblog.blogspot.com/>* > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Rajith Vitharana Software Engineer, WSO2 Inc. : wso2.com Mobile : +94715883223 Blog : http://lankavitharana.blogspot.com/
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
