1
2opaxmlextract(8)       Master map: IFSFFCLIRG (Man Page)      opaxmlextract(8)
3
4
5

NAME

7       opaxmlextract
8
9
10
11       (Linux)  Extracts element values from XML input and outputs the data in
12       CSV format. opaxmlextract is intended to be  used  with  opareport,  to
13       parse and filter its XML output, and to allow the filtered output to be
14       imported into other tools such  as  spreadsheets  and  customer-written
15       scripts. opaxmlextract can also be used with any well-formed XML stream
16       to extract element values into a delimited format.
17
18       Five sample scripts are available as prototypes for customized scripts.
19       They  combine  various  calls to opareport with a call to opaxmlextract
20       with commonly used parameters.
21

Syntax

23       opaxmlextract [-v][-H][-d delimiter][-e extract_element]
24       [-s suppress_element][-X input_file] [-P param_file]
25

Options

27       --help    Produces full help text.
28
29
30       -v/--verbose
31                 Produces verbose output.  Includes  output  progress  reports
32                 during extraction and output prepended wildcard characters on
33                 element names in output header record.
34
35
36       -H/--noheader
37                 Does not output element name header record.
38
39
40       -d/--delimit delimiter
41                 Uses single character or string as the delimiter between ele‐
42                 ment names and element values. Default is semicolon.
43
44
45       -e/--extract extract_element
46                 Specifies  the  name  of the XML element to extract. Elements
47                 can be nested in any order, but are output in the order spec‐
48                 ified.  Elements can be specified multiple times, with a dif‐
49                 ferent  attribute  name  or  attribute  value.  An   optional
50                 attribute (or attribute and value) can also be specified with
51                 elements:
52
53
54
55                 ·      -e element
56
57                 ·      -e element:attrName
58
59                 ·      -e element:attrName:attrValue
60
61
62
63
64
65
66       NOTE:
67
68
69
70              ·      Elements can be compound values separated by a  dot.  For
71                     example, Switches.Node is a Node element contained within
72                     a Switches element.
73
74              ·      To output the attribute value as opposed to  the  element
75                     value,  a  specification  such  as  -e FIs.Node:id can be
76                     used. This will return the value of the id  attribute  of
77                     any Node elements within FIs element.
78
79              ·      If  desired,  a  specific  element can be selected by its
80                     attribute value, such as -e MulticastFDB.Value:LID:0xc000
81                     which  will  return the value of the Value element within
82                     Multicast FDB element where  the  Value  element  has  an
83                     attribute of LID with a value of 0xc000.
84
85              ·      A given element can be specified multiple times each with
86                     a different AttrName or attrValue.
87
88
89
90
91       -s/--suppress suppress_element
92                 Specifies the name of the XML element to suppress extraction.
93                 Can  be used multiple times (in any order). Supports the same
94                 syntax as -e.
95
96
97       -X/--infile input_file
98                 Parses XML from input_file.
99
100
101       -P/--pfile param_file
102                 Reads command parameters from param_file.
103
104

Example

106       Here is an example of opareport output filtered by opaxmlextract :
107
108       # opareport -o comps -s -x | opaxmlextract -d ; -e NodeDesc
109       -e SystemImageGUID -e NumPorts -s Neighbor
110       Getting All Node Records...
111       Done Getting All Node Records
112       Done Getting All Link Records
113       Done Getting All Cable Info Records
114       Done Getting All SM Info Records
115       Getting All Port Counters...
116       Done Getting All Port Counters
117       NodeDesc;SystemImageGUID;NumPorts
118       phs1fnivd13u07n4 hfi1_0;0x00117501016033c7;1
119       phs1fnivd13u07n2 hfi1_0;0x00117501016033ef;1
120       phs1fnivd13u07n1 hfi1_0;0x001175010160347a;1
121       phs1fnivd13u07n3 hfi1_0;0x0011750101603593;1
122       phs1swivd13u21;0x00117501ff6a5619;48
123       phs1fnivd13u07n1 hfi1_0;;
124
125
126
127

Details

