What is XML Sapiens

    In 1995, Vignette introduced the first commercial CMS (content management system) to the market. Since then, the number of commercial CMS has been growing steadily and now the term CMS has taken root in the market and, as a rule, does not require decryption. In recent years, many open standards have been approved that allow you to structure information on sites, separate it from design, but, as before, most CMS do not follow them. So for many years there is an XSLT standard that allows the formation of documents from shared sources: an XML file with structured document content and an XSL template with a description of how the document will be presented on the site.

    Moreover, the formation of the document itself can occur on the client side. It is enough to pass to the browser an XML data structure containing a link to the XSL template and the browser itself will "draw" the page in the form as intended by the designers. The content of each page on the site varies, but the form for submitting this content is usually limited to a small number of templates. Thus, XSLT allows us to use the written data presentation template on the website once. It would seem that here it is an ideal technology for CMS. However, the widespread use of this technology is constrained by a number of factors. Of these, psychological inertia is not the dominant factor. Describing site functionality using XSLT is a very time-consuming task. Also, the XSL template is too dependent on the XML data document,

    Thus, XSLT is a conceptually flawless, but in practice time-consuming solution. This circumstance encourages developers to seek new solutions that include the benefits of approved open standards and, at the same time, are relatively convenient to use. One such solution is the declarative XML language Sapiens (www.xmlsapiens.org).

    How XML Sapiens Works



    Like XSLT, a specific template must be associated with each site document. A template can contain any presentation code (such as HTML) and XML Sapiens instructions. Several files may be included in the template. To do this, use the sapi: include instruction, which is close to the analogue in the open xInclude standard.



    Other XML Sapiens instructions deliver content and function blocks to a document.

    The purpose of this decision is to share a description of the structures of content and functionality. This allows you to once create a certain set of wireframes of the structures of content and functionality and in the future use it as a constructor when building a site.

    XML Sapiens and Data



    XML Sapiens includes such a concept as interface state. This allows you to define different data sets for the same page on the site depending on external or specified conditions. Suppose if a user is authorized on the site, the page may contain some content fields, if others are not authorized. The states of the page content field set are defined in a separate XML document. In order to apply the set, it is enough to enable the set for the specified state: The



    set of fields contains data delivery instructions. These instructions associate the specified data identifier with the field type described in the external XML document.



    An XML document of a field type, as in the case of a set of fields, can contain type descriptions for various interface states. If the states “administration” and “content delivery” are defined in the system, then in the first case the data can be presented in the form of a content request, in the second “as is”.

    Content Markup

    XML Sapiens and Functionality



    The page template may also contain instructions for requesting a script for functionality. The algorithm for this scenario is described in the specified XML file.



    The Functional Algorithm Description (DDC) document contains instructions for analyzing conditions, similar to XSLT. The DDC syntax also allows you to reference CMS applications, which, according to the parameters passed, return data streams for further analysis of the conditions. When requesting a functional script, it is possible to specify the request parameters; it allows multiple use of functional scenarios.




      
      
        
            value1
            value2
        

        Records not found
        CMS-application error

        
          
            
            Sample code, &this.this.переменная_из_потока_данных.value;
            

          

        

      









      value1
      value2



    Functional Markup

    As you can see, XML Sapiens allows you to prepare a set of descriptions of data structures, types of content fields and functionality and to use them later in the construction of the site. The ability to reuse these components reduces the development time of web projects, avoids system programming. Moreover, XML Sapiens is universal. It can be used in CMS written in any programming language.

    The language has existed for more than a year, and a second version of the language has recently been published. This inspires hope that the language will continue to be developed and used. Today, only a few CMSs operate on the basis of this language. However, if this number increases, the exchange of functional solutions between developers using different CMSs may become commonplace.

    Also popular now: