Importing and Viewing XML Schemas (for Virtual Documents)
When using XML documents as virtual documents, you usually need to import the corresponding XML schemas into InterSystems IRIS® data platform. This topic describes how to do so, as well as how to view the XML schemas.
Introduction
When using XML documents as virtual documents, you should import the corresponding XML schemas into InterSystems IRIS. After doing so, you can define data transformations and specify schema-dependent property paths if needed.
You can use these schemas only to support processing of XML virtual documents as described in this documentation. InterSystems IRIS does not use them for any other purpose.
Also:
-
When reading XML documents, InterSystems IRIS removes the XML declaration, all processing instructions, and all comments.
-
If the name of an element or attribute includes a period (.), InterSystems IRIS replaces that with a tilde (~).
For example, an XML element named My.Element appears as My~Element in InterSystems IRIS.
-
InterSystems IRIS does not support XML schemas in which an element is defined via a reference (ref) to a type in the schema. Instead of ref, use type. For example, consider the following fragment of a schema:
<xs:element name="test1" ref="sometype"></xs:element> <xs:element name="test2" type="sometype"></xs:element>
When this schema is imported, the element test1 will not be fully defined, because this form of top-level element definition is not supported. The schema viewer, for example, will not show the full element type for test1. In contrast, test2 will appear in the schema as expected.
This limitation applies only to schemas used with XML virtual documents
Using the XML Schema Structures Page
The Interoperability > Interoperate > XML > XML Schema Structures page enables you to import and view XML schema specifications.
For general information on using this page, see Using the Schema Structures Page.
Before importing a schema file, rename it so that its name is informative and unique within this namespace. The filename is used as the schema category name in the Management Portal and elsewhere. If the filename ends with the file extension .xsd, the file extension is omitted from the schema category name. Otherwise the file extension is included in the name.
After importing a schema file, do not remove the file from its current location in the file system. The XML parser uses the schema file rather than the schema stored in the InterSystems IRIS database.
Using the XML Document Viewer Page
The Interoperability > Interoperate > XML > XML Document Viewer page enables you to display XML documents, parsing them in different ways, so that you can determine which DocType to use. You can also test transformations. The documents can be external files or documents from the production message archives.
To display this page, click Interoperability, click Interoperate, click XML. Then click XML Document Viewer and click Go.
For general information on using this page, see Using the Document Viewer Page.
Importing XML Schemas Programmatically
You can also load schemas programmatically by using the EnsLib.EDI.XML.SchemaXSDOpens in a new tab class directly. This class provides the Import() class method. The first argument to this method is the name of the file to import, including its full directory path. For example:
set status= ##class(EnsLib.EDI.XML.SchemaXSD).Import("c:\iiris\myapp.xsd")
The EnsLib.EDI.XML.SchemaXSDOpens in a new tab class also provides the ImportFiles() method. For this method, you can specify the first argument in either of the following ways:
-
As the name of a directory to import files from. InterSystems IRIS attempts to import all files in this directory, regardless of the file extensions. For example:
set status=##class(EnsLib.EDI.XML.SchemaXSD).ImportFiles("c:\iiris\")
-
As a list of filenames, separated by semicolons. You must include the full directory path for the first of these, and you can use wildcards in the filenames. For example:
set status=##class(EnsLib.EDI.XML.SchemaXSD).ImportFiles("c:\iiris\*.xsd;*.XSD")
For more information, see the class reference for EnsLib.EDI.XML.SchemaXSDOpens in a new tab.
After importing a schema file, do not remove the file from its current location in the file system. The XML parser uses the schema file rather than the schema stored in the InterSystems IRIS database.