src/modules/xmlops/README
bf42fb7b
 XMLOPS Module
e9438550
 
 Daniel-Constantin Mierla
 
    asipto.com
    <miconda@gmail.com>
 
9cb2a163
    Copyright © 2009 asipto.com
      __________________________________________________________________
0577abba
 
    Table of Contents
 
    1. Admin Guide
 
         1. Overview
         2. Dependencies
 
               2.1. Kamailio Modules
               2.2. External Libraries or Applications
 
         3. Parameters
 
               3.1. buf_size (integer)
               3.2. xml_ns (str)
 
         4. Pseudo-Variables
 
9cb2a163
               4.1. $xml(name=>spec)
e9438550
 
bf42fb7b
    List of Examples
e9438550
 
0577abba
    1.1. Set buf_size parameter
    1.2. Set xml_ns parameter
    1.3. xml usage
 
 Chapter 1. Admin Guide
 
    Table of Contents
 
    1. Overview
    2. Dependencies
 
         2.1. Kamailio Modules
         2.2. External Libraries or Applications
 
    3. Parameters
 
         3.1. buf_size (integer)
         3.2. xml_ns (str)
 
    4. Pseudo-Variables
 
9cb2a163
         4.1. $xml(name=>spec)
e9438550
 
bf42fb7b
 1. Overview
e9438550
 
9cb2a163
    This is a module implementing functions and pseudo-variables for XML
e9438550
    operations.
 
bf42fb7b
 2. Dependencies
e9438550
 
bf42fb7b
    2.1. Kamailio Modules
    2.2. External Libraries or Applications
 
 2.1. Kamailio Modules
e9438550
 
    The following modules must be loaded before this module:
      * none.
 
bf42fb7b
 2.2. External Libraries or Applications
e9438550
 
9cb2a163
    The following libraries or applications must be installed before
e9438550
    running kamailio with this module loaded:
7fdb47ff
      * libxml - for compilation from source, the development headers from
        this library are needed as well.
e9438550
 
bf42fb7b
 3. Parameters
 
    3.1. buf_size (integer)
    3.2. xml_ns (str)
e9438550
 
bf42fb7b
 3.1. buf_size (integer)
e9438550
 
    Maximum size of the XML buffer.
 
    Default value is 4096.
 
0577abba
    Example 1.1. Set buf_size parameter
e9438550
 ...
 modparam("xmlops", "buf_size", 8192)
 ...
 
bf42fb7b
 3.2. xml_ns (str)
e9438550
 
9cb2a163
    Register xml namespace prefix. Parameter value must have the format:
b927b944
    'prefix=uri'. It can be set many times to cope with multiple namespaces
    without prefix.
 
    This is useful when it is needed to access XML documents that specify
    xmlns without prefix, which is not XML-standard compliant, but it comes
    with SIP SIMPLE presence bodies.
e9438550
 
0577abba
    Example 1.2. Set xml_ns parameter
e9438550
 ...
 modparam("xmlops", "xml_ns", "rpid=urn:ietf:params:xml:ns:pidf:rpid")
b927b944
 modparam("xmlops", "xml_ns", "pidf=urn:ietf:params:xml:ns:pidf")
 ...
 $xml(x=>doc) = '<?xml version="1.0" encoding="utf-8"?>
     <presence xmlns="urn:ietf:params:xml:ns:pidf" entity="sip:test@mydomain.com"
 >
         <tuple id="86ae65b7-42de-4399-b635-295caad13aac">
             <status><basic>none</basic></status>
         </tuple>
     </presence>';
 
 xinfo("status: $xml(x=>xpath:/pidf:presence/pidf:tuple/pidf:status/pidf:basic)\n
 ");
e9438550
 ...
 
0577abba
 4. Pseudo-Variables
 
9cb2a163
    4.1. $xml(name=>spec)
bf42fb7b
 
0577abba
 4.1.  $xml(name=>spec)
e9438550
 
9cb2a163
    Pseudo-variable for XML document operations using xpath syntax. For
7fdb47ff
    more see the Pseudo-Variables Cookbook.
e9438550
 
0577abba
    Example 1.3. xml usage
e9438550
 ...
 $xml(x=>doc)
     = '<?xml version="1.0" encoding="UTF-8"?><a><b>test</b></a>';
 xlog("content of node b: $xml(x=>xpath:/a/b/text())\n");
 $xml(x=>xpath:/a/b) = "1234";
 ...