[Request] allow importing groovy.util.slurpersupport.NodeChildren / Child

See the title.

I'm trying to put @CompileStatic on some of the methods in my Sonos Advanced app but need to import groovy.util.slurpersupport.NodeChildren to work with the XML, as well as a few others.

We can already import groovy.xml.slurpersupport.GPathResult, but none of the subclasses for it.

Complete list:

groovy.xml.slurpersupport.Attribute
groovy.xml.slurpersupport.NoChildren
groovy.xml.slurpersupport.NodeChild
groovy.util.slurpersupport.NodeChildren

The Sonos Advanced App is pretty heavy, and on an active Sonos system ends up needing to process thousands of XML file an hour, so every bit of speed I can get is good. Plus then I can have better type safety on this code.

Tagging @gopher.ny for awareness. Based on some previous posts, it seems that this is perhaps your wheelhouse?

3 Likes

I've got a few ways. Here's an example of a helper function I have specifically to build out a list of params for asynchttpget:

@CompileStatic
Map getSoapActionParams(String deviceIp, Map service, String action, Map controlValues = null) {
  String body = getBaseControlXML(service, action, controlValues)
  String uri = "http://${deviceIp}${service.controlURL}"
  String soapAction = "${service.serviceType}#${action}"
  return [
      uri: uri,
      headers: [SOAPAction: soapAction],
      contentType: 'text/xml',
      body: body
    ]
}
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.