Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
XPath Parser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Sylvain Schmitz
XPath Parser
Commits
84170241
Commit
84170241
authored
Jun 28, 2018
by
David BAELDE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factorize list of XPath std funs
parent
1567569e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
239 additions
and
456 deletions
+239
-456
tools/extensions/XPathStd.pm
tools/extensions/XPathStd.pm
+234
-0
tools/extensions/countfuns.pl
tools/extensions/countfuns.pl
+2
-228
tools/extensions/nonstandard.pl
tools/extensions/nonstandard.pl
+3
-228
No files found.
tools/extensions/XPathStd.pm
0 → 100644
View file @
84170241
package
XPathStd
;
use
Exporter
;
our
@ISA
=
qw( Exporter )
;
our
@EXPORT_OK
=
qw( functions )
;
our
@EXPORT
=
qw( functions )
;
@functions
=
(
"
abs
",
"
acos
",
"
add-dayTimeDurations
",
"
add-dayTimeDuration-to-date
",
"
add-dayTimeDuration-to-dateTime
",
"
add-dayTimeDuration-to-time
",
"
add-yearMonthDurations
",
"
add-yearMonthDuration-to-date
",
"
add-yearMonthDuration-to-dateTime
",
"
adjust-dateTime-to-timezone
",
"
adjust-date-to-timezone
",
"
adjust-time-to-timezone
",
"
analyze-string
",
"
asin
",
"
atan
",
"
atan2
",
"
available-environment-variables
",
"
avg
",
"
base64Binary-equal
",
"
base-uri
",
"
boolean
",
"
boolean-equal
",
"
boolean-greater-than
",
"
boolean-less-than
",
"
ceiling
",
"
codepoint-equal
",
"
codepoints-to-string
",
"
collection
",
"
compare
",
"
concat
",
"
concatenate
",
"
contains
",
"
cos
",
"
count
",
"
current-date
",
"
current-dateTime
",
"
current-time
",
"
data
",
"
date-equal
",
"
date-greater-than
",
"
date-less-than
",
"
dateTime
",
"
dateTime-equal
",
"
dateTime-greater-than
",
"
dateTime-less-than
",
"
day-from-date
",
"
day-from-dateTime
",
"
days-from-duration
",
"
dayTimeDuration-greater-than
",
"
dayTimeDuration-less-than
",
"
deep-equal
",
"
default-collation
",
"
distinct-values
",
"
divide-dayTimeDuration
",
"
divide-dayTimeDuration-by-dayTimeDuration
",
"
divide-yearMonthDuration
",
"
divide-yearMonthDuration-by-yearMonthDuration
",
"
doc
",
"
doc-available
",
"
document-uri
",
"
duration-equal
",
"
element-with-id
",
"
empty
",
"
encode-for-uri
",
"
ends-with
",
"
environment-variable
",
"
error
",
"
escape-html-uri
",
"
exactly-one
",
"
except
",
"
exists
",
"
exp
",
"
exp10
",
"
false
",
"
filter
",
"
floor
",
"
fold-left
",
"
fold-right
",
"
for-each
",
"
for-each-pair
",
"
format-date
",
"
format-dateTime
",
"
format-integer
",
"
format-number
",
"
format-time
",
"
function-arity
",
"
function-lookup
",
"
function-name
",
"
gDay-equal
",
"
generate-id
",
"
gMonthDay-equal
",
"
gMonth-equal
",
"
gYear-equal
",
"
gYearMonth-equal
",
"
has-children
",
"
head
",
"
hexBinary-equal
",
"
hours-from-dateTime
",
"
hours-from-duration
",
"
hours-from-time
",
"
id
",
"
idref
",
"
implicit-timezone
",
"
index-of
",
"
innermost
",
"
in-scope-prefixes
",
"
insert-before
",
"
intersect
",
"
iri-to-uri
",
"
is-same-node
",
"
lang
",
"
last
",
"
local-name
",
"
local-name-from-QName
",
"
log
",
"
log10
",
"
lower-case
",
"
matches
",
"
max
",
"
min
",
"
minutes-from-dateTime
",
"
minutes-from-duration
",
"
minutes-from-time
",
"
month-from-date
",
"
month-from-dateTime
",
"
months-from-duration
",
"
multiply-dayTimeDuration
",
"
multiply-yearMonthDuration
",
"
name
",
"
namespace-uri
",
"
namespace-uri-for-prefix
",
"
namespace-uri-from-QName
",
"
nilled
",
"
node-after
",
"
node-before
",
"
node-name
",
"
normalize-space
",
"
normalize-unicode
",
"
not
",
"
NOTATION-equal
",
"
number
",
"
numeric-add
",
"
numeric-divide
",
"
numeric-equal
",
"
numeric-greater-than
",
"
numeric-integer-divide
",
"
numeric-less-than
",
"
numeric-mod
",
"
numeric-multiply
",
"
numeric-subtract
",
"
numeric-unary-minus
",
"
numeric-unary-plus
",
"
one-or-more
",
"
outermost
",
"
parse-xml
",
"
parse-xml-fragment
",
"
path
",
"
pi
",
"
position
",
"
pow
",
"
prefix-from-QName
",
"
QName
",
"
QName-equal
",
"
remove
",
"
replace
",
"
resolve-QName
",
"
resolve-uri
",
"
reverse
",
"
root
",
"
round
",
"
round-half-to-even
",
"
seconds-from-dateTime
",
"
seconds-from-duration
",
"
seconds-from-time
",
"
serialize
",
"
sin
",
"
sqrt
",
"
starts-with
",
"
static-base-uri
",
"
string
",
"
string-join
",
"
string-length
",
"
string-to-codepoints
",
"
subsequence
",
"
substring
",
"
substring-after
",
"
substring-before
",
"
subtract-dates
",
"
subtract-dateTimes
",
"
subtract-dayTimeDuration-from-date
",
"
subtract-dayTimeDuration-from-dateTime
",
"
subtract-dayTimeDuration-from-time
",
"
subtract-dayTimeDurations
",
"
subtract-times
",
"
subtract-yearMonthDuration-from-date
",
"
subtract-yearMonthDuration-from-dateTime
",
"
subtract-yearMonthDurations
",
"
sum
",
"
tail
",
"
tan
",
"
time-equal
",
"
time-greater-than
",
"
time-less-than
",
"
timezone-from-date
",
"
timezone-from-dateTime
",
"
timezone-from-time
",
"
to
",
"
tokenize
",
"
trace
",
"
translate
",
"
true
",
"
union
",
"
unordered
",
"
unparsed-text
",
"
unparsed-text-available
",
"
unparsed-text-lines
",
"
upper-case
",
"
uri-collection
",
"
year-from-date
",
"
year-from-dateTime
",
"
yearMonthDuration-greater-than
",
"
yearMonthDuration-less-than
",
"
years-from-duration
",
"
zero-or-one
"
);
1
;
tools/extensions/countfuns.pl
View file @
84170241
#!/usr/bin/perl
#!/usr/bin/perl
# Standard XPATH functions
require
"
./XPathStd.pm
";
@stdfuns
=
(
"
abs
",
"
acos
",
"
add-dayTimeDurations
",
"
add-dayTimeDuration-to-date
",
"
add-dayTimeDuration-to-dateTime
",
"
add-dayTimeDuration-to-time
",
"
add-yearMonthDurations
",
"
add-yearMonthDuration-to-date
",
"
add-yearMonthDuration-to-dateTime
",
"
adjust-dateTime-to-timezone
",
"
adjust-date-to-timezone
",
"
adjust-time-to-timezone
",
"
analyze-string
",
"
asin
",
"
atan
",
"
atan2
",
"
available-environment-variables
",
"
avg
",
"
base64Binary-equal
",
"
base-uri
",
"
boolean
",
"
boolean-equal
",
"
boolean-greater-than
",
"
boolean-less-than
",
"
ceiling
",
"
codepoint-equal
",
"
codepoints-to-string
",
"
collection
",
"
compare
",
"
concat
",
"
concatenate
",
"
contains
",
"
cos
",
"
count
",
"
current-date
",
"
current-dateTime
",
"
current-time
",
"
data
",
"
date-equal
",
"
date-greater-than
",
"
date-less-than
",
"
dateTime
",
"
dateTime-equal
",
"
dateTime-greater-than
",
"
dateTime-less-than
",
"
day-from-date
",
"
day-from-dateTime
",
"
days-from-duration
",
"
dayTimeDuration-greater-than
",
"
dayTimeDuration-less-than
",
"
deep-equal
",
"
default-collation
",
"
distinct-values
",
"
divide-dayTimeDuration
",
"
divide-dayTimeDuration-by-dayTimeDuration
",
"
divide-yearMonthDuration
",
"
divide-yearMonthDuration-by-yearMonthDuration
",
"
doc
",
"
doc-available
",
"
document-uri
",
"
duration-equal
",
"
element-with-id
",
"
empty
",
"
encode-for-uri
",
"
ends-with
",
"
environment-variable
",
"
error
",
"
escape-html-uri
",
"
exactly-one
",
"
except
",
"
exists
",
"
exp
",
"
exp10
",
"
false
",
"
filter
",
"
floor
",
"
fold-left
",
"
fold-right
",
"
for-each
",
"
for-each-pair
",
"
format-date
",
"
format-dateTime
",
"
format-integer
",
"
format-number
",
"
format-time
",
"
function-arity
",
"
function-lookup
",
"
function-name
",
"
gDay-equal
",
"
generate-id
",
"
gMonthDay-equal
",
"
gMonth-equal
",
"
gYear-equal
",
"
gYearMonth-equal
",
"
has-children
",
"
head
",
"
hexBinary-equal
",
"
hours-from-dateTime
",
"
hours-from-duration
",
"
hours-from-time
",
"
id
",
"
idref
",
"
implicit-timezone
",
"
index-of
",
"
innermost
",
"
in-scope-prefixes
",
"
insert-before
",
"
intersect
",
"
iri-to-uri
",
"
is-same-node
",
"
lang
",
"
last
",
"
local-name
",
"
local-name-from-QName
",
"
log
",
"
log10
",
"
lower-case
",
"
matches
",
"
max
",
"
min
",
"
minutes-from-dateTime
",
"
minutes-from-duration
",
"
minutes-from-time
",
"
month-from-date
",
"
month-from-dateTime
",
"
months-from-duration
",
"
multiply-dayTimeDuration
",
"
multiply-yearMonthDuration
",
"
name
",
"
namespace-uri
",
"
namespace-uri-for-prefix
",
"
namespace-uri-from-QName
",
"
nilled
",
"
node-after
",
"
node-before
",
"
node-name
",
"
normalize-space
",
"
normalize-unicode
",
"
not
",
"
NOTATION-equal
",
"
number
",
"
numeric-add
",
"
numeric-divide
",
"
numeric-equal
",
"
numeric-greater-than
",
"
numeric-integer-divide
",
"
numeric-less-than
",
"
numeric-mod
",
"
numeric-multiply
",
"
numeric-subtract
",
"
numeric-unary-minus
",
"
numeric-unary-plus
",
"
one-or-more
",
"
outermost
",
"
parse-xml
",
"
parse-xml-fragment
",
"
path
",
"
pi
",
"
position
",
"
pow
",
"
prefix-from-QName
",
"
QName
",
"
QName-equal
",
"
remove
",
"
replace
",
"
resolve-QName
",
"
resolve-uri
",
"
reverse
",
"
root
",
"
round
",
"
round-half-to-even
",
"
seconds-from-dateTime
",
"
seconds-from-duration
",
"
seconds-from-time
",
"
serialize
",
"
sin
",
"
sqrt
",
"
starts-with
",
"
static-base-uri
",
"
string
",
"
string-join
",
"
string-length
",
"
string-to-codepoints
",
"
subsequence
",
"
substring
",
"
substring-after
",
"
substring-before
",
"
subtract-dates
",
"
subtract-dateTimes
",
"
subtract-dayTimeDuration-from-date
",
"
subtract-dayTimeDuration-from-dateTime
",
"
subtract-dayTimeDuration-from-time
",
"
subtract-dayTimeDurations
",
"
subtract-times
",
"
subtract-yearMonthDuration-from-date
",
"
subtract-yearMonthDuration-from-dateTime
",
"
subtract-yearMonthDurations
",
"
sum
",
"
tail
",
"
tan
",
"
time-equal
",
"
time-greater-than
",
"
time-less-than
",
"
timezone-from-date
",
"
timezone-from-dateTime
",
"
timezone-from-time
",
"
to
",
"
tokenize
",
"
trace
",
"
translate
",
"
true
",
"
union
",
"
unordered
",
"
unparsed-text
",
"
unparsed-text-available
",
"
unparsed-text-lines
",
"
upper-case
",
"
uri-collection
",
"
year-from-date
",
"
year-from-dateTime
",
"
yearMonthDuration-greater-than
",
"
yearMonthDuration-less-than
",
"
years-from-duration
",
"
zero-or-one
"
);
unless
(
@ARGV
)
{
unless
(
@ARGV
)
{
print
<<HELP;
print
<<HELP;
...
@@ -305,7 +79,7 @@ for $fname (sort { $table{$b} <=> $table{$a} } keys %table) {
...
@@ -305,7 +79,7 @@ for $fname (sort { $table{$b} <=> $table{$a} } keys %table) {
"
*
$n
functions (out of
$nbfuns
) needed to cover 70% of occurrences.
\n
";
"
*
$n
functions (out of
$nbfuns
) needed to cover 70% of occurrences.
\n
";
}
}
printf
DAT
"
$n
$table
{
$fname
} %.2f
\n
",
100
*
$sofar
/
$total
;
printf
DAT
"
$n
$table
{
$fname
} %.2f
\n
",
100
*
$sofar
/
$total
;
if
(
grep
{
$fname
eq
$_
}
@
stdfu
ns
)
{
if
(
grep
{
$fname
eq
$_
}
@
XPathStd::
functio
ns
)
{
$sofar_std
+=
$table
{
$fname
};
$sofar_std
+=
$table
{
$fname
};
printf
STD
"
$n
$table
{
$fname
} %.2f
\n
",
100
*
$sofar_std
/
$total
;
printf
STD
"
$n
$table
{
$fname
} %.2f
\n
",
100
*
$sofar_std
/
$total
;
}
else
{
}
else
{
...
...
tools/extensions/nonstandard.pl
View file @
84170241
#!/usr/bin/perl
#!/usr/bin/perl
require
"
./XPathStd.pm
";
die
"
Usage: $0 <XML files>
\n
"
unless
@ARGV
;
die
"
Usage: $0 <XML files>
\n
"
unless
@ARGV
;
@files
=
@ARGV
;
@files
=
@ARGV
;
...
@@ -209,235 +211,8 @@ foreach (@unsupported) {
...
@@ -209,235 +211,8 @@ foreach (@unsupported) {
$query
=
"
$query
)
";
$query
=
"
$query
)
";
$nonsupportedquery
=
"
ast//xqx:functionName[
$query
]
";
$nonsupportedquery
=
"
ast//xqx:functionName[
$query
]
";
@functions
=
(
"
abs
",
"
acos
",
"
add-dayTimeDurations
",
"
add-dayTimeDuration-to-date
",
"
add-dayTimeDuration-to-dateTime
",
"
add-dayTimeDuration-to-time
",
"
add-yearMonthDurations
",
"
add-yearMonthDuration-to-date
",
"
add-yearMonthDuration-to-dateTime
",
"
adjust-dateTime-to-timezone
",
"
adjust-date-to-timezone
",
"
adjust-time-to-timezone
",
"
analyze-string
",
"
asin
",
"
atan
",
"
atan2
",
"
available-environment-variables
",
"
avg
",
"
base64Binary-equal
",
"
base-uri
",
"
boolean
",
"
boolean-equal
",
"
boolean-greater-than
",
"
boolean-less-than
",
"
ceiling
",
"
codepoint-equal
",
"
codepoints-to-string
",
"
collection
",
"
compare
",
"
concat
",
"
concatenate
",
"
contains
",
"
cos
",
"
count
",
"
current-date
",
"
current-dateTime
",
"
current-time
",
"
data
",
"
date-equal
",
"
date-greater-than
",
"
date-less-than
",
"
dateTime
",
"
dateTime-equal
",
"
dateTime-greater-than
",
"
dateTime-less-than
",
"
day-from-date
",
"
day-from-dateTime
",
"
days-from-duration
",
"
dayTimeDuration-greater-than
",
"
dayTimeDuration-less-than
",
"
deep-equal
",
"
default-collation
",
"
distinct-values
",
"
divide-dayTimeDuration
",
"
divide-dayTimeDuration-by-dayTimeDuration
",
"
divide-yearMonthDuration
",
"
divide-yearMonthDuration-by-yearMonthDuration
",
"
doc
",
"
doc-available
",
"
document-uri
",
"
duration-equal
",
"
element-with-id
",
"
empty
",
"
encode-for-uri
",
"
ends-with
",
"
environment-variable
",
"
error
",
"
escape-html-uri
",
"
exactly-one
",
"
except
",
"
exists
",
"
exp
",
"
exp10
",
"
false
",
"
filter
",
"
floor
",
"
fold-left
",
"
fold-right
",
"
for-each
",
"
for-each-pair
",
"
format-date
",
"
format-dateTime
",
"
format-integer
",
"
format-number
",
"
format-time
",
"
function-arity
",
"
function-lookup
",
"
function-name
",
"
gDay-equal
",
"
generate-id
",
"
gMonthDay-equal
",
"
gMonth-equal
",
"
gYear-equal
",
"
gYearMonth-equal
",
"
has-children
",
"
head
",
"
hexBinary-equal
",
"
hours-from-dateTime
",
"
hours-from-duration
",
"
hours-from-time
",
"
id
",
"
idref
",
"
implicit-timezone
",
"
index-of
",
"
innermost
",
"
in-scope-prefixes
",
"
insert-before
",
"
intersect
",
"
iri-to-uri
",
"
is-same-node
",
"
lang
",
"
last
",
"
local-name
",
"
local-name-from-QName
",
"
log
",
"
log10
",
"
lower-case
",
"
matches
",
"
max
",
"
min
",
"
minutes-from-dateTime
",
"
minutes-from-duration
",
"
minutes-from-time
",
"
month-from-date
",
"
month-from-dateTime
",
"
months-from-duration
",
"
multiply-dayTimeDuration
",
"
multiply-yearMonthDuration
",
"
name
",
"
namespace-uri
",
"
namespace-uri-for-prefix
",
"
namespace-uri-from-QName
",
"
nilled
",
"
node-after
",
"
node-before
",
"
node-name
",
"
normalize-space
",
"
normalize-unicode
",
"
not
",
"
NOTATION-equal
",
"
number
",
"
numeric-add
",
"
numeric-divide
",
"
numeric-equal
",
"
numeric-greater-than
",
"
numeric-integer-divide
",
"
numeric-less-than
",
"
numeric-mod
",
"
numeric-multiply
",
"
numeric-subtract
",
"
numeric-unary-minus
",
"
numeric-unary-plus
",
"
one-or-more
",
"
outermost
",
"
parse-xml
",
"
parse-xml-fragment
",
"
path
",
"
pi
",
"
position
",
"
pow
",
"
prefix-from-QName
",
"
QName
",
"
QName-equal
",
"
remove
",
"
replace
",
"
resolve-QName
",
"
resolve-uri
",
"
reverse
",
"
root
",
"
round
",
"
round-half-to-even
",
"
seconds-from-dateTime
",
"
seconds-from-duration
",
"
seconds-from-time
",
"
serialize
",
"
sin
",
"
sqrt
",
"
starts-with
",
"
static-base-uri
",
"
string
",
"
string-join
",
"
string-length
",
"
string-to-codepoints
",
"
subsequence
",
"
substring
",
"
substring-after
",
"
substring-before
",
"
subtract-dates
",
"
subtract-dateTimes
",
"
subtract-dayTimeDuration-from-date
",
"
subtract-dayTimeDuration-from-dateTime
",
"
subtract-dayTimeDuration-from-time
",
"
subtract-dayTimeDurations
",
"
subtract-times
",
"
subtract-yearMonthDuration-from-date
",
"
subtract-yearMonthDuration-from-dateTime
",
"
subtract-yearMonthDurations
",
"
sum
",
"
tail
",
"
tan
",
"
time-equal
",
"
time-greater-than
",
"
time-less-than
",
"
timezone-from-date
",
"
timezone-from-dateTime
",
"
timezone-from-time
",
"
to
",
"
tokenize
",
"
trace
",
"
translate
",
"
true
",
"
union
",
"
unordered
",
"
unparsed-text
",
"
unparsed-text-available
",
"
unparsed-text-lines
",
"
upper-case
",
"
uri-collection
",
"
year-from-date
",
"
year-from-dateTime
",
"
yearMonthDuration-greater-than
",
"
yearMonthDuration-less-than
",
"
years-from-duration
",
"
zero-or-one
"
);
$query
=
'
(@xqx:prefix !=
\'
fn
\'
) or (true()
';
$query
=
'
(@xqx:prefix !=
\'
fn
\'
) or (true()
';
foreach
(
@functions
)
{
foreach
(
@
XPathStd::
functions
)
{
$query
=
"
$query
and text() != '
$_
'
";
$query
=
"
$query
and text() != '
$_
'
";
}
}
$query
=
"
$query
)
";
$query
=
"
$query
)
";
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment