Skip to content

Instantly share code, notes, and snippets.

@torstenwerner
Last active February 2, 2017 08:49
Show Gist options
  • Save torstenwerner/4fdd48c3d46a114b3ad1a8bd38735287 to your computer and use it in GitHub Desktop.
Save torstenwerner/4fdd48c3d46a114b3ad1a8bd38735287 to your computer and use it in GitHub Desktop.
/**
* Simple Xml validation using the joox library.
*/
@Grapes(
@Grab(group = 'org.jooq', module = 'joox', version = '1.4.0')
)
import static org.joox.JOOX.*
def document = $(new File('instance-xs11.xml'))
def match = $(document).namespace('ch', 'http://choice.egal').xpath('//ch:Ort[string-length() < 3]')
if (match.empty) {
println('Erfolg!')
} else {
println('Ort muss mindestens 3 Zeichen haben.')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment