Lab 1 - Create an XML catalog for a new DTD

During the lab, you will be creating and loading a new XML catalog for the troubleshooting DTDs. With the new DTD configured, Componize will be able to validate your troubleshooting files.

To complete the lab, you will need the two troubleshooting DTD files:
  • troubleshooting.dtd
  • troubleshooting.mod
  1. In the lab folder, create a new XML catalog file named catalog.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
      "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
    
    </catalog>
  2. Open the catalog.xml file in your favorite editor.
  3. Add a new group entry to the XML catalog file with an xml:base attribute that references the dtd/ directory using a relative path.
    <group xml:base="dtd/">
    
    </group>
  4. Add two public entries to the group entry:
    1. One to associate the "-//OASIS//DTD DITA Troubleshooting Samples//EN" public identifier with the troubleshooting.dtd file.
    2. Another to associate the "-//OASIS//ELEMENTS DITA Troubleshooting Samples//EN" public identifier with the troubleshooting.mod file.
    <group xml:base="dtd/">
      <public publicId="-//OASIS//DTD DITA Troubleshooting Samples//EN" uri="troubleshooting.dtd" />
      <public publicId="-//OASIS//ELEMENTS DITA Troubleshooting Samples//EN" uri="troubleshooting.mod" />
    </group>
  5. Save your changes.
  6. In the lab folder, create a new Spring context file named context.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    </beans>
  7. Open the context.xml file in your favorite editor.
  8. Create a new Catalog Loader bean.
  9. Add a location property to the Catalog Loader bean with the location of your XML catalog file.
    Property Type Mandatory Description
    location String Optional A catalog (URI as String) to be loaded.
    locations List <String> Optional List of catalogs (URIs as Strings) to be loaded.
    <bean id="samples.catalog" parent="catalog.loader.abstract">
      <property name="location" value="classpath:/com/componize/samples/01-catalog/catalog.xml" />
    </bean>
  10. Save your changes.
  11. Test your XML catalog with the com.componize.samples.lab01.CatalogTest unit test.
  12. Deploy your files to the application server.
  13. Once the application server has started, connect to the Alfresco Share interface.
  14. Remove the XML Validation aspect from the troubleshooting-sample.dita file and then add it back again.
    Note: Files are validated each time they are updated or when the XML Validation aspect is added. By removing and then adding the aspect back again, the file will be revalidated even though the content hasn't been changed.
The troubleshooting-sample.dita file should have been validated without errors.