129       opaxmlextract is a flexible and powerful tool to process an XML stream.
130       The tool:
131
132       ·      Requires no specific element names to be present in the XML.
133
134       ·      Assumes no hierarchical relationship between elements.
135
136       ·      Allows extracted element values to be output in any order.
137
138       ·      Allows an element's value to be extracted only in the context of
139              another specified element.
140
141       ·      Allows extraction to be suppressed during the scope of specified
142              elements.
143
144       opaxmlextract  takes the XML input stream from either stdin or a speci‐
145       fied input file. opaxmlextract does not use or require a connection  to
146       a fabric.
147
148       opaxmlextract works from two lists of elements supplied as command line
149       or input parameters. The first is a list of elements whose  values  are
150       to  be  extracted,  called extraction elements. The second is a list of
151       elements for which extraction is to be suppressed,  called  suppression
152       elements.  When  an extraction element is encountered and extraction is
153       not suppressed, the value of the element is extracted for later  output
154       in  an extraction record. An extraction record contains a value for all
155       extraction elements, including those which have a null value.
156
157       When a suppression element is encountered, then no extraction  is  per‐
158       formed  during the extent of that element, from start through end. Sup‐
159       pression is maintained for elements specified  inside  the  suppression
160       element,  including  elements which may happen to match extraction ele‐
161       ments. Suppression can be used to prevent extraction in sections of XML
162       that are present, but not of current interest. For example, NodeDesc or
163       NodeGUID inside a Neighbor specification of opareport.
164
165       opaxmlextract attempts to generate extraction records with data  values
166       that  are  valid  at the same time. Specifying extraction elements that
167       are valid in the same scope produces a single record for each group  of
168       extraction elements. However, mixing extraction elements from different
169       scopes (including different XML levels) may cause opaxmlextract to pro‐
170       duce multiple records.
171
172       opaxmlextract  outputs  an extraction record under the following condi‐
173       tions:
174
175       ·      One or more extraction elements containing a non-null  value  go
176              out  of  scope  (that  is, the element containing the extraction
177              elements is ended) and a record containing  the  element  values
178              has not already been output.
179
180       ·      A new and different value is specified for an extraction element
181              and an extraction record containing the previous value  has  not
182              already been output.
183
184       Element names (extraction or suppression) can be made context-sensitive
185       with an enclosing element name using the syntax  element1.element2.  In
186       this  case,  element2  is  extracted (or extraction is suppressed) only
187       when element2 is enclosed by element1.
188
189       The syntax also allows ' * ' to be specified as  a  wildcard.  In  this
190       case, *.element3 specifies element3 enclosed by any element or sequence
191       of elements (for example, element1.element3  or  element1.element2.ele‐
192       ment3).  Similarly,  element1.*.element3 specifies element3 enclosed by
193       element1 with any number of (but at least 1) intermediate elements.
194
195       opaxmlextract prepends any entered element name not containing a ' *  '
196       (anywhere)  with ' *. ', matching the element regardless of the enclos‐
197       ing elements.
198
199       NOTE: Any element names that include a wildcard should be quoted to the
200       shell attempting to wildcard match against filenames.
201
202
203
204       At  the  beginning  of  operation, opaxmlextract, by default, outputs a
205       delimited header record containing the names  of  the  extraction  ele‐
206       ments.  The  order of the names is the same as specified on the command
207       line and is the same order as that of the extraction record. Output  of
208       the  header record can be disabled with the -H option. By default, ele‐
209       ment names are shown as they were entered on the command line.  The  -v
210       option  causes  element  names  to  be  output  as they are used during
211       extraction, with any prepended wildcard characters.
212
213       Options (parameters) to opaxmlextract can be specified on  the  command
214       line, with a parameter file, or using both methods. A parameter file is
215       specified with -P param_file. When a parameter  file  specification  is
216       encountered  on the command line, option processing on the command line
217       is suspended, the parameter file is read and  processed  entirely,  and
218       then command line processing is resumed.
219
220       Option  syntax  within  a  parameter file is the same as on the command
221       line. Multiple parameter file specifications can be made, on  the  com‐
222       mand line or within other parameter files. At each point that a parame‐
223       ter file is specified, current option processing is suspended while the
224       parameter file is processed, then resumed. Options are processed in the
225       order they are encountered on the command line or in parameter files. A
226       parameter  file  can  be up to 8192 bytes in size and may contain up to
227       512 parameters.
228
229
230
231Copyright(C) 2015-2018         Intel Corporation              opaxmlextract(8)
Impressum