3 # XmlAttr : dict : [XmlPath, string] -> string
11 /^A
/ && $
2 ==
"CDATA" {
12 update_node_attributes
()
17 XmlPayload =
substr($
0, 2, length($
0))
20 function path_to_string
(path
, depth
, p
, i
) {
22 for (i =
1; i
<= depth
; i
++) {
28 function update_node
( paren
, name
, key
, val
, path
, attr
) {
29 paren =
substr($
1, 1, 1)
30 name =
substr($
1, 2, length($
1) - 1)
34 XmlPath = path_to_string
(_path
, _depth
)
35 for (key in _hxpipe_curr_attrs
) {
36 val = _hxpipe_curr_attrs
[key
]
37 XmlAttr
[XmlPath
, key
] = val
39 } else if (paren ==
")") {
40 delete _hxpipe_curr_attrs
42 for (key in XmlAttr
) {
46 if (path == XmlPath
) delete XmlAttr
[key
]
49 XmlPath = path_to_string
(_path
, _depth
)
51 printf("ERROR in input line %d - not a parenthesis: \"%s\"\n", NR, paren
) > "/dev/stderr"
56 function update_node_attributes
( key
, val
, s
) {
57 key =
substr($
1, 2, length($
1))
60 sub("^" $
1 s $
2 s
, "", val
)
61 _hxpipe_curr_attrs
[key
] = val