XML

XML content
admin's picture

General XML

This document describes only some general information about XML. It is very short description, for better understanding you should find some other resources.

admin's picture

XML rules

  1. XML document must contain one or more elements
 
  1. There is exactly one element, called the root, or document element, no part of which appears in the content of any other element
 
  1. The name in an element's end-tag must match the element type in the start-tag. Names are case-sensitive
 
  1. If the start-tag is in the content of another element, the end-tag is in the content of the same element. More simply stated, the elements, delimited by start- and end-tags, nest properly within each other
 
  1. The end of every element that begins with a start-tag must be marked by an end-tag containing a name that echoes the element's type as given in the start-tag. The text between the start-tag and end-tag is called the element's content. An element without content can take a special form: <name/> . The slash before > substitutes the end tag
 
  1. Element names can contain letters, digits, hyphens, underscores, colons, or full stops
 
    • A colon can be used only in a special case where it separates so called namespace. Element names starting with xml, XML or other combination of cases of this string are reserved for the standard
    • Names cannot start with a number or punctuation character
    • Names cannot start with the letters xml (or XML, or Xml, etc)
    • Names cannot contain spaces
    • Element names starting with xml, XML or other combination of cases of this string are reserved for the standard
 
  1. An element can have none, one or several attributes. Permitted characters are the same as for element names. The name of attribute is separated from its value by =. The attribute value must be given inside apostrophes '...' or double-quotes "..." . If an apostrophe or double-quote is used in the attribute value the opposite delimiter must be used
 
  1. Characters < and & cannot be used in text as they are used in markup. If these characters are needed &lt; must be used insted of < and &amp; instead of &
 
  1. Characters >, " , and ' can be also substituted by &gt; , &quot; and &apos; , respectively
 
  1. Comments may appear anywhere in a document outside other markup. An XML processor may, but need not, make it possible for an application to retrieve the text of comments. The string "--" (double-hyphen) must not occur within comments.   <! -- This is a comment -- >
 
  1. Processing instructions (PIs) allow documents to contain instructions for applications
 
  1. CDATA sections are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string "<![CDATA[" and end with the string "]]>". The string ']]>' must not occur inside CDATA section
 
  1. XML documents may, and should, begin with an XML declaration which specifies the version of XML being used
 
 
 
admin's picture

XML node types

 
XML document can be shown as a tree.
The tree contains nodes. There are seven types of node:

  • root nodes
  • element nodes
  • text nodes
  • attribute nodes
  • namespace nodes
  • processing instruction nodes
  • comment nodes

For every type of node, there is a way of determining a string-value for a node of that type. For some types of node, the string-value is part of the node; for other types of node, the string-value is computed from the string-value of descendant nodes.

Root node

Each XML has exactly one single root element. This element is also known as the document element.
It is always the very first element in XML tree, just can be preceded by prolog line. See the example:
 
<?xml version="1.0" encoding="UTF-8"?>
<rootElement>
     <AAA/>
     <BBB/>
</rootElement>

 The root node is the root of the tree. A root node does not occur except as the root of the tree. The element node for the document processing instructions and comments that occur in the prolog and after the end of the document element.
The root node does not have an expanded-name.
Expanded name - Some types of node also have an expanded-name, which is a pair consisting of a local part and a namespace URI. The local part is a string. The namespace URI is either null or a string. The namespace URI specified in the XML document can be a URI reference, this means it can have a fragment identifier and can be relative. A relative URI should be resolved into an absolute URI during namespace processing: the namespace URIs of expanded-names of nodes in the data model should be absolute. Two expanded-names are equal if they have the same local part, and either both have a null namespace URI or both have non-null namespace URIs that are equal.

Element Nodes

The Element object represents an element in an XML document. Elements may contain attributes, other elements, or text. If an element contains text, the text is represented in a text-node.
<element attribute-name = "attribute-value">....</element>
 
 <element>
   <childElement>...   </childElement>
</element>
 
<element>anyText</element>
There is an element node for every element in the document. An element node has an expanded-name computed by expanding the QName of the element specified in the tag in accordance with the XML Namespaces Recommendation. The namespace URI of the element's expanded-name will be null if the /public_html/cgi-bin has no prefix and there is no applicable default namespace.

