×
Menu
Index

XML adressering

 

In SoftRules® all is XML. It reads an XML document and it returns an XML document. Inside it works with an input XML and an output XML. It's necessary to understand how to find your way inside a large XML document that contains elements in a certain hierarchy and or have multiple instances of these elements. To be able to read or write the correct elements you have to have knowledge of the way that SoftRules® handles addressing.
 

The Product

The first ankerpoint is the Product. SoftRules® can only enrich an XML document if the business rules to do this are stored in a Product.
 
 
 
In the above example a Product is added with a path CustomerDocument/Contract{1}.
 
 
All Tools below this Product will default to this path. We call this the context. Suppose the input XML looks like this (conform the Schema in the ElementTable). The Context in het Product is highlighted in blue.
 
<CustomerDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://SoftRules.com/CustomerDocument.xsd">
     <CustomerWrapper>
          <Insured>
               <ID>69866</ID>
               <Firstname>John</Firstname>
               <SirName>Tapscott</SirName>
               <Street>Steele Street</Street>
               <HouseNumber>1362</HouseNumber>
               <Zipcode>60187</Zipcode>
               <Town>Wheaton</Town>
               <EmailAdress>jtapscott@softrules.com</EmailAdress>
          </Insured>
     </CustomerWrapper>
     <Contract>
          <Policy>
               <MotorVehicle>
                    <Driver>
                         <Firstname/>
                         <SirName/>
                         <Street/>
                         <HouseNumber/>
                         <Zipcode/>
                         <Town/>
                         <EmailAdress/>
                    </Driver>
               </MotorVehicle>
          </Policy>
     </Contract>
</CustomerDocument>
 
In the following examples the Driver elements are filled from the Insured by first using Absolute paths, next Relative paths. At the end there will be an example using Nodes.