COREmanager Documentation

XML structure description

 

COREmanager uses an XML format to interact with external applications and transfer data withing the system. Very often you may need to merge several XML documents into one, e.g. when you add custom XML files for plug-ins. There is a special file, which describes merging of files. Not only nodes of different XML, but also nodes with similar key attributes will be merged according to specified rules.

Files that describe the rules should locate in the etc/xml/schema directory

The following is a number of rules (you view the full list in the above directory):

<?xml version="1.0" encoding="utf-8"?>
<schema xmlns="http://www.w3.org/1999/xhtml" xmlns:isp="http://ispsystem.com/schema">
  <metadata key="name" merge="xml" top="yes">
    <include key="name" merge="replace"/>
    <toolbar merge="xml">
      <toolsep merge="no"/>
      <toolbtn key="name" merge="xml" share="toolbtn">
        <show key="name value" merge="replace"/>
        <hide key="name value" merge="replace" share="toolbtn_hide"/>
      </toolbtn>
      <toolgrp key="name" merge="xml">
	 <isp:include name="toolbtn"/>
      </toolgrp>
    </toolbar>
</schema>


The root schema node includes nodes with similar names as in our XML files. Attributes of those nodes set the rules to merge them while merging XML documents:

the key attribute specifies a list of key attributes (several names space separated). Nodes with similar names and key attributes will be merged. As a result, a new element will combine attributes and child elements. Nodes that were added later, have priority. Example: when merging the following nodes with the key @name, the attribute value is second, as the element with this name was met later:

<toolbtn name="test" value="first"/>
<toolbtn name="test" value="second"/>
the merge attribute merging types. Possible values:
  • ignore - do not merge nodes with that name (the @key attribute won't be analyzed). Such nodes are inserted into the resulting XML without changes.
  • no - do not merge nodes with that name (the @key attribute won't be analyzed). Unlike ignore, child nodes will be reviewed and merged, if required.
  • text - merge contents of nodes. Contents of child nodes will be added to existing. Attributes will be also merged.
  • replace - replace nodes. The last nodes in the XML will fully replace previous versions.
  • xml - merge. Attributes values and nodes contents will be merged. All child text nodes will be deleted.

the root attribute, if it's value, is "yes". The element with such a name can be the root node of an XML document.the share attribute indicates that this rule can be used later in other context using the isp:include node.the isp include attribute add the rules marked @share into the context. In the @ame attribute, you should specify the value that was used for the @share attribute. The element with the corresponding @share attribute should locate in the XML before it is used with isp:include.