Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4613 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

inspired by the XML transform found here I created a script to validate a XML against a XSD.

Enjoy.

Best,

Alexander

RegisterGroovy( "XMLXSDValidation( xmlString ; xsdString )" ; "import javax.xml.XMLConstants

import javax.xml.validation.SchemaFactory

import javax.xml.transform.stream.StreamSource



if( xmlString == null ) throw new Exception(\"You must supply a pathToXMLFile parameter\");

if( xsdString == null ) throw new Exception(\"You must supply a xsd parameter\");

def factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI)

def schema = factory.newSchema(new StreamSource(new StringReader(xsdString)))

def validator = schema.newValidator()

validator.validate(new StreamSource(new StringReader(xmlString)))" ; "isGui = false" )

Posted

For debugging I also use an editor, I use it actually in production to validate the xmls before I deliver them.

This topic is 4613 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.