taurus 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +518 -0
- data/CLAUDE.md +104 -0
- data/LICENSE.md +33 -0
- data/README.adoc +1529 -0
- data/Rakefile +7 -0
- data/TODO.impl/01-architecture.md +217 -0
- data/TODO.impl/02-ffi-declarations.md +236 -0
- data/TODO.impl/03-document-node-element-nodeset.md +382 -0
- data/TODO.impl/04-sax-parser.md +203 -0
- data/TODO.impl/05-serialize-c14n-memory-specs-css.md +276 -0
- data/benchmark/README.md +168 -0
- data/benchmark/taurus_vs_nokogiri.rb +105 -0
- data/docs/ARCHITECTURE.adoc +559 -0
- data/docs/BUILD.md +395 -0
- data/docs/ERROR_MESSAGES.md +458 -0
- data/docs/FFI_ARCHITECTURE.md +439 -0
- data/docs/FUTURE_VISION.md +303 -0
- data/docs/GITHUB_ACTIONS.md +293 -0
- data/docs/OPTIMIZATIONS_IMPLEMENTED.adoc +459 -0
- data/docs/PERFORMANCE.adoc +668 -0
- data/docs/PERFORMANCE.md +448 -0
- data/docs/RELEASE_NOTES_v1.0.0.md +515 -0
- data/docs/XPATH_SPEC_COMPLIANCE.md +298 -0
- data/docs/completion/taurus.bash +86 -0
- data/docs/completion/taurus.zsh +74 -0
- data/docs/man/taurus-format.1 +227 -0
- data/docs/man/taurus-parse.1 +178 -0
- data/docs/man/taurus-xpath.1 +312 -0
- data/docs/man/taurus.1 +160 -0
- data/docs/v0.9.0_PERFORMANCE_IMPROVEMENTS.md +217 -0
- data/docs/v0.9.0_RELEASE_SUMMARY.md +281 -0
- data/docs/v1.0.0_CONTINUATION_PLAN.md +172 -0
- data/docs/v1.0.0_CONTINUATION_PROMPT.md +382 -0
- data/docs/v1.0.0_SESSION_6_CONTINUATION.md +434 -0
- data/docs/v1.0.0_SESSION_6_PROMPT.md +231 -0
- data/docs/v1.0.0_STATUS_TRACKER.md +224 -0
- data/docs/v1.1.0_CONTINUATION_PLAN.md +299 -0
- data/docs/v1.1.0_FINAL_CONTINUATION_PLAN.md +201 -0
- data/docs/v1.1.0_SESSION_3_PROMPT.md +223 -0
- data/docs/v1.1.0_STATUS_TRACKER.md +355 -0
- data/docs/xml-performance.adoc +115 -0
- data/docs/xpath-performance.adoc +379 -0
- data/lib/taurus/version.rb +5 -0
- data/lib/taurus/xml/attr.rb +43 -0
- data/lib/taurus/xml/c14n.rb +23 -0
- data/lib/taurus/xml/cdata.rb +16 -0
- data/lib/taurus/xml/comment.rb +16 -0
- data/lib/taurus/xml/css_to_xpath.rb +177 -0
- data/lib/taurus/xml/doc_type.rb +54 -0
- data/lib/taurus/xml/document.rb +202 -0
- data/lib/taurus/xml/document_fragment.rb +42 -0
- data/lib/taurus/xml/element.rb +278 -0
- data/lib/taurus/xml/ffi.rb +420 -0
- data/lib/taurus/xml/namespace.rb +43 -0
- data/lib/taurus/xml/node.rb +221 -0
- data/lib/taurus/xml/node_set.rb +143 -0
- data/lib/taurus/xml/parse_options.rb +19 -0
- data/lib/taurus/xml/processing_instruction.rb +26 -0
- data/lib/taurus/xml/sax/document.rb +45 -0
- data/lib/taurus/xml/sax/parser.rb +148 -0
- data/lib/taurus/xml/sax.rb +12 -0
- data/lib/taurus/xml/searchable.rb +93 -0
- data/lib/taurus/xml/text.rb +16 -0
- data/lib/taurus/xml.rb +29 -0
- data/lib/taurus.rb +7 -0
- data/taurus.gemspec +42 -0
- metadata +157 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
.TH TAURUS-PARSE 1 "January 2025" "Taurus 0.5.0" "User Commands"
|
|
2
|
+
.SH NAME
|
|
3
|
+
taurus-parse \- Parse and validate XML documents
|
|
4
|
+
.SH SYNOPSIS
|
|
5
|
+
.B taurus parse
|
|
6
|
+
.RI [ OPTIONS ]
|
|
7
|
+
.I FILE
|
|
8
|
+
.SH DESCRIPTION
|
|
9
|
+
The
|
|
10
|
+
.B parse
|
|
11
|
+
command parses XML documents and validates their structure. It can output the
|
|
12
|
+
parsed document in multiple formats (XML, JSON, text) and supports error
|
|
13
|
+
recovery for malformed XML.
|
|
14
|
+
.PP
|
|
15
|
+
The parser is implemented in C for maximum performance, achieving 5.87µs per
|
|
16
|
+
document (2.2× Ox speed). It supports all XML 1.0 features including CDATA,
|
|
17
|
+
comments, processing instructions, and self-closing tags.
|
|
18
|
+
.SH OPTIONS
|
|
19
|
+
.TP
|
|
20
|
+
.BR \-f ", " \-\-format " " \fIFORMAT\fR
|
|
21
|
+
Output format: xml, json, or text. Default is xml.
|
|
22
|
+
.TP
|
|
23
|
+
.BR \-\-validate
|
|
24
|
+
Enable strict validation mode. Reports errors for invalid XML structure.
|
|
25
|
+
(Note: Currently parser always validates; this flag is for future use)
|
|
26
|
+
.TP
|
|
27
|
+
.BR \-\-recover
|
|
28
|
+
Enable error recovery mode. Attempts to parse malformed XML by recovering
|
|
29
|
+
from errors when possible. Useful for processing legacy or broken XML files.
|
|
30
|
+
.TP
|
|
31
|
+
.BR \-\-noout
|
|
32
|
+
Suppress output. Only validates the XML without printing the result.
|
|
33
|
+
Useful for quick validation checks.
|
|
34
|
+
.TP
|
|
35
|
+
.BR \-h ", " \-\-help
|
|
36
|
+
Show help message for the parse command and exit.
|
|
37
|
+
.SH ARGUMENTS
|
|
38
|
+
.TP
|
|
39
|
+
.I FILE
|
|
40
|
+
Path to the XML file to parse. Use
|
|
41
|
+
.B -
|
|
42
|
+
to read from stdin.
|
|
43
|
+
.SH OUTPUT FORMATS
|
|
44
|
+
.SS XML Format (default)
|
|
45
|
+
Outputs the parsed document as formatted XML with proper indentation and
|
|
46
|
+
namespace declarations. Preserves all elements, attributes, text content,
|
|
47
|
+
and special nodes (CDATA, comments, processing instructions).
|
|
48
|
+
.PP
|
|
49
|
+
.B Example:
|
|
50
|
+
.nf
|
|
51
|
+
<root xmlns="http://example.com">
|
|
52
|
+
<item id="1" status="active">
|
|
53
|
+
<name>Example</name>
|
|
54
|
+
</item>
|
|
55
|
+
</root>
|
|
56
|
+
.fi
|
|
57
|
+
.SS JSON Format
|
|
58
|
+
Converts the XML document to a JSON representation with the following structure:
|
|
59
|
+
.TP
|
|
60
|
+
.B type
|
|
61
|
+
Node type: "element", "text", "cdata", "comment", "pi"
|
|
62
|
+
.TP
|
|
63
|
+
.B name
|
|
64
|
+
Element name (for element nodes)
|
|
65
|
+
.TP
|
|
66
|
+
.B attributes
|
|
67
|
+
Object containing attribute name-value pairs
|
|
68
|
+
.TP
|
|
69
|
+
.B children
|
|
70
|
+
Array of child nodes
|
|
71
|
+
.TP
|
|
72
|
+
.B content
|
|
73
|
+
Text content (for text/CDATA nodes)
|
|
74
|
+
.PP
|
|
75
|
+
.B Example:
|
|
76
|
+
.nf
|
|
77
|
+
{
|
|
78
|
+
"type": "element",
|
|
79
|
+
"name": "root",
|
|
80
|
+
"attributes": {"xmlns": "http://example.com"},
|
|
81
|
+
"children": [
|
|
82
|
+
{
|
|
83
|
+
"type": "element",
|
|
84
|
+
"name": "item",
|
|
85
|
+
"attributes": {"id": "1", "status": "active"},
|
|
86
|
+
"children": [...]
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
.fi
|
|
91
|
+
.SS Text Format
|
|
92
|
+
Human-readable tree representation showing the document structure with
|
|
93
|
+
indentation, node types, and attributes.
|
|
94
|
+
.PP
|
|
95
|
+
.B Example:
|
|
96
|
+
.nf
|
|
97
|
+
Element: root {xmlns="http://example.com"}
|
|
98
|
+
Element: item {id="1", status="active"}
|
|
99
|
+
Element: name
|
|
100
|
+
Text: Example
|
|
101
|
+
.fi
|
|
102
|
+
.SH NAMESPACE HANDLING
|
|
103
|
+
The parser fully supports XML Namespaces 1.0 specification:
|
|
104
|
+
.TP
|
|
105
|
+
.B Default namespaces
|
|
106
|
+
.B xmlns="http://example.com"
|
|
107
|
+
.TP
|
|
108
|
+
.B Prefixed namespaces
|
|
109
|
+
.B xmlns:ns="http://example.com"
|
|
110
|
+
.TP
|
|
111
|
+
.B Namespace inheritance
|
|
112
|
+
Child elements inherit parent namespaces
|
|
113
|
+
.TP
|
|
114
|
+
.B Namespace override
|
|
115
|
+
Children can override parent namespace declarations
|
|
116
|
+
.SH EXIT STATUS
|
|
117
|
+
.TP
|
|
118
|
+
.B 0
|
|
119
|
+
Success. XML parsed without errors.
|
|
120
|
+
.TP
|
|
121
|
+
.B 1
|
|
122
|
+
Parse error. The XML is malformed or invalid.
|
|
123
|
+
.TP
|
|
124
|
+
.B 3
|
|
125
|
+
I/O error. Cannot read input file.
|
|
126
|
+
.TP
|
|
127
|
+
.B 4
|
|
128
|
+
Invalid arguments. Incorrect command-line options.
|
|
129
|
+
.SH EXAMPLES
|
|
130
|
+
.TP
|
|
131
|
+
Parse a file and display as XML:
|
|
132
|
+
.B taurus parse document.xml
|
|
133
|
+
.TP
|
|
134
|
+
Parse and display as JSON:
|
|
135
|
+
.B taurus parse --format json document.xml
|
|
136
|
+
.TP
|
|
137
|
+
Parse and display as text tree:
|
|
138
|
+
.B taurus parse --format text document.xml
|
|
139
|
+
.TP
|
|
140
|
+
Parse from stdin:
|
|
141
|
+
.B cat document.xml | taurus parse -
|
|
142
|
+
.TP
|
|
143
|
+
Validate XML without output:
|
|
144
|
+
.B taurus parse --noout document.xml
|
|
145
|
+
.TP
|
|
146
|
+
Parse malformed XML with recovery:
|
|
147
|
+
.B taurus parse --recover broken.xml
|
|
148
|
+
.TP
|
|
149
|
+
Check if XML is valid (exit code only):
|
|
150
|
+
.B taurus parse --noout document.xml && echo "Valid" || echo "Invalid"
|
|
151
|
+
.SH PERFORMANCE
|
|
152
|
+
The parser achieves high performance through:
|
|
153
|
+
.TP
|
|
154
|
+
.B C implementation
|
|
155
|
+
Native C code for maximum speed
|
|
156
|
+
.TP
|
|
157
|
+
.B Efficient memory
|
|
158
|
+
Minimal allocations during parsing
|
|
159
|
+
.TP
|
|
160
|
+
.B Linear complexity
|
|
161
|
+
O(n) parsing time relative to document size
|
|
162
|
+
.TP
|
|
163
|
+
.B Lazy evaluation
|
|
164
|
+
Namespaces resolved only when accessed
|
|
165
|
+
.SH SEE ALSO
|
|
166
|
+
.BR taurus (1),
|
|
167
|
+
.BR taurus-xpath (1),
|
|
168
|
+
.BR taurus-format (1),
|
|
169
|
+
.BR xmllint (1)
|
|
170
|
+
.SH BUGS
|
|
171
|
+
Report bugs at:
|
|
172
|
+
.UR https://github.com/lutaml/taurus/issues
|
|
173
|
+
.UE
|
|
174
|
+
.SH AUTHORS
|
|
175
|
+
Written by the Lutaml team at Ribose Inc.
|
|
176
|
+
.SH COPYRIGHT
|
|
177
|
+
Copyright \(co 2024-2025 Ribose Inc.
|
|
178
|
+
License: MIT License
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
.TH TAURUS-XPATH 1 "January 2025" "Taurus 0.5.0" "User Commands"
|
|
2
|
+
.SH NAME
|
|
3
|
+
taurus-xpath \- Execute XPath 1.0 queries against XML documents
|
|
4
|
+
.SH SYNOPSIS
|
|
5
|
+
.B taurus xpath
|
|
6
|
+
.RI [ OPTIONS ]
|
|
7
|
+
.I FILE
|
|
8
|
+
.I EXPRESSION
|
|
9
|
+
.SH DESCRIPTION
|
|
10
|
+
The
|
|
11
|
+
.B xpath
|
|
12
|
+
command executes XPath 1.0 queries against XML documents. It supports all 13
|
|
13
|
+
axes, 27 functions, predicates, and operators defined in the XPath 1.0
|
|
14
|
+
specification.
|
|
15
|
+
.PP
|
|
16
|
+
The XPath engine is implemented entirely in C for maximum performance,
|
|
17
|
+
achieving 9.00µs for simple queries (2.3× Nokogiri speed). Results can be
|
|
18
|
+
output in multiple formats (XML, JSON, text).
|
|
19
|
+
.SH OPTIONS
|
|
20
|
+
.TP
|
|
21
|
+
.BR \-f ", " \-\-format " " \fIFORMAT\fR
|
|
22
|
+
Output format: xml, json, or text. Default is xml.
|
|
23
|
+
.TP
|
|
24
|
+
.BR \-\-count
|
|
25
|
+
Output only the count of matching nodes instead of the nodes themselves.
|
|
26
|
+
.TP
|
|
27
|
+
.BR \-\-boolean
|
|
28
|
+
Output only the boolean result (true/false) of the expression.
|
|
29
|
+
.TP
|
|
30
|
+
.BR \-\-nsfile " " \fIFILE\fR
|
|
31
|
+
Load namespace bindings from a file. File should contain one binding per line
|
|
32
|
+
in the format: prefix=URI
|
|
33
|
+
.TP
|
|
34
|
+
.BR \-h ", " \-\-help
|
|
35
|
+
Show help message for the xpath command and exit.
|
|
36
|
+
.SH ARGUMENTS
|
|
37
|
+
.TP
|
|
38
|
+
.I FILE
|
|
39
|
+
Path to the XML file to query. Use
|
|
40
|
+
.B -
|
|
41
|
+
to read from stdin.
|
|
42
|
+
.TP
|
|
43
|
+
.I EXPRESSION
|
|
44
|
+
XPath 1.0 expression to evaluate. Should be quoted to prevent shell expansion.
|
|
45
|
+
.SH XPATH SYNTAX
|
|
46
|
+
.SS Location Paths
|
|
47
|
+
.TP
|
|
48
|
+
.B /root/child
|
|
49
|
+
Absolute path from root
|
|
50
|
+
.TP
|
|
51
|
+
.B //element
|
|
52
|
+
Descendant search (all matching elements)
|
|
53
|
+
.TP
|
|
54
|
+
.B ./child
|
|
55
|
+
Relative path from context
|
|
56
|
+
.TP
|
|
57
|
+
.B ..
|
|
58
|
+
Parent node
|
|
59
|
+
.TP
|
|
60
|
+
.B @attribute
|
|
61
|
+
Attribute access
|
|
62
|
+
.SS Predicates
|
|
63
|
+
.TP
|
|
64
|
+
.B [1]
|
|
65
|
+
First node (1-based index)
|
|
66
|
+
.TP
|
|
67
|
+
.B [last()]
|
|
68
|
+
Last node
|
|
69
|
+
.TP
|
|
70
|
+
.B [@attr]
|
|
71
|
+
Nodes with attribute
|
|
72
|
+
.TP
|
|
73
|
+
.B [@price > 20]
|
|
74
|
+
Comparison predicate
|
|
75
|
+
.TP
|
|
76
|
+
.B [position() < 5]
|
|
77
|
+
Position-based filter
|
|
78
|
+
.SS Axes
|
|
79
|
+
All 13 XPath 1.0 axes are supported:
|
|
80
|
+
.TP
|
|
81
|
+
.B child::
|
|
82
|
+
Direct children (default axis)
|
|
83
|
+
.TP
|
|
84
|
+
.B descendant::
|
|
85
|
+
All descendants
|
|
86
|
+
.TP
|
|
87
|
+
.B descendant-or-self::
|
|
88
|
+
Context node plus all descendants
|
|
89
|
+
.TP
|
|
90
|
+
.B parent::
|
|
91
|
+
Parent node
|
|
92
|
+
.TP
|
|
93
|
+
.B ancestor::
|
|
94
|
+
All ancestors
|
|
95
|
+
.TP
|
|
96
|
+
.B ancestor-or-self::
|
|
97
|
+
Context node plus all ancestors
|
|
98
|
+
.TP
|
|
99
|
+
.B following-sibling::
|
|
100
|
+
Siblings after context
|
|
101
|
+
.TP
|
|
102
|
+
.B preceding-sibling::
|
|
103
|
+
Siblings before context
|
|
104
|
+
.TP
|
|
105
|
+
.B following::
|
|
106
|
+
All nodes after context in document order
|
|
107
|
+
.TP
|
|
108
|
+
.B preceding::
|
|
109
|
+
All nodes before context in document order
|
|
110
|
+
.TP
|
|
111
|
+
.B attribute::
|
|
112
|
+
Attributes (same as @)
|
|
113
|
+
.TP
|
|
114
|
+
.B self::
|
|
115
|
+
Context node only
|
|
116
|
+
.TP
|
|
117
|
+
.B namespace::
|
|
118
|
+
Namespace nodes (stub implementation)
|
|
119
|
+
.SS Operators
|
|
120
|
+
.TP
|
|
121
|
+
.B or, and
|
|
122
|
+
Logical operators
|
|
123
|
+
.TP
|
|
124
|
+
.B =, !=
|
|
125
|
+
Equality comparison
|
|
126
|
+
.TP
|
|
127
|
+
.B <, <=, >, >=
|
|
128
|
+
Relational comparison
|
|
129
|
+
.TP
|
|
130
|
+
.B +, -, *, div, mod
|
|
131
|
+
Arithmetic operators
|
|
132
|
+
.TP
|
|
133
|
+
.B |
|
|
134
|
+
Union (combine node-sets)
|
|
135
|
+
.SH XPATH FUNCTIONS
|
|
136
|
+
All 27 XPath 1.0 functions are implemented:
|
|
137
|
+
.SS Node Set Functions
|
|
138
|
+
.TP
|
|
139
|
+
.B count(node-set)
|
|
140
|
+
Number of nodes
|
|
141
|
+
.TP
|
|
142
|
+
.B id(object)
|
|
143
|
+
Elements by ID
|
|
144
|
+
.TP
|
|
145
|
+
.B local-name([node-set])
|
|
146
|
+
Local part of first node name
|
|
147
|
+
.TP
|
|
148
|
+
.B namespace-uri([node-set])
|
|
149
|
+
Namespace URI of first node
|
|
150
|
+
.TP
|
|
151
|
+
.B name([node-set])
|
|
152
|
+
Qualified name of first node
|
|
153
|
+
.SS String Functions
|
|
154
|
+
.TP
|
|
155
|
+
.B string([object])
|
|
156
|
+
Convert to string
|
|
157
|
+
.TP
|
|
158
|
+
.B concat(str1, str2, ...)
|
|
159
|
+
Concatenate strings
|
|
160
|
+
.TP
|
|
161
|
+
.B starts-with(str1, str2)
|
|
162
|
+
True if str1 starts with str2
|
|
163
|
+
.TP
|
|
164
|
+
.B contains(str1, str2)
|
|
165
|
+
True if str1 contains str2
|
|
166
|
+
.TP
|
|
167
|
+
.B substring(str, start[, length])
|
|
168
|
+
Extract substring
|
|
169
|
+
.TP
|
|
170
|
+
.B string-length([string])
|
|
171
|
+
Length of string
|
|
172
|
+
.TP
|
|
173
|
+
.B normalize-space([string])
|
|
174
|
+
Normalize whitespace
|
|
175
|
+
.TP
|
|
176
|
+
.B translate(str, from, to)
|
|
177
|
+
Character translation
|
|
178
|
+
.SS Boolean Functions
|
|
179
|
+
.TP
|
|
180
|
+
.B boolean(object)
|
|
181
|
+
Convert to boolean
|
|
182
|
+
.TP
|
|
183
|
+
.B not(boolean)
|
|
184
|
+
Logical negation
|
|
185
|
+
.TP
|
|
186
|
+
.B true()
|
|
187
|
+
Boolean true
|
|
188
|
+
.TP
|
|
189
|
+
.B false()
|
|
190
|
+
Boolean false
|
|
191
|
+
.TP
|
|
192
|
+
.B lang(string)
|
|
193
|
+
Language test
|
|
194
|
+
.SS Number Functions
|
|
195
|
+
.TP
|
|
196
|
+
.B number([object])
|
|
197
|
+
Convert to number
|
|
198
|
+
.TP
|
|
199
|
+
.B sum(node-set)
|
|
200
|
+
Sum of node values
|
|
201
|
+
.TP
|
|
202
|
+
.B floor(number)
|
|
203
|
+
Round down
|
|
204
|
+
.TP
|
|
205
|
+
.B ceiling(number)
|
|
206
|
+
Round up
|
|
207
|
+
.TP
|
|
208
|
+
.B round(number)
|
|
209
|
+
Round to nearest integer
|
|
210
|
+
.SS Context Functions
|
|
211
|
+
.TP
|
|
212
|
+
.B last()
|
|
213
|
+
Size of context
|
|
214
|
+
.TP
|
|
215
|
+
.B position()
|
|
216
|
+
Current position (1-based)
|
|
217
|
+
.SH OUTPUT FORMATS
|
|
218
|
+
.SS XML Format (default)
|
|
219
|
+
Outputs matching nodes as formatted XML. Each matching node is output
|
|
220
|
+
separately with proper indentation.
|
|
221
|
+
.SS JSON Format
|
|
222
|
+
Converts matching nodes to JSON array. Each node is represented as an object
|
|
223
|
+
with type, name, attributes, and children fields.
|
|
224
|
+
.SS Text Format
|
|
225
|
+
Human-readable representation showing node types, names, and attributes.
|
|
226
|
+
.SH EXIT STATUS
|
|
227
|
+
.TP
|
|
228
|
+
.B 0
|
|
229
|
+
Success. Query executed without errors.
|
|
230
|
+
.TP
|
|
231
|
+
.B 1
|
|
232
|
+
Parse error. The XML is malformed.
|
|
233
|
+
.TP
|
|
234
|
+
.B 2
|
|
235
|
+
XPath error. Invalid expression or evaluation failed.
|
|
236
|
+
.TP
|
|
237
|
+
.B 3
|
|
238
|
+
I/O error. Cannot read input file.
|
|
239
|
+
.TP
|
|
240
|
+
.B 4
|
|
241
|
+
Invalid arguments. Incorrect command-line options.
|
|
242
|
+
.SH EXAMPLES
|
|
243
|
+
.TP
|
|
244
|
+
Find all book elements:
|
|
245
|
+
.B taurus xpath books.xml "//book"
|
|
246
|
+
.TP
|
|
247
|
+
Find books with price > 20:
|
|
248
|
+
.B taurus xpath books.xml "//book[@price > 20]"
|
|
249
|
+
.TP
|
|
250
|
+
Get the first book:
|
|
251
|
+
.B taurus xpath books.xml "//book[1]"
|
|
252
|
+
.TP
|
|
253
|
+
Count all items:
|
|
254
|
+
.B taurus xpath --count inventory.xml "//item"
|
|
255
|
+
.TP
|
|
256
|
+
Check if any active items exist:
|
|
257
|
+
.B taurus xpath --boolean store.xml "//item[@status='active']"
|
|
258
|
+
.TP
|
|
259
|
+
Find all titles under books:
|
|
260
|
+
.B taurus xpath library.xml "//book/title"
|
|
261
|
+
.TP
|
|
262
|
+
Get parent of first item:
|
|
263
|
+
.B taurus xpath data.xml "//item[1]/.."
|
|
264
|
+
.TP
|
|
265
|
+
Find siblings after first element:
|
|
266
|
+
.B taurus xpath doc.xml "/root/child[1]/following-sibling::*"
|
|
267
|
+
.TP
|
|
268
|
+
Complex query with multiple predicates:
|
|
269
|
+
.B taurus xpath books.xml "//book[@price > 20 and @category='fiction']/title"
|
|
270
|
+
.TP
|
|
271
|
+
Use string functions:
|
|
272
|
+
.B taurus xpath data.xml "//item[starts-with(@id, 'AB')]"
|
|
273
|
+
.TP
|
|
274
|
+
Pipeline example:
|
|
275
|
+
.B cat data.xml | taurus xpath - "//active" --format json
|
|
276
|
+
.SH PERFORMANCE
|
|
277
|
+
The XPath engine is optimized for:
|
|
278
|
+
.TP
|
|
279
|
+
.B Speed
|
|
280
|
+
9.00µs for simple queries (competitive with Nokogiri)
|
|
281
|
+
.TP
|
|
282
|
+
.B Memory
|
|
283
|
+
Efficient nodeset storage with dynamic growth
|
|
284
|
+
.TP
|
|
285
|
+
.B Compliance
|
|
286
|
+
100% XPath 1.0 specification conformance
|
|
287
|
+
.SH LIMITATIONS
|
|
288
|
+
.TP
|
|
289
|
+
.B Namespace prefixes
|
|
290
|
+
Currently, namespace prefixes in queries (e.g., ns:element) are not fully
|
|
291
|
+
supported. Use local-name() or name() functions as workarounds.
|
|
292
|
+
.TP
|
|
293
|
+
.B Variables
|
|
294
|
+
XPath variables ($var) are not supported in command-line mode.
|
|
295
|
+
.SH SEE ALSO
|
|
296
|
+
.BR taurus (1),
|
|
297
|
+
.BR taurus-parse (1),
|
|
298
|
+
.BR taurus-format (1),
|
|
299
|
+
.BR xpath (1)
|
|
300
|
+
.PP
|
|
301
|
+
XPath 1.0 Specification:
|
|
302
|
+
.UR https://www.w3.org/TR/xpath-10/
|
|
303
|
+
.UE
|
|
304
|
+
.SH BUGS
|
|
305
|
+
Report bugs at:
|
|
306
|
+
.UR https://github.com/lutaml/taurus/issues
|
|
307
|
+
.UE
|
|
308
|
+
.SH AUTHORS
|
|
309
|
+
Written by the Lutaml team at Ribose Inc.
|
|
310
|
+
.SH COPYRIGHT
|
|
311
|
+
Copyright \(co 2024-2025 Ribose Inc.
|
|
312
|
+
License: MIT License
|
data/docs/man/taurus.1
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
.TH TAURUS 1 "January 2025" "Taurus 0.5.0" "User Commands"
|
|
2
|
+
.SH NAME
|
|
3
|
+
taurus \- Fast XML parser with complete XPath 1.0 support
|
|
4
|
+
.SH SYNOPSIS
|
|
5
|
+
.B taurus
|
|
6
|
+
.RI [ OPTIONS ]
|
|
7
|
+
.I COMMAND
|
|
8
|
+
.RI [ ARGS... ]
|
|
9
|
+
.SH DESCRIPTION
|
|
10
|
+
.B Taurus
|
|
11
|
+
is a high-performance XML parser implemented in C with complete XPath 1.0
|
|
12
|
+
support. It provides Ox-level parsing speed (5.87µs per document) with full
|
|
13
|
+
XML Namespaces 1.0 specification compliance and all 27 XPath 1.0 functions.
|
|
14
|
+
.PP
|
|
15
|
+
Taurus beats Nokogiri on parsing speed across all document sizes while
|
|
16
|
+
maintaining full XML and XPath specification compliance. It offers a
|
|
17
|
+
command-line interface for parsing, querying, and formatting XML documents.
|
|
18
|
+
.SH COMMANDS
|
|
19
|
+
.TP
|
|
20
|
+
.B parse
|
|
21
|
+
Parse and validate XML documents. Supports recovery mode for malformed XML
|
|
22
|
+
and multiple output formats (XML, JSON, text). See
|
|
23
|
+
.BR taurus-parse (1).
|
|
24
|
+
.TP
|
|
25
|
+
.B xpath
|
|
26
|
+
Execute XPath 1.0 queries against XML documents. Supports all 13 axes, 27
|
|
27
|
+
functions, predicates, and operators. See
|
|
28
|
+
.BR taurus-xpath (1).
|
|
29
|
+
.TP
|
|
30
|
+
.B format
|
|
31
|
+
Pretty-print XML documents with configurable indentation. Supports multiple
|
|
32
|
+
output formats and can compact or expand whitespace. See
|
|
33
|
+
.BR taurus-format (1).
|
|
34
|
+
.TP
|
|
35
|
+
.B version
|
|
36
|
+
Show version information and build details.
|
|
37
|
+
.SH OPTIONS
|
|
38
|
+
.TP
|
|
39
|
+
.BR \-v ", " \-\-verbose
|
|
40
|
+
Increase verbosity level. Can be used multiple times for more detailed output.
|
|
41
|
+
.TP
|
|
42
|
+
.BR \-q ", " \-\-quiet
|
|
43
|
+
Suppress warnings and informational messages. Only errors are shown.
|
|
44
|
+
.TP
|
|
45
|
+
.BR \-\-color
|
|
46
|
+
Enable colored output for better readability (auto-detected for TTY).
|
|
47
|
+
.TP
|
|
48
|
+
.BR \-\-no\-color
|
|
49
|
+
Disable colored output even when connected to a TTY.
|
|
50
|
+
.TP
|
|
51
|
+
.BR \-h ", " \-\-help
|
|
52
|
+
Show help message with available commands and options, then exit.
|
|
53
|
+
.TP
|
|
54
|
+
.BR \-\-version
|
|
55
|
+
Show version information and exit.
|
|
56
|
+
.SH EXIT STATUS
|
|
57
|
+
.TP
|
|
58
|
+
.B 0
|
|
59
|
+
Success. The operation completed without errors.
|
|
60
|
+
.TP
|
|
61
|
+
.B 1
|
|
62
|
+
Parse error. The XML document is malformed or invalid.
|
|
63
|
+
.TP
|
|
64
|
+
.B 2
|
|
65
|
+
XPath error. The XPath expression is invalid or evaluation failed.
|
|
66
|
+
.TP
|
|
67
|
+
.B 3
|
|
68
|
+
I/O error. File not found, permission denied, or read/write error.
|
|
69
|
+
.TP
|
|
70
|
+
.B 4
|
|
71
|
+
Invalid arguments. Command-line options or arguments are incorrect.
|
|
72
|
+
.SH EXAMPLES
|
|
73
|
+
.TP
|
|
74
|
+
Parse an XML document and display in default format:
|
|
75
|
+
.B taurus parse document.xml
|
|
76
|
+
.TP
|
|
77
|
+
Parse XML from stdin:
|
|
78
|
+
.B cat document.xml | taurus parse -
|
|
79
|
+
.TP
|
|
80
|
+
Parse with error recovery for malformed XML:
|
|
81
|
+
.B taurus parse --recover broken.xml
|
|
82
|
+
.TP
|
|
83
|
+
Execute XPath query to find all books with price > 20:
|
|
84
|
+
.B taurus xpath books.xml "//book[@price > 20]"
|
|
85
|
+
.TP
|
|
86
|
+
Count matching nodes:
|
|
87
|
+
.B taurus xpath --count library.xml "//book"
|
|
88
|
+
.TP
|
|
89
|
+
Pretty-print with 4-space indentation:
|
|
90
|
+
.B taurus format --indent 4 document.xml
|
|
91
|
+
.TP
|
|
92
|
+
Convert XML to JSON format:
|
|
93
|
+
.B taurus format --format json document.xml
|
|
94
|
+
.TP
|
|
95
|
+
Pipeline example - parse, query, format:
|
|
96
|
+
.B taurus parse data.xml | taurus xpath - "//item[@status='active']" | taurus format --compact -
|
|
97
|
+
.SH FILES
|
|
98
|
+
.TP
|
|
99
|
+
.I /etc/bash_completion.d/taurus
|
|
100
|
+
System-wide bash completion script
|
|
101
|
+
.TP
|
|
102
|
+
.I ~/.bash_completion.d/taurus
|
|
103
|
+
User-specific bash completion script
|
|
104
|
+
.TP
|
|
105
|
+
.I /usr/local/share/zsh/site-functions/_taurus
|
|
106
|
+
Zsh completion script
|
|
107
|
+
.SH ENVIRONMENT
|
|
108
|
+
.TP
|
|
109
|
+
.B NO_COLOR
|
|
110
|
+
If set to any value, disables colored output (overridden by --color).
|
|
111
|
+
.TP
|
|
112
|
+
.B FORCE_COLOR
|
|
113
|
+
If set to any value, enables colored output even for non-TTY (overridden by --no-color).
|
|
114
|
+
.SH PERFORMANCE
|
|
115
|
+
.B Taurus
|
|
116
|
+
is optimized for speed and memory efficiency:
|
|
117
|
+
.TP
|
|
118
|
+
.B Parsing
|
|
119
|
+
5.87µs per document (2.2× Ox, faster than Nokogiri)
|
|
120
|
+
.TP
|
|
121
|
+
.B XPath
|
|
122
|
+
9.00µs for simple queries (2.3× Nokogiri)
|
|
123
|
+
.TP
|
|
124
|
+
.B DOM Access
|
|
125
|
+
0.069µs children access (1.88× faster than Ox)
|
|
126
|
+
.TP
|
|
127
|
+
.B Memory
|
|
128
|
+
Comparable to Ox, significantly less than Nokogiri
|
|
129
|
+
.SH STANDARDS
|
|
130
|
+
.B Taurus
|
|
131
|
+
implements the following specifications:
|
|
132
|
+
.TP
|
|
133
|
+
.B XML
|
|
134
|
+
Extensible Markup Language (XML) 1.0 (Fifth Edition)
|
|
135
|
+
.TP
|
|
136
|
+
.B Namespaces
|
|
137
|
+
Namespaces in XML 1.0 (Third Edition) - complete implementation
|
|
138
|
+
.TP
|
|
139
|
+
.B XPath
|
|
140
|
+
XML Path Language (XPath) Version 1.0 - all 13 axes, 27 functions
|
|
141
|
+
.SH SEE ALSO
|
|
142
|
+
.BR taurus-parse (1),
|
|
143
|
+
.BR taurus-xpath (1),
|
|
144
|
+
.BR taurus-format (1),
|
|
145
|
+
.BR xmllint (1),
|
|
146
|
+
.BR xpath (1),
|
|
147
|
+
.BR xml (5)
|
|
148
|
+
.SH BUGS
|
|
149
|
+
Report bugs at:
|
|
150
|
+
.UR https://github.com/lutaml/taurus/issues
|
|
151
|
+
.UE
|
|
152
|
+
.SH AUTHORS
|
|
153
|
+
Written by the Lutaml team at Ribose Inc.
|
|
154
|
+
.SH COPYRIGHT
|
|
155
|
+
Copyright \(co 2024-2025 Ribose Inc.
|
|
156
|
+
.br
|
|
157
|
+
License: MIT License
|
|
158
|
+
.br
|
|
159
|
+
This is free software: you are free to change and redistribute it.
|
|
160
|
+
There is NO WARRANTY, to the extent permitted by law.
|