XML Validation in Eclipse
rcernich Aug 29, 2011 2:46 AMHey all,
I've been able to put together an XML catalog to support validation of SwitchYard schema and configuration files within Eclipse. In order to accomplish this, I needed to remove the "schemaLocation" attributes from all SwitchYard schema files. (For whatever reason, Eclipse persisted in using these values, even though the use of "public" id's was preferred in the catalog.) This forced a minor change to Descriptor.java to so it could resolve schema resources when systemId was null. (Note, Descriptor.getSchema() functionality is still driven by the information in the descriptor.properties files.)
I've committed the changes to my repo's on github for review.
https://github.com/rcernich/core/tree/xml_validation
https://github.com/rcernich/components/tree/xml_validation
Once you've got the updated source, you should be able to use the XML validation capabilities within Eclipse to validate schema and configuration files. To do this, you will need:
- The catalog file (attached)
- Add the catalog file to Eclipse's XML catalog (preferences, XML->XML Catalog, Add..., Next Catalog).
- Disable "Honour all XML schema locations" (preferences, XML->XML Files->Validation). (If you're getting weird validation errors, this setting is probably enabled.)
- Select a file or folder, right-click, Validate.
The above assumes you have the projects containing the schema in your workspace (e.g. switchyard-config, switchyard-transform, switchyard-component-bean, etc.). You don't need all the projects in your workspace, just the ones you want to use during validation (i.e. if you're just working with beans, you don't need the other component projects).
There is also a forthcoming Eclipse plug-in which will contain all the schema and automatically register the catalog with Eclipse. (Theoretically, you should be able to use the plug-in for everything, except when you are editing the schema, in which case you'll want to use the attached file to make sure you're pulling in the projects' schema.)
Any and all feedback is welcome.
Rob
Message was edited by: Rob Cernich Updated attachment: switchyard_catalog.xml
-
switchyard_catalog.xml 5.5 KB