Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2005

XMLSlurper with Cyberneko, does not find children

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.0
    • 1.1-beta-3
    • None
    • None
    • Groovy: 1.0
      JVM:1.5.0_06-b05

    Description

      Here is a simple script that parses a simple web page :

      def xmlSlurper = new XmlSlurper(new org.cyberneko.html.parsers.SAXParser())
      def htmlNode = xmlSlurper.parseText("<html><body><hr/><hr/></body></html>");
      def bodyNode = htmlNode.body
      println bodyNode.children().size()
      

      When executed, it prints "0".
      The body node contains two children nodes, so it should print "2".

      It prints "2" if you use the default parser (by removing the slurper's constructor argument in the script above).

      Notes:

      • It is not a duplicate of bug #GROOVY-1763, as here it works with the default parser.
      • There is no workaround, I will have to parse non-valid web pages, so I must use Cyberneko and not the default parser.

      Attachments

        Activity

          People

            paulk Paul King
            nicolas raoul Nicolas Raoul
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: