Optimizing the Page XML Data

Top  Previous  Next

When we refer to XML nodes as we construct the dynamic elements in a page generally we use the following notation

/datasource/node1/node2/...

 

When we use the "/" character as the node delimiter MoreMotion AF includes all the nodes and their sub-nodes in a datasource regardless of we really need them all.

For example if we use definitions $vof(/products/count) and $vof(/request/pg) in a page the XML sent by MoreMotion AF will be more or less as the following.

 

 <root>

   <products>

     <query-type>node</query-type>

     <count>54</count>

     <dbname>Computer_Shop</dbname>

     <item uid="58">

       <Name>COMPAQ 6400R SERVER</Name>

       <Price>8190 USD</Price>

       <Stock>1</Stock>

     </item>

     <item uid="56">

       <Name>COMPAQ ML370 SERVER</Name>

       <Price>2646 USD</Price>

       <Stock>1</Stock>

     </item>

   </products>

   <request>

     <pg>Products</pg>

     <Method>GET</Method>

     <Protocol>HTTP/1.1</Protocol>

     <QueryString>pg=Page1</QueryString>

     <RemoteAddr>127.0.0.1</RemoteAddr>

     <RemoteHost>127.0.0.1</RemoteHost>

     <RemoteUser/>

     <RequestURI>/display.doms</RequestURI>

     <RequestedSessionId/>

     <Scheme>http</Scheme>

     <getServletPath>/display.doms</getServletPath>

   </request>

 </root>

 

Don't you think it's a bit to much?

Use "." instead of "/" as the node separator.

If we use "." as the node separator, for instance $vof(/products.count) and $vof(/request.pg), the result would be:

 

 <root>

   <products>

     <count>54</count>

   </products>

   <request>

     <pg>Products</pg>

   </request>

 </root>