Using Code Completion in XML Files Constrained by an XML Catalog

See Also

You can use an XML catalog that is registered in the IDE to constrain an XML instance document.

To use an XML catalog to constrain a new XML document:

  1. In the IDE, open the Services window.
  2. Expand the DTD and XML Schema Catalogs node, then expand the catalog node, right-click the catalog entry node and choose View.
    The Source Editor opens the catalog entry in read-only mode.
  3. Make a note of the targetNamespace value (schema-targetNamespace) and the root or top-level element (schema-root-element) in the schema.
  4. In the IDE, create a new XML document by doing the following:
    1. From the main menu, choose File > New File.
      The New File wizard opens.
    2. Under Categories, select the XML node and under File Types, select the XML Document node, then click Next.
    3. Specify a name and location for the document and click Next.
    4. Select the XML Schema-Constrained Document radio button and click Next.
    5. In the Schema Options page of the wizard, click Finish without completing any of the fields.
      The IDE creates the new XML document in the specified location.
  5. In the XML document, select the root tag,
    <root xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
      xsi:noNamespaceSchemaLocation='null'>
    
    </root>
    
    and replace it with the following:
    <schema-root-element
      xmlns:prefix='schema-targetNamespace'
      xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
      xsi:schemaLocation='schema-targetNamespace schema-targetNamespace'>
    
    </schema-root-element>
    
  6. In the Source Editor tab of the XML document, position the cursor where you want to start adding content and type an opening left angle bracket (<).
    The code completion box opens. This box provides a scrolling list of schema elements. The list of elements is based on the XML schema from the XML catalog that constrains the XML instance document.
See Also
Registering a Local DTD or XML Schema Resource
About Using Code Completion in XML Instance Documents Constrained by XML Schema
About XML Schema Tools

Legal Notices