Shibboleth XML Configuration file Validation
Mark O'Quinn
mark1oquinn at gmail.com
Thu Sep 20 18:04:54 EDT 2012
Hi everyone,
I trying to validate some of the xml files found in the configuration folder of shibboleth (e.g, relying-party.xml) using Xerces, XOM and javax.xml.* but when I load the xsd files mentioned in the relying-party.xml file, it keeps asking for more and more xsd files that are not mention in the previous xml file. So the question is, how do you guys validate the xmls in shibboleth, what is the class that does this in order to check the logic.
The code I'm using is this:
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(false);
factory.setNamespaceAware(true);
SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
factory.setSchema(schemaFactory.newSchema(new Source[]{ // <- After this line a SAXException is thrown saying: Cannot resolve the name '<some element>' to a(n) 'element declaration' component.
new StreamSource(this.getClass().getClassLoader().getResourceAsStream("schema/shibboleth-2.0-resource.xsd")),
new StreamSource(this.getClass().getClassLoader().getResourceAsStream("schema/shibboleth-2.0-services.xsd")),
new StreamSource(this.getClass().getClassLoader().getResourceAsStream("schema/saml-schema-metadata-2.0.xsd")),
new StreamSource(this.getClass().getClassLoader().getResourceAsStream("schema/shibboleth-2.0-relying-party.xsd")),
new StreamSource(this.getClass().getClassLoader().getResourceAsStream("schema/shibboleth-2.0-relying-party-saml.xsd")),
new StreamSource(this.getClass().getClassLoader().getResourceAsStream("schema/shibboleth-2.0-metadata.xsd")),
new StreamSource(this.getClass().getClassLoader().getResourceAsStream("schema/shibboleth-2.0-security.xsd")),
new StreamSource(this.getClass().getClassLoader().getResourceAsStream("schema/shibboleth-2.0-security-policy-saml.xsd")),
}));
SAXParser parser = factory.newSAXParser();
XMLReader reader = parser.getXMLReader();
Builder builder = new Builder(reader);
builder.build(new File("relying-party.xml"));
Thanks for all the help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20120920/4801cc0d/attachment.html
More information about the dev
mailing list