So basically we currently have this for validating against internal XSDs: def factory = SAXParser Instance() factory.validating = true factory.namespace Aware = true SAXParser sax = SAXParser() Property( " //com/xml/jaxp/properties/schema Language" , XMLConstants.
W3C_XML_SCHEMA_NS_URI) def parser = new Xml Parser(sax) which could be shortened to something like: def parser = new Xml Parser(Xml Util.default Schema Validating Parser()) Incidentally, we still need an error handler in either case: parser.error Handler = as Error Handler For validating against an external XSD we currently have: def schema Factory = Schema Instance(XMLConstants.
Refer to the Servlet API's javadocs for further information.
I did indeed mean that using an XML Schema should be easier.
The above proposal seem to take us on the right direction.
parser=new Xml Slurper() Feature(" false) Feature(" false); parser.parse(it) Even though your HTML also happens to be well-formed XML, a more general solution for parsing HTML is use a true HTML parser.
I've used the Tag Soup parser in the past, and it handles real-world HTML quite well.
I'm going to create a very simple example to unmarshall a given object instance to XML.