Text Nodes

Character data is grouped into text nodes. As much character data as possible is grouped into each text node: a text node never has an immediately following or preceding sibling that is a text node. The string-value of a text node is the character data. A text node always has at least one character of data.

Attribute Nodes

Each element node has an associated set of attribute nodes; the element is the parent of each of these attribute nodes; however, an attribute node is not a child of its parent element.
 <element attribute-name = "attribute-value">....</element>

 Namespace Nodes

Each element has an associated set of namespace nodes, one for each distinct namespace prefix that is in scope for the element (including the xml prefix, which is implicitly declared by the XML Namespaces Recommendation and one for the default namespace if one is in scope for the element. The element is the parent of each of these namespace nodes; however, a namespace node is not a child of its parent element. Elements never share namespace nodes: if one element node is not the same node as another element node, then none of the namespace nodes of the one element node will be the same node as the namespace nodes of another element node.
 <?xml version="1.0" encoding="UTF-8"?>
<html      
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xf="http://www.w3.org/2002/01/xforms"
      xmlns:xlink="http://www.w3.org/1999/xlink"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:scixf="http://www.sterlingcommerce.com/xforms/xforms-extensions" xmlns:r="http://www.sterlingcommerce.com/xforms/request">
      <head>     
            <xf:model id="model">
                  <xf:instance xlink:href="/webx/bp/BKT_testRunBP"></xf:instance>
<xf:bind id="ime" ref="/tempXML/IME" isValid="string-length(.) &gt; 4 " scixf:reason="Upozorenje: String ime mora biti duzi od 4 znaka!"/>
 
            </xf:model>
</head>
      <body>
            <xf:group id="xform-body">
            <xf:caption>Upisite ime: </xf:caption>
                  <xf:input ref="tempXML/IME">
                        <xf:caption>Upisite ime: </xf:caption>
                        <xf:hint>Ovdje morate upisati ime!</xf:hint>
                  </xf:input>
                  <br/>
                  ...
</html> 

Processing Instruction Nodes

There is a processing instruction node for every processing instruction, except for any processing instruction that occurs within the document type declaration. The XML declaration is not a processing instruction. Therefore, there is no processing instruction node corresponding to the XML declaration.
Processing Instructions are information for the application. PI's allow documents to contain instructions for applications. They are not really of interest to the XML parser. Instead, the instructions are passed to the application using the parser, because the purpose of processing instructions is to represent special instructions for the application.
 
<?name pidata?>
 <?xml version="1.0"? encoding="UTF-8" standalone="yes"?>

 Comment Nodes

A comment is used to leave a note or to temporarily edit out a portion of XML code. Although XML is supposed to be self-describing data, you may still come across some instances where an XML comment might be necessary.
The syntax for writing comments in XML is similar to that of HTML.
<!-- This is a comment -->
 
A comment node does not have an expanded-name

admin's picture

XML introduction

  • XML stands for EXtensible Markup Language
  • XML is a markup language much like HTML
  • XML was designed to describe data
  • XML nodes (tags) are not predefined. You must define your own tags
  • XML uses a Document Type Definition (DTD) or an XML Schema to describe the data
  • XML with a DTD or XML Schema is designed to be self-descriptive
  • XML is a W3C Recommendation (www.w3.org)
admin's picture

XML

Sterling Integrator is fully XML based, all services in Sterling Integrator comunicate with each other via XML messages, so we can say that bussines process in SI is set of exchanged XML messages.

admin's picture

Documents (SI, XML, EDI, protocols ...)

You can find 4 main groups of documents for now:

  • Communication protocols
  • Sterling Integrator
  • Sterling File Gateway
  • XML

We will try to cover some topics that beginners as well as advanced users can find useful.
If you have any suggestion about topics you would like to see explained or if you have any document you would like to share with Community, please let us know. 
Please, be aware that is not an official documentation, but documents written by users and published to be shared with you, so please tolerate mistakes that you can find.
 

Syndicate content