| 1 |
XMLOPS Module |
| 2 |
|
| 3 |
Daniel-Constantin Mierla |
| 4 |
|
| 5 |
asipto.com |
| 6 |
<[email protected]> |
| 7 |
|
| 8 |
Copyright © 2009 asipto.com |
| 9 |
__________________________________________________________________ |
| 10 |
|
| 11 |
Table of Contents |
| 12 |
|
| 13 |
1. Admin Guide |
| 14 |
|
| 15 |
1. Overview |
| 16 |
2. Dependencies |
| 17 |
|
| 18 |
2.1. Kamailio Modules |
| 19 |
2.2. External Libraries or Applications |
| 20 |
|
| 21 |
3. Parameters |
| 22 |
|
| 23 |
3.1. buf_size (integer) |
| 24 |
3.2. xml_ns (str) |
| 25 |
|
| 26 |
4. Pseudo-Variables |
| 27 |
|
| 28 |
4.1. $xml(name=>spec) |
| 29 |
|
| 30 |
List of Examples |
| 31 |
|
| 32 |
1.1. Set buf_size parameter |
| 33 |
1.2. Set xml_ns parameter |
| 34 |
1.3. xml usage |
| 35 |
|
| 36 |
Chapter 1. Admin Guide |
| 37 |
|
| 38 |
Table of Contents |
| 39 |
|
| 40 |
1. Overview |
| 41 |
2. Dependencies |
| 42 |
|
| 43 |
2.1. Kamailio Modules |
| 44 |
2.2. External Libraries or Applications |
| 45 |
|
| 46 |
3. Parameters |
| 47 |
|
| 48 |
3.1. buf_size (integer) |
| 49 |
3.2. xml_ns (str) |
| 50 |
|
| 51 |
4. Pseudo-Variables |
| 52 |
|
| 53 |
4.1. $xml(name=>spec) |
| 54 |
|
| 55 |
1. Overview |
| 56 |
|
| 57 |
This is a module implementing functions and pseudo-variables for XML |
| 58 |
operations. |
| 59 |
|
| 60 |
2. Dependencies |
| 61 |
|
| 62 |
2.1. Kamailio Modules |
| 63 |
2.2. External Libraries or Applications |
| 64 |
|
| 65 |
2.1. Kamailio Modules |
| 66 |
|
| 67 |
The following modules must be loaded before this module: |
| 68 |
* none. |
| 69 |
|
| 70 |
2.2. External Libraries or Applications |
| 71 |
|
| 72 |
The following libraries or applications must be installed before |
| 73 |
running kamailio with this module loaded: |
| 74 |
* libxml - for compilation from source, the development headers from |
| 75 |
this library are needed as well. |
| 76 |
|
| 77 |
3. Parameters |
| 78 |
|
| 79 |
3.1. buf_size (integer) |
| 80 |
3.2. xml_ns (str) |
| 81 |
|
| 82 |
3.1. buf_size (integer) |
| 83 |
|
| 84 |
Maximum size of the XML buffer. |
| 85 |
|
| 86 |
Default value is 4096. |
| 87 |
|
| 88 |
Example 1.1. Set buf_size parameter |
| 89 |
... |
| 90 |
modparam("xmlops", "buf_size", 8192) |
| 91 |
... |
| 92 |
|
| 93 |
3.2. xml_ns (str) |
| 94 |
|
| 95 |
Register xml namespace prefix. Parameter value must have the format: |
| 96 |
'prefix=uri'. It can be set many times to cope with multiple namespaces |
| 97 |
without prefix. |
| 98 |
|
| 99 |
This is useful when it is needed to access XML documents that specify |
| 100 |
xmlns without prefix, which is not XML-standard compliant, but it comes |
| 101 |
with SIP SIMPLE presence bodies. |
| 102 |
|
| 103 |
Example 1.2. Set xml_ns parameter |
| 104 |
... |
| 105 |
modparam("xmlops", "xml_ns", "rpid=urn:ietf:params:xml:ns:pidf:rpid") |
| 106 |
modparam("xmlops", "xml_ns", "pidf=urn:ietf:params:xml:ns:pidf") |
| 107 |
... |
| 108 |
$xml(x=>doc) = '<?xml version="1.0" encoding="utf-8"?> |
| 109 |
<presence xmlns="urn:ietf:params:xml:ns:pidf" entity="sip:[email protected]" |
| 110 |
> |
| 111 |
<tuple id="86ae65b7-42de-4399-b635-295caad13aac"> |
| 112 |
<status><basic>none</basic></status> |
| 113 |
</tuple> |
| 114 |
</presence>'; |
| 115 |
|
| 116 |
xinfo("status: $xml(x=>xpath:/pidf:presence/pidf:tuple/pidf:status/pidf:basic)\n |
| 117 |
"); |
| 118 |
... |
| 119 |
|
| 120 |
4. Pseudo-Variables |
| 121 |
|
| 122 |
4.1. $xml(name=>spec) |
| 123 |
|
| 124 |
4.1. $xml(name=>spec) |
| 125 |
|
| 126 |
Pseudo-variable for XML document operations using xpath syntax. For |
| 127 |
more see the Pseudo-Variables Cookbook. |
| 128 |
|
| 129 |
Example 1.3. xml usage |
| 130 |
... |
| 131 |
$xml(x=>doc) |
| 132 |
= '<?xml version="1.0" encoding="UTF-8"?><a><b>test</b></a>'; |
| 133 |
xlog("content of node b: $xml(x=>xpath:/a/b/text())\n"); |
| 134 |
$xml(x=>xpath:/a/b) = "1234"; |
| 135 |
... |