Scope

  • The XML Editor can be used to validate XML documents against an XSD schema.
  • Additional functionality is available with XSD schemas that stick to the following prerequisites.

Capabilities

Root element detection

In order to make the XML Editor detect the root element of a schema add a the comment  <!-- root element --> just before the root element of the XSD schema.

Sample root element hint
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified"
           version="1.0">
	<!-- root element -->
	<xs:element name="Configurations">
		...
	</xs:element>
</xs:schema>

Annotations for documentation

  • XSD schema files can include the documentation of their elements that is displayed by the XML Editor. 
  • Provide <xs:annotation> elements for documentation.
    • Use a namespace that allows XHTML elements.
    • Restrict the use of XHTML elements to a small subset such as <p>, <br>, <ul>, <li>, <strong> etc. 

 

Sample annotation element
<xs:annotation>
	<xs:documentation>
		<div xmlns="http://www.w3.org/1999/xhtml">
			<strong>Notes</strong>
			<p>
				Account for authentication at one of the systems involved in file transfer, e.g. an FTP or SFTP server.
				Usually the account corresponds to a user name.
			</p>
        </div>
    </xs:documentation>
</xs:annotation>

Reference handling

  • References of elements of an XML document to other elements in the same document are supported by the XML Editor in a way that such references can be displayed as lists from which the user selects the reference entry.
  • The referenced element contains an <xs:key> element with a selector and a field reference to an element or attribute. The value of this element or attribute will be displayed as a list by the XML Editor.
  • The referencing element contains an <xs:keyref> element with a refer attribute that points to the <xs:key name="..."> attribute of the referenced element.

 

Sample for referenced XSD schema element attribute
<xs:key name="SFTPFragmentKey">
	<xs:selector xpath=".//SFTPFragment"/>
	<xs:field xpath="@name"/>
</xs:key>
Sample for referencing XSD schema element
<xs:keyref name="SFTPFragmentKeyRef" refer="SFTPFragmentKey">
      <xs:selector xpath=".//SFTPFragmentRef"/>
      <xs:field xpath="@ref"/>
</xs:keyref>
Sample XML document with reference handling
<Configurations xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/schema/jade/JADE_configuration_v1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Fragments>
        <ProtocolFragments>
            <SFTPFragment name="sftpFrag">
                ...
            </SFTPFragment>
        </ProtocolFragments>
    </Fragments>
    ...
    <Profile>
        <CopySourceFragmentRef>
            <SFTPFragmentRef ref="sftpFrag"/>
        </CopySourceFragmentRef>
    </Profile>
</Configurations>