Adding entries to the XML Catalog

XML Catalog entries are used to map external entity references to locally defined resources. You can provide rules specify how these entities are resolved

For details on the standard for XML Catalogs, see: http://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html.

For example: you are working on an XML file on a computer and point its schemaLocation towards a schema called c:\MySchema.xsd. If you do not use an XML catalog, then when you finish editing the XML file and are ready to publish it on the Web, you will need to edit schemaLocation so that it points to a resource that is accessible on the Web.

To avoid making frequent changes to your XML document, you can use the XML Catalog: you could specify a rule that redirects an Internet resource reference (for example, "http://www.ibm.com/published-schemas/MySchema.xsd") so that it points to a resource on the local machine (for example, "file:///C:/MySchema.xsd"). In plaats van het regelmatig bewerken van XML-documenten om de URI's of locaties bij te werken (vooral als uw project veel documenten bevat) hoeft u slechts één regel in uw XML-catalogus bij te werken.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

Als u een gegeven aan de XML-catalogus wilt toevoegen, volgt u de volgende stappen.

  1. Open the XML file that you want to associate with a DTD or XML schema.
  2. Click Window > Preferences and select XML > XML Catalog. Het gedeelte XML-catalogusitems bevat een lijst van alle door de gebruiker of een plugin gedefinieerde catalogusitems. Selecteer een item om de bijbehorende informatie te bekijken in het gedeelte Details
  3. Click Add to create a new catalog entry.
  4. In the left-hand column, click the type of catalog entry that you want to add:
    Optie Description
    Catalogusvermelding Used by an XML processor when resolving entity references. You can provide rules to the catalog to specify how entities should be resolved.
    An XML Catalog entry contains two parts:
    • A key (which represents a DTD or XML schema)
    • A location (similar to a URI, which contains information about a DTD or XML schema's location).
    U kunt de sleutel in een XML-bestand plaatsen. When the XML processor encounters it, it will use the XML Catalog entry to find the location of the DTD or XML schema associated with the Key
    Rewrite Entry Used to redirect a set of entities.
    Suffix Entry Used to match the suffix of a URI or systemID.
    Volgende catalogus Used to refer to another catalog without importing it into the workbench.
    Delegate Catalog Used to associate an alternate catalog with an identifier.
  5. Complete the fields for the catalog entry that you selected:
    Tabel 1. Catalog entry types and associated fields
    Catalog type Fields
    Catalogusvermelding
    • In het veld Locatie geeft u de locatie of URI op van het DTD-bestand of XML-schemabestand. Geef de locatie van het bestand op volgens de gangbare notatie op uw computer.
    • Select a Key Type:
      • Als u een DTD-bestand hebt opgegeven: selecteer Openbaar ID, Systeem-ID of URI in het veld Type sleutel. If you select Public ID, the value you enter in the Key field should be the same as the Public ID in the XML file's DOCTYPE declaration. If you select System ID, the value you enter should correspond to the System ID in an XML file's DOCTYPE declaration. Als u URI selecteert, dient u een volledig gekwalificeerde URI op te geven.
      • Als u een XML-schema hebt opgegeven: selecteer Naam naamruimte of Schemalocatie in het veld Type sleutel. Als het schema een doelnaamruimte definieert, verschijnt deze automatisch in het veld Sleutel. Anders kunt u de schemalocatie invullen in het veld Sleutel.
    • Select the Specify alternative Web address check box if you want to be able to specify an alternate Web address for the resource.
      Dit internetadres wordt gebruikt als er een XML-instance van dit catalogusitem wordt gegenereerd.
      Note: This option is only available if you select Public ID (for a DTD) or Namespace Name (for a schema) in the Key type field.
    Rewrite Entry
    • Select a Key type to match, either URI or systemID.
    • Matching start string: The matching prefix to be removed from the supplied identifier.
    • Rewrite prefix: The prefix is be used instead of the prefix that is removed.
    Suffix Entry
    • In het veld Locatie geeft u de locatie of URI op van het DTD-bestand of XML-schemabestand. Geef de locatie van het bestand op volgens de gangbare notatie op uw computer.
    • Select a Key Type (URI or systemID) to match.
    • Type the Suffix of the identifier to match.
    Volgende catalogus In the Location of another XML Catalog file field, type or browse for the XML catalog you want to refer to.
    Delegate Catalog
    • Select a Key type to match, either URI or systemID.
    • Matching start string: The prefix of the supplied identifier to match.
    • Delegate to this XML file: The alternate catalog to associate.
  6. When you are done creating catalog entries, click OK to close the Add XML Catalog Entry dialog. Click OK again to save your settings.
  7. Make sure the XML file is in focus and click the Reload dependencies toolbar button.
Het XML-bestand is nu gekoppeld aan de laatste versie van het XML-schema of de DTD.

U kunt XML-catalogusinformatie ook exporteren en importeren:

To export, click File > Export and select XML > XML Catalog. U wordt gevraagd om een project te selecteren en een bestandsnaam op te geven om uw catalogusitems op te slaan in een .xmlcatalog-bestand, dat kan worden geopend vanuit de view Navigator. Omdat uw catalogusitems worden opgeslagen in een .xmlcatalog-bestand, kunt u ze in- en uitchecken en net als elke andere projectresource gemeenschappelijk gebruiken.

To import, click File > Import and select XML > XML Catalog . Vervolgens selecteert u het bestand dat u wilt gebruiken voor het laden van de XML-catalogusinstellingen. When you import a .xmlcatalog file, any entries in it will be loaded into the XML Catalog (and any existing entries will be overwritten).

Verwante concepten
XML file associations with DTDs and XML schemas
Verwante taken
Editing with DTD or XML schema constraints
Editing DOCTYPE declarations
Updating XML files with changes made to DTDs and schemas
Editing namespace information