blob: 67da2d11eec3b9ca848e562e94087e9f10e17db2 [file] [log] [blame]
package groovy.xml
class MixedMarkupTestSupport {
private static def mixedXml = '''
<p>Please read the <a href="index.html">Home</a> page</p>
'''
static void checkMixedMarkup(Closure getRoot) {
def root = getRoot(mixedXml)
assert root != null
def children = root.children()
if (isSlurper(root)) {
assert children.size() == 1
assert children[0].name() == 'a'
} else {
assert children.size() == 3
assert children[1].name() == 'a'
assert children[2].toString() == 'page'
}
}
private static boolean isSlurper(node) {
return node.getClass().name.contains('slurper')
}
private static boolean isParser(node) {
return (node instanceof groovy.util.Node)
}
private static boolean isDom(node) {
return node.getClass().name.contains('Element')
}
}