1Zanata::Util(3) User Contributed Perl Documentation Zanata::Util(3)
2
3
4
5 find_file($file, @searchPaths)
6 Find file in search paths
7
8 xml_element_set(elt, opt_hash)
9 Set content and attributes of an xml elements.
10
11 elt is element to be set.
12
13 opt_hash is a hash that contains following keys:
14
15 tag_name
16 Tag name to be set.
17
18 content
19 Content to be set.
20
21 attributes
22 Hash of attributes
23
24 xml_element_ensure_child(parent, elt_name, opt_hash)
25 Ensure an xml element has a child. If no such child exists, then
26 create one.
27
28 Arguments:
29
30 parent
31 Parent element
32
33 elt_name
34 Tag name of child element
35
36 opt_hash
37 Optional options pass as hash.
38
39 Optional options are:
40
41 content
42 Content to be ensured.
43
44 attributes
45 Hash of attributes
46
47 = item
48
49 is_replace
50 Whether to replace value of existing child.
51
52 position
53 Position to insert created element. This is passed to
54 XML::Twig::Elt::insert_new_element.
55
56 Valid values:
57
58 first_child (default)
59 The element is pasted as the first child of $ref
60
61 last_child
62 The element is pasted as the last child of $ref
63
64 before
65 The element is pasted before $ref, as its previous
66 sibling.
67
68 after
69 The element is pasted after $ref, as its next sibling.
70
71 within In this case an extra argument, $offset, should be
72 supplied. The element will be pasted in the reference
73 element (or in its first text child) at the given offset.
74 To achieve this the reference element will be split at the
75 offset.
76
77 Returns the child element.
78
79 build_xpath
80 This function check whether the elements in xpath exists, and
81 create the necessary elements in the path.
82
83 Arguments:
84
85 twig
86 Twig to be processed.
87
88 xpath
89 Xpath to be built.
90
91 opt_position
92 Position for the created element. This is passed to
93 XML::Twig::Elt::insert_new_element.
94
95 Valid values:
96
97 first_child (default)
98 The element is pasted as the first child of $ref
99
100 last_child
101 The element is pasted as the last child of $ref
102
103 before
104 The element is pasted before $ref, as its previous sibling.
105
106 after
107 The element is pasted after $ref, as its next sibling.
108
109 opt_position
110 Position to insert created element. See opt_position in
111 "xml_element_ensure_child" for details.
112
113 within In this case an extra argument, $offset, should be
114 supplied. The element will be pasted in the reference element
115 (or in its first text child) at the given offset. To achieve
116 this the reference element will be split at the offset.
117 opt_offset
118 This argument is only used if opt_position is 'within'
119
120 Note this only handle simple cases like absolute file path (e.g.
121 /ppp/qqq)
122
123 Return: the deepest element.
124
125 init($cfgFile)
126 Initial this util by reading the cfg file and set server info.
127
128 Arguments =over 4
129
130 cfgFile
131 Optional cfgFile
132
134 Hey! The above document had some coding errors, which are explained
135 below:
136
137 Around line 68:
138 '=item' outside of any '=over'
139
140
141
142perl v5.30.0 2019-07-27 Zanata::Util(3)