1 2 Previous Next 15 Replies Latest reply on Aug 29, 2011 2:45 PM by Keith Babo

    XML Validation in Eclipse

    Rob Cernich Master

      Hey 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:

      1. The catalog file (attached)
      2. Add the catalog file to Eclipse's XML catalog (preferences, XML->XML Catalog, Add..., Next Catalog).
      3. Disable "Honour all XML schema locations" (preferences, XML->XML Files->Validation).  (If you're getting weird validation errors, this setting is probably enabled.)
      4. 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

        1 2 Previous Next