0
votes

I'm trying to access all nodes of my request in XML format using XmlHolder class with getDomNodes method and when I try it it getting this error.

Can somebody explain what does this mean?

My source code:

import com.eviware.soapui.support.XmlHolder

log.info "hello !! welcome to " 
def holder = new XmlHolder(context.expand('${logIn - Request 1#request}') 
def allnodes = holder.getDomNodes("//LoginParameters_1")

The error I get:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script15.groovy: 6: unexpected token: def @ line 6, column 1. def allnodes = holder.getDomNodes("//LoginParameters_1")throws org.apache.xmlbeans.XmlException ^ org.codehaus.groovy.syntax.SyntaxException: unexpected token: def @ line 6, column 1. at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:140) at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:108) at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236) at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:162) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:912) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:574) at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:550)...


  import com.eviware.soapui.support.XmlHolder import          com.eviware.soapui.support.xml.XmlUtils          
  log.info "hello !! welcome to " xmlu= new XmlUtils() 
  holder= new XmlHolder(context.expand('${logIn - Request 1#request}'))
  i=0 
  for (nodes in holder.getDomNodes("//wsos:logIn")) {       if(xmlu.getNodeValue(nodes[i])=="?") 
   xmlu.setNodeValue(nodes[i],"") 
     i++; 
  }

is giving me below error: groovy.lang.MissingMethodException: No signature of method: org.apache.xmlbeans.impl.store.Xobj$ElementXobj.getAt() is applicable for argument types: (java.lang.Integer) values: [0] Possible solutions: getAt(java.lang.String), item(int), putAt(java.lang.String, java.lang.Object), wait(), grep(), getClass() error at line: 16

1

1 Answers

0
votes

The org.codehaus.groovy.syntax.SyntaxException are related with incorrect syntax in the code, in your specific case the problem is a missing closed parenthesis:

A ) is missing to close XmlHolder declaration:

def holder = new XmlHolder(context.expand('${logIn - Request 1#request}')

Must be:

def holder = new XmlHolder(context.expand('${logIn - Request 1#request}'))
                                                                         ^ missing close