line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
XML::Easy::Syntax - excruciatingly correct XML syntax |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use XML::Easy::Syntax qw($xml10_name_rx); |
8
|
|
|
|
|
|
|
if($name =~ /\A$xml10_name_rx\z/o) { ... |
9
|
|
|
|
|
|
|
# and many other regular expressions |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This module supplies Perl regular expressions describing the grammar of |
14
|
|
|
|
|
|
|
XML 1.0. This is intended to support doing irregular things with XML, |
15
|
|
|
|
|
|
|
rather than for normal parsing. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
These regular expressions encompass the entire XML grammar except for |
18
|
|
|
|
|
|
|
document type declarations and DTDs. |
19
|
|
|
|
|
|
|
This document assumes general familiarity with XML. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
package XML::Easy::Syntax; |
24
|
|
|
|
|
|
|
|
25
|
10
|
|
|
10
|
|
82537
|
{ use 5.008; } |
|
10
|
|
|
|
|
34
|
|
26
|
10
|
|
|
10
|
|
54
|
use warnings; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
253
|
|
27
|
10
|
|
|
10
|
|
50
|
use strict; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
371
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $VERSION = "0.011"; |
30
|
|
|
|
|
|
|
|
31
|
10
|
|
|
10
|
|
456
|
use parent "Exporter"; |
|
10
|
|
|
|
|
308
|
|
|
10
|
|
|
|
|
55
|
|
32
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
33
|
|
|
|
|
|
|
$xml10_char_rx $xml10_s_rx $xml10_eq_rx |
34
|
|
|
|
|
|
|
$xml10_namestartchar_rx $xml10_namechar_rx |
35
|
|
|
|
|
|
|
$xml10_name_rx $xml10_names_rx $xml10_nmtoken_rx $xml10_nmtokens_rx |
36
|
|
|
|
|
|
|
$xml10_charref_rx $xml10_entityref_rx $xml10_reference_rx |
37
|
|
|
|
|
|
|
$xml10_chardata_rx |
38
|
|
|
|
|
|
|
$xml10_cdata_rx $xml10_cdstart_rx $xml10_cdend_rx $xml10_cdsect_rx |
39
|
|
|
|
|
|
|
$xml10_attvalue_rx $xml10_attribute_rx |
40
|
|
|
|
|
|
|
$xml10_stag_rx $xml10_etag_rx $xml10_emptyelemtag_rx |
41
|
|
|
|
|
|
|
$xml10_comment_rx $xml10_pitarget_rx $xml10_pi_rx |
42
|
|
|
|
|
|
|
$xml10_content_rx $xml10_element_rx |
43
|
|
|
|
|
|
|
$xml10_versionnum_rx $xml10_versioninfo_rx |
44
|
|
|
|
|
|
|
$xml10_encname_rx $xml10_encodingdecl_rx |
45
|
|
|
|
|
|
|
$xml10_sddecl_rx $xml10_xmldecl_rx $xml10_textdecl_rx |
46
|
|
|
|
|
|
|
$xml10_misc_rx $xml10_miscseq_rx |
47
|
|
|
|
|
|
|
$xml10_prolog_xdtd_rx $xml10_document_xdtd_rx $xml10_extparsedent_rx |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub _charclass_regexp($) { |
51
|
30
|
|
|
30
|
|
69
|
my($class) = @_; |
52
|
30
|
|
|
|
|
287
|
$class =~ tr/ \t\n//d; |
53
|
30
|
|
|
|
|
4561
|
return eval("qr/[$class]/"); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 REGULAR EXPRESSIONS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Each of these regular expressions corresponds precisely to one of |
59
|
|
|
|
|
|
|
the productions in the EBNF grammar in the XML 1.0 specification. |
60
|
|
|
|
|
|
|
Well-formedness constraints that are not expressed in the EBNF are |
61
|
|
|
|
|
|
|
I checked by the regular expressions; these are noted in the |
62
|
|
|
|
|
|
|
documentation below. The regular expressions do not include any anchors, |
63
|
|
|
|
|
|
|
so to check whether an entire string matches a production you must supply |
64
|
|
|
|
|
|
|
the anchors yourself. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 Syntax pieces |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=over |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item $xml10_char_rx |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Any single character that is acceptable to XML 1.0. This includes most |
73
|
|
|
|
|
|
|
Unicode characters (up to codepoint 0x10ffff). The excluded codepoints |
74
|
|
|
|
|
|
|
are the sentinels 0xfffe and 0xffff, the surrogate blocks, and most of |
75
|
|
|
|
|
|
|
the C0 control characters (0x00 to 0x1f, except for 0x09 (tab), 0x0a |
76
|
|
|
|
|
|
|
(linefeed/newline), and 0x0d (carriage return)). |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
It is a rule of XML that all characters making up an XML document |
79
|
|
|
|
|
|
|
must be in this permitted set. The grammar productions can only match |
80
|
|
|
|
|
|
|
sequences of acceptable characters. This rule is enforced by the regular |
81
|
|
|
|
|
|
|
expressions in this module. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Furthermore, it is a rule that the character data in a document cannot |
84
|
|
|
|
|
|
|
even I a character outside the permitted set. This is |
85
|
|
|
|
|
|
|
expressed as a well-formedness constraint on character references. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
our $xml10_char_rx = _charclass_regexp(q( |
90
|
|
|
|
|
|
|
\x{9} |
91
|
|
|
|
|
|
|
\x{a} |
92
|
|
|
|
|
|
|
\x{d} |
93
|
|
|
|
|
|
|
\x{20}-\x{d7ff} |
94
|
|
|
|
|
|
|
\x{e000}-\x{fffd} |
95
|
|
|
|
|
|
|
\x{10000}-\x{10ffff} |
96
|
|
|
|
|
|
|
)); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item $xml10_s_rx |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Any sequence of one or more acceptable whitespace characters. The |
101
|
|
|
|
|
|
|
whitespace characters, for this purpose, are tab, linefeed/newline, |
102
|
|
|
|
|
|
|
carriage return, and space. Non-ASCII whitespace characters, and the |
103
|
|
|
|
|
|
|
more exotic ASCII whitespace characters, do not qualify. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
our $xml10_s_rx = qr/[\x{9}\x{a}\x{d}\x{20}]+/; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item $xml10_eq_rx |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Equals sign, surrounded by optional whitespace. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
our $xml10_eq_rx = qr/$xml10_s_rx?=$xml10_s_rx?/o; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=back |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 Names |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=over |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item $xml10_namestartchar_rx |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Any single character that is permitted at the start of a name. |
126
|
|
|
|
|
|
|
The permitted characters are "B<_>", "B<:>", and letters (categorised |
127
|
|
|
|
|
|
|
according to Unicode 2.0). |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This production is not named in the XML specification. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
our $xml10_namestartchar_rx = _charclass_regexp(q( |
134
|
|
|
|
|
|
|
\x{003a} |
135
|
|
|
|
|
|
|
\x{0041}-\x{005a} |
136
|
|
|
|
|
|
|
\x{005f} |
137
|
|
|
|
|
|
|
\x{0061}-\x{007a} |
138
|
|
|
|
|
|
|
\x{00c0}-\x{00d6} |
139
|
|
|
|
|
|
|
\x{00d8}-\x{00f6} |
140
|
|
|
|
|
|
|
\x{00f8}-\x{0131} |
141
|
|
|
|
|
|
|
\x{0134}-\x{013e} |
142
|
|
|
|
|
|
|
\x{0141}-\x{0148} |
143
|
|
|
|
|
|
|
\x{014a}-\x{017e} |
144
|
|
|
|
|
|
|
\x{0180}-\x{01c3} |
145
|
|
|
|
|
|
|
\x{01cd}-\x{01f0} |
146
|
|
|
|
|
|
|
\x{01f4}-\x{01f5} |
147
|
|
|
|
|
|
|
\x{01fa}-\x{0217} |
148
|
|
|
|
|
|
|
\x{0250}-\x{02a8} |
149
|
|
|
|
|
|
|
\x{02bb}-\x{02c1} |
150
|
|
|
|
|
|
|
\x{0386} |
151
|
|
|
|
|
|
|
\x{0388}-\x{038a} |
152
|
|
|
|
|
|
|
\x{038c} |
153
|
|
|
|
|
|
|
\x{038e}-\x{03a1} |
154
|
|
|
|
|
|
|
\x{03a3}-\x{03ce} |
155
|
|
|
|
|
|
|
\x{03d0}-\x{03d6} |
156
|
|
|
|
|
|
|
\x{03da} |
157
|
|
|
|
|
|
|
\x{03dc} |
158
|
|
|
|
|
|
|
\x{03de} |
159
|
|
|
|
|
|
|
\x{03e0} |
160
|
|
|
|
|
|
|
\x{03e2}-\x{03f3} |
161
|
|
|
|
|
|
|
\x{0401}-\x{040c} |
162
|
|
|
|
|
|
|
\x{040e}-\x{044f} |
163
|
|
|
|
|
|
|
\x{0451}-\x{045c} |
164
|
|
|
|
|
|
|
\x{045e}-\x{0481} |
165
|
|
|
|
|
|
|
\x{0490}-\x{04c4} |
166
|
|
|
|
|
|
|
\x{04c7}-\x{04c8} |
167
|
|
|
|
|
|
|
\x{04cb}-\x{04cc} |
168
|
|
|
|
|
|
|
\x{04d0}-\x{04eb} |
169
|
|
|
|
|
|
|
\x{04ee}-\x{04f5} |
170
|
|
|
|
|
|
|
\x{04f8}-\x{04f9} |
171
|
|
|
|
|
|
|
\x{0531}-\x{0556} |
172
|
|
|
|
|
|
|
\x{0559} |
173
|
|
|
|
|
|
|
\x{0561}-\x{0586} |
174
|
|
|
|
|
|
|
\x{05d0}-\x{05ea} |
175
|
|
|
|
|
|
|
\x{05f0}-\x{05f2} |
176
|
|
|
|
|
|
|
\x{0621}-\x{063a} |
177
|
|
|
|
|
|
|
\x{0641}-\x{064a} |
178
|
|
|
|
|
|
|
\x{0671}-\x{06b7} |
179
|
|
|
|
|
|
|
\x{06ba}-\x{06be} |
180
|
|
|
|
|
|
|
\x{06c0}-\x{06ce} |
181
|
|
|
|
|
|
|
\x{06d0}-\x{06d3} |
182
|
|
|
|
|
|
|
\x{06d5} |
183
|
|
|
|
|
|
|
\x{06e5}-\x{06e6} |
184
|
|
|
|
|
|
|
\x{0905}-\x{0939} |
185
|
|
|
|
|
|
|
\x{093d} |
186
|
|
|
|
|
|
|
\x{0958}-\x{0961} |
187
|
|
|
|
|
|
|
\x{0985}-\x{098c} |
188
|
|
|
|
|
|
|
\x{098f}-\x{0990} |
189
|
|
|
|
|
|
|
\x{0993}-\x{09a8} |
190
|
|
|
|
|
|
|
\x{09aa}-\x{09b0} |
191
|
|
|
|
|
|
|
\x{09b2} |
192
|
|
|
|
|
|
|
\x{09b6}-\x{09b9} |
193
|
|
|
|
|
|
|
\x{09dc}-\x{09dd} |
194
|
|
|
|
|
|
|
\x{09df}-\x{09e1} |
195
|
|
|
|
|
|
|
\x{09f0}-\x{09f1} |
196
|
|
|
|
|
|
|
\x{0a05}-\x{0a0a} |
197
|
|
|
|
|
|
|
\x{0a0f}-\x{0a10} |
198
|
|
|
|
|
|
|
\x{0a13}-\x{0a28} |
199
|
|
|
|
|
|
|
\x{0a2a}-\x{0a30} |
200
|
|
|
|
|
|
|
\x{0a32}-\x{0a33} |
201
|
|
|
|
|
|
|
\x{0a35}-\x{0a36} |
202
|
|
|
|
|
|
|
\x{0a38}-\x{0a39} |
203
|
|
|
|
|
|
|
\x{0a59}-\x{0a5c} |
204
|
|
|
|
|
|
|
\x{0a5e} |
205
|
|
|
|
|
|
|
\x{0a72}-\x{0a74} |
206
|
|
|
|
|
|
|
\x{0a85}-\x{0a8b} |
207
|
|
|
|
|
|
|
\x{0a8d} |
208
|
|
|
|
|
|
|
\x{0a8f}-\x{0a91} |
209
|
|
|
|
|
|
|
\x{0a93}-\x{0aa8} |
210
|
|
|
|
|
|
|
\x{0aaa}-\x{0ab0} |
211
|
|
|
|
|
|
|
\x{0ab2}-\x{0ab3} |
212
|
|
|
|
|
|
|
\x{0ab5}-\x{0ab9} |
213
|
|
|
|
|
|
|
\x{0abd} |
214
|
|
|
|
|
|
|
\x{0ae0} |
215
|
|
|
|
|
|
|
\x{0b05}-\x{0b0c} |
216
|
|
|
|
|
|
|
\x{0b0f}-\x{0b10} |
217
|
|
|
|
|
|
|
\x{0b13}-\x{0b28} |
218
|
|
|
|
|
|
|
\x{0b2a}-\x{0b30} |
219
|
|
|
|
|
|
|
\x{0b32}-\x{0b33} |
220
|
|
|
|
|
|
|
\x{0b36}-\x{0b39} |
221
|
|
|
|
|
|
|
\x{0b3d} |
222
|
|
|
|
|
|
|
\x{0b5c}-\x{0b5d} |
223
|
|
|
|
|
|
|
\x{0b5f}-\x{0b61} |
224
|
|
|
|
|
|
|
\x{0b85}-\x{0b8a} |
225
|
|
|
|
|
|
|
\x{0b8e}-\x{0b90} |
226
|
|
|
|
|
|
|
\x{0b92}-\x{0b95} |
227
|
|
|
|
|
|
|
\x{0b99}-\x{0b9a} |
228
|
|
|
|
|
|
|
\x{0b9c} |
229
|
|
|
|
|
|
|
\x{0b9e}-\x{0b9f} |
230
|
|
|
|
|
|
|
\x{0ba3}-\x{0ba4} |
231
|
|
|
|
|
|
|
\x{0ba8}-\x{0baa} |
232
|
|
|
|
|
|
|
\x{0bae}-\x{0bb5} |
233
|
|
|
|
|
|
|
\x{0bb7}-\x{0bb9} |
234
|
|
|
|
|
|
|
\x{0c05}-\x{0c0c} |
235
|
|
|
|
|
|
|
\x{0c0e}-\x{0c10} |
236
|
|
|
|
|
|
|
\x{0c12}-\x{0c28} |
237
|
|
|
|
|
|
|
\x{0c2a}-\x{0c33} |
238
|
|
|
|
|
|
|
\x{0c35}-\x{0c39} |
239
|
|
|
|
|
|
|
\x{0c60}-\x{0c61} |
240
|
|
|
|
|
|
|
\x{0c85}-\x{0c8c} |
241
|
|
|
|
|
|
|
\x{0c8e}-\x{0c90} |
242
|
|
|
|
|
|
|
\x{0c92}-\x{0ca8} |
243
|
|
|
|
|
|
|
\x{0caa}-\x{0cb3} |
244
|
|
|
|
|
|
|
\x{0cb5}-\x{0cb9} |
245
|
|
|
|
|
|
|
\x{0cde} |
246
|
|
|
|
|
|
|
\x{0ce0}-\x{0ce1} |
247
|
|
|
|
|
|
|
\x{0d05}-\x{0d0c} |
248
|
|
|
|
|
|
|
\x{0d0e}-\x{0d10} |
249
|
|
|
|
|
|
|
\x{0d12}-\x{0d28} |
250
|
|
|
|
|
|
|
\x{0d2a}-\x{0d39} |
251
|
|
|
|
|
|
|
\x{0d60}-\x{0d61} |
252
|
|
|
|
|
|
|
\x{0e01}-\x{0e2e} |
253
|
|
|
|
|
|
|
\x{0e30} |
254
|
|
|
|
|
|
|
\x{0e32}-\x{0e33} |
255
|
|
|
|
|
|
|
\x{0e40}-\x{0e45} |
256
|
|
|
|
|
|
|
\x{0e81}-\x{0e82} |
257
|
|
|
|
|
|
|
\x{0e84} |
258
|
|
|
|
|
|
|
\x{0e87}-\x{0e88} |
259
|
|
|
|
|
|
|
\x{0e8a} |
260
|
|
|
|
|
|
|
\x{0e8d} |
261
|
|
|
|
|
|
|
\x{0e94}-\x{0e97} |
262
|
|
|
|
|
|
|
\x{0e99}-\x{0e9f} |
263
|
|
|
|
|
|
|
\x{0ea1}-\x{0ea3} |
264
|
|
|
|
|
|
|
\x{0ea5} |
265
|
|
|
|
|
|
|
\x{0ea7} |
266
|
|
|
|
|
|
|
\x{0eaa}-\x{0eab} |
267
|
|
|
|
|
|
|
\x{0ead}-\x{0eae} |
268
|
|
|
|
|
|
|
\x{0eb0} |
269
|
|
|
|
|
|
|
\x{0eb2}-\x{0eb3} |
270
|
|
|
|
|
|
|
\x{0ebd} |
271
|
|
|
|
|
|
|
\x{0ec0}-\x{0ec4} |
272
|
|
|
|
|
|
|
\x{0f40}-\x{0f47} |
273
|
|
|
|
|
|
|
\x{0f49}-\x{0f69} |
274
|
|
|
|
|
|
|
\x{10a0}-\x{10c5} |
275
|
|
|
|
|
|
|
\x{10d0}-\x{10f6} |
276
|
|
|
|
|
|
|
\x{1100} |
277
|
|
|
|
|
|
|
\x{1102}-\x{1103} |
278
|
|
|
|
|
|
|
\x{1105}-\x{1107} |
279
|
|
|
|
|
|
|
\x{1109} |
280
|
|
|
|
|
|
|
\x{110b}-\x{110c} |
281
|
|
|
|
|
|
|
\x{110e}-\x{1112} |
282
|
|
|
|
|
|
|
\x{113c} |
283
|
|
|
|
|
|
|
\x{113e} |
284
|
|
|
|
|
|
|
\x{1140} |
285
|
|
|
|
|
|
|
\x{114c} |
286
|
|
|
|
|
|
|
\x{114e} |
287
|
|
|
|
|
|
|
\x{1150} |
288
|
|
|
|
|
|
|
\x{1154}-\x{1155} |
289
|
|
|
|
|
|
|
\x{1159} |
290
|
|
|
|
|
|
|
\x{115f}-\x{1161} |
291
|
|
|
|
|
|
|
\x{1163} |
292
|
|
|
|
|
|
|
\x{1165} |
293
|
|
|
|
|
|
|
\x{1167} |
294
|
|
|
|
|
|
|
\x{1169} |
295
|
|
|
|
|
|
|
\x{116d}-\x{116e} |
296
|
|
|
|
|
|
|
\x{1172}-\x{1173} |
297
|
|
|
|
|
|
|
\x{1175} |
298
|
|
|
|
|
|
|
\x{119e} |
299
|
|
|
|
|
|
|
\x{11a8} |
300
|
|
|
|
|
|
|
\x{11ab} |
301
|
|
|
|
|
|
|
\x{11ae}-\x{11af} |
302
|
|
|
|
|
|
|
\x{11b7}-\x{11b8} |
303
|
|
|
|
|
|
|
\x{11ba} |
304
|
|
|
|
|
|
|
\x{11bc}-\x{11c2} |
305
|
|
|
|
|
|
|
\x{11eb} |
306
|
|
|
|
|
|
|
\x{11f0} |
307
|
|
|
|
|
|
|
\x{11f9} |
308
|
|
|
|
|
|
|
\x{1e00}-\x{1e9b} |
309
|
|
|
|
|
|
|
\x{1ea0}-\x{1ef9} |
310
|
|
|
|
|
|
|
\x{1f00}-\x{1f15} |
311
|
|
|
|
|
|
|
\x{1f18}-\x{1f1d} |
312
|
|
|
|
|
|
|
\x{1f20}-\x{1f45} |
313
|
|
|
|
|
|
|
\x{1f48}-\x{1f4d} |
314
|
|
|
|
|
|
|
\x{1f50}-\x{1f57} |
315
|
|
|
|
|
|
|
\x{1f59} |
316
|
|
|
|
|
|
|
\x{1f5b} |
317
|
|
|
|
|
|
|
\x{1f5d} |
318
|
|
|
|
|
|
|
\x{1f5f}-\x{1f7d} |
319
|
|
|
|
|
|
|
\x{1f80}-\x{1fb4} |
320
|
|
|
|
|
|
|
\x{1fb6}-\x{1fbc} |
321
|
|
|
|
|
|
|
\x{1fbe} |
322
|
|
|
|
|
|
|
\x{1fc2}-\x{1fc4} |
323
|
|
|
|
|
|
|
\x{1fc6}-\x{1fcc} |
324
|
|
|
|
|
|
|
\x{1fd0}-\x{1fd3} |
325
|
|
|
|
|
|
|
\x{1fd6}-\x{1fdb} |
326
|
|
|
|
|
|
|
\x{1fe0}-\x{1fec} |
327
|
|
|
|
|
|
|
\x{1ff2}-\x{1ff4} |
328
|
|
|
|
|
|
|
\x{1ff6}-\x{1ffc} |
329
|
|
|
|
|
|
|
\x{2126} |
330
|
|
|
|
|
|
|
\x{212a}-\x{212b} |
331
|
|
|
|
|
|
|
\x{212e} |
332
|
|
|
|
|
|
|
\x{2180}-\x{2182} |
333
|
|
|
|
|
|
|
\x{3007} |
334
|
|
|
|
|
|
|
\x{3021}-\x{3029} |
335
|
|
|
|
|
|
|
\x{3041}-\x{3094} |
336
|
|
|
|
|
|
|
\x{30a1}-\x{30fa} |
337
|
|
|
|
|
|
|
\x{3105}-\x{312c} |
338
|
|
|
|
|
|
|
\x{4e00}-\x{9fa5} |
339
|
|
|
|
|
|
|
\x{ac00}-\x{d7a3} |
340
|
|
|
|
|
|
|
)); |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=item $xml10_namechar_rx |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
Any single character that is permitted in a name other than at the start. |
345
|
|
|
|
|
|
|
The permitted characters are "B<.>", "B<->", "B<_>", "B<:>", and letters, |
346
|
|
|
|
|
|
|
digits, combining characters, and extenders (categorised according to |
347
|
|
|
|
|
|
|
Unicode 2.0). |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=cut |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
our $xml10_namechar_rx = _charclass_regexp(q( |
352
|
|
|
|
|
|
|
\x{002d}-\x{002e} |
353
|
|
|
|
|
|
|
\x{0030}-\x{003a} |
354
|
|
|
|
|
|
|
\x{0041}-\x{005a} |
355
|
|
|
|
|
|
|
\x{005f} |
356
|
|
|
|
|
|
|
\x{0061}-\x{007a} |
357
|
|
|
|
|
|
|
\x{00b7} |
358
|
|
|
|
|
|
|
\x{00c0}-\x{00d6} |
359
|
|
|
|
|
|
|
\x{00d8}-\x{00f6} |
360
|
|
|
|
|
|
|
\x{00f8}-\x{0131} |
361
|
|
|
|
|
|
|
\x{0134}-\x{013e} |
362
|
|
|
|
|
|
|
\x{0141}-\x{0148} |
363
|
|
|
|
|
|
|
\x{014a}-\x{017e} |
364
|
|
|
|
|
|
|
\x{0180}-\x{01c3} |
365
|
|
|
|
|
|
|
\x{01cd}-\x{01f0} |
366
|
|
|
|
|
|
|
\x{01f4}-\x{01f5} |
367
|
|
|
|
|
|
|
\x{01fa}-\x{0217} |
368
|
|
|
|
|
|
|
\x{0250}-\x{02a8} |
369
|
|
|
|
|
|
|
\x{02bb}-\x{02c1} |
370
|
|
|
|
|
|
|
\x{02d0}-\x{02d1} |
371
|
|
|
|
|
|
|
\x{0300}-\x{0345} |
372
|
|
|
|
|
|
|
\x{0360}-\x{0361} |
373
|
|
|
|
|
|
|
\x{0387}-\x{038a} |
374
|
|
|
|
|
|
|
\x{038c} |
375
|
|
|
|
|
|
|
\x{038e}-\x{03a1} |
376
|
|
|
|
|
|
|
\x{03a3}-\x{03ce} |
377
|
|
|
|
|
|
|
\x{03d0}-\x{03d6} |
378
|
|
|
|
|
|
|
\x{03da} |
379
|
|
|
|
|
|
|
\x{03dc} |
380
|
|
|
|
|
|
|
\x{03de} |
381
|
|
|
|
|
|
|
\x{03e0} |
382
|
|
|
|
|
|
|
\x{03e2}-\x{03f3} |
383
|
|
|
|
|
|
|
\x{0401}-\x{040c} |
384
|
|
|
|
|
|
|
\x{040e}-\x{044f} |
385
|
|
|
|
|
|
|
\x{0451}-\x{045c} |
386
|
|
|
|
|
|
|
\x{045e}-\x{0481} |
387
|
|
|
|
|
|
|
\x{0483}-\x{0486} |
388
|
|
|
|
|
|
|
\x{0490}-\x{04c4} |
389
|
|
|
|
|
|
|
\x{04c7}-\x{04c8} |
390
|
|
|
|
|
|
|
\x{04cb}-\x{04cc} |
391
|
|
|
|
|
|
|
\x{04d0}-\x{04eb} |
392
|
|
|
|
|
|
|
\x{04ee}-\x{04f5} |
393
|
|
|
|
|
|
|
\x{04f8}-\x{04f9} |
394
|
|
|
|
|
|
|
\x{0531}-\x{0556} |
395
|
|
|
|
|
|
|
\x{0559} |
396
|
|
|
|
|
|
|
\x{0561}-\x{0586} |
397
|
|
|
|
|
|
|
\x{0591}-\x{05a1} |
398
|
|
|
|
|
|
|
\x{05a3}-\x{05b9} |
399
|
|
|
|
|
|
|
\x{05bb}-\x{05bd} |
400
|
|
|
|
|
|
|
\x{05bf} |
401
|
|
|
|
|
|
|
\x{05c1}-\x{05c2} |
402
|
|
|
|
|
|
|
\x{05c4} |
403
|
|
|
|
|
|
|
\x{05d0}-\x{05ea} |
404
|
|
|
|
|
|
|
\x{05f0}-\x{05f2} |
405
|
|
|
|
|
|
|
\x{0621}-\x{063a} |
406
|
|
|
|
|
|
|
\x{0641}-\x{0652} |
407
|
|
|
|
|
|
|
\x{0660}-\x{0669} |
408
|
|
|
|
|
|
|
\x{0670}-\x{06b7} |
409
|
|
|
|
|
|
|
\x{06ba}-\x{06be} |
410
|
|
|
|
|
|
|
\x{06c0}-\x{06ce} |
411
|
|
|
|
|
|
|
\x{06d0}-\x{06d3} |
412
|
|
|
|
|
|
|
\x{06e5}-\x{06e8} |
413
|
|
|
|
|
|
|
\x{06ea}-\x{06ed} |
414
|
|
|
|
|
|
|
\x{06f0}-\x{06f9} |
415
|
|
|
|
|
|
|
\x{0901}-\x{0903} |
416
|
|
|
|
|
|
|
\x{0905}-\x{0939} |
417
|
|
|
|
|
|
|
\x{093e}-\x{094d} |
418
|
|
|
|
|
|
|
\x{0951}-\x{0954} |
419
|
|
|
|
|
|
|
\x{0958}-\x{0963} |
420
|
|
|
|
|
|
|
\x{0966}-\x{096f} |
421
|
|
|
|
|
|
|
\x{0981}-\x{0983} |
422
|
|
|
|
|
|
|
\x{0985}-\x{098c} |
423
|
|
|
|
|
|
|
\x{098f}-\x{0990} |
424
|
|
|
|
|
|
|
\x{0993}-\x{09a8} |
425
|
|
|
|
|
|
|
\x{09aa}-\x{09b0} |
426
|
|
|
|
|
|
|
\x{09b2} |
427
|
|
|
|
|
|
|
\x{09b6}-\x{09b9} |
428
|
|
|
|
|
|
|
\x{09bc} |
429
|
|
|
|
|
|
|
\x{09bf}-\x{09c4} |
430
|
|
|
|
|
|
|
\x{09c7}-\x{09c8} |
431
|
|
|
|
|
|
|
\x{09cb}-\x{09cd} |
432
|
|
|
|
|
|
|
\x{09d7} |
433
|
|
|
|
|
|
|
\x{09dc}-\x{09dd} |
434
|
|
|
|
|
|
|
\x{09df}-\x{09e3} |
435
|
|
|
|
|
|
|
\x{09e6}-\x{09f1} |
436
|
|
|
|
|
|
|
\x{0a02} |
437
|
|
|
|
|
|
|
\x{0a05}-\x{0a0a} |
438
|
|
|
|
|
|
|
\x{0a0f}-\x{0a10} |
439
|
|
|
|
|
|
|
\x{0a13}-\x{0a28} |
440
|
|
|
|
|
|
|
\x{0a2a}-\x{0a30} |
441
|
|
|
|
|
|
|
\x{0a32}-\x{0a33} |
442
|
|
|
|
|
|
|
\x{0a35}-\x{0a36} |
443
|
|
|
|
|
|
|
\x{0a38}-\x{0a39} |
444
|
|
|
|
|
|
|
\x{0a3c} |
445
|
|
|
|
|
|
|
\x{0a3f}-\x{0a42} |
446
|
|
|
|
|
|
|
\x{0a47}-\x{0a48} |
447
|
|
|
|
|
|
|
\x{0a4b}-\x{0a4d} |
448
|
|
|
|
|
|
|
\x{0a59}-\x{0a5c} |
449
|
|
|
|
|
|
|
\x{0a5e} |
450
|
|
|
|
|
|
|
\x{0a70}-\x{0a74} |
451
|
|
|
|
|
|
|
\x{0a81}-\x{0a83} |
452
|
|
|
|
|
|
|
\x{0a85}-\x{0a8b} |
453
|
|
|
|
|
|
|
\x{0a8d} |
454
|
|
|
|
|
|
|
\x{0a8f}-\x{0a91} |
455
|
|
|
|
|
|
|
\x{0a93}-\x{0aa8} |
456
|
|
|
|
|
|
|
\x{0aaa}-\x{0ab0} |
457
|
|
|
|
|
|
|
\x{0ab2}-\x{0ab3} |
458
|
|
|
|
|
|
|
\x{0ab5}-\x{0ab9} |
459
|
|
|
|
|
|
|
\x{0abd}-\x{0ac5} |
460
|
|
|
|
|
|
|
\x{0ac7}-\x{0ac9} |
461
|
|
|
|
|
|
|
\x{0acb}-\x{0acd} |
462
|
|
|
|
|
|
|
\x{0ae0} |
463
|
|
|
|
|
|
|
\x{0ae6}-\x{0aef} |
464
|
|
|
|
|
|
|
\x{0b01}-\x{0b03} |
465
|
|
|
|
|
|
|
\x{0b05}-\x{0b0c} |
466
|
|
|
|
|
|
|
\x{0b0f}-\x{0b10} |
467
|
|
|
|
|
|
|
\x{0b13}-\x{0b28} |
468
|
|
|
|
|
|
|
\x{0b2a}-\x{0b30} |
469
|
|
|
|
|
|
|
\x{0b32}-\x{0b33} |
470
|
|
|
|
|
|
|
\x{0b36}-\x{0b39} |
471
|
|
|
|
|
|
|
\x{0b3d}-\x{0b43} |
472
|
|
|
|
|
|
|
\x{0b47}-\x{0b48} |
473
|
|
|
|
|
|
|
\x{0b4b}-\x{0b4d} |
474
|
|
|
|
|
|
|
\x{0b56}-\x{0b57} |
475
|
|
|
|
|
|
|
\x{0b5c}-\x{0b5d} |
476
|
|
|
|
|
|
|
\x{0b5f}-\x{0b61} |
477
|
|
|
|
|
|
|
\x{0b66}-\x{0b6f} |
478
|
|
|
|
|
|
|
\x{0b82}-\x{0b83} |
479
|
|
|
|
|
|
|
\x{0b85}-\x{0b8a} |
480
|
|
|
|
|
|
|
\x{0b8e}-\x{0b90} |
481
|
|
|
|
|
|
|
\x{0b92}-\x{0b95} |
482
|
|
|
|
|
|
|
\x{0b99}-\x{0b9a} |
483
|
|
|
|
|
|
|
\x{0b9c} |
484
|
|
|
|
|
|
|
\x{0b9e}-\x{0b9f} |
485
|
|
|
|
|
|
|
\x{0ba3}-\x{0ba4} |
486
|
|
|
|
|
|
|
\x{0ba8}-\x{0baa} |
487
|
|
|
|
|
|
|
\x{0bae}-\x{0bb5} |
488
|
|
|
|
|
|
|
\x{0bb7}-\x{0bb9} |
489
|
|
|
|
|
|
|
\x{0bbe}-\x{0bc2} |
490
|
|
|
|
|
|
|
\x{0bc6}-\x{0bc8} |
491
|
|
|
|
|
|
|
\x{0bca}-\x{0bcd} |
492
|
|
|
|
|
|
|
\x{0bd7} |
493
|
|
|
|
|
|
|
\x{0be7}-\x{0bef} |
494
|
|
|
|
|
|
|
\x{0c01}-\x{0c03} |
495
|
|
|
|
|
|
|
\x{0c05}-\x{0c0c} |
496
|
|
|
|
|
|
|
\x{0c0e}-\x{0c10} |
497
|
|
|
|
|
|
|
\x{0c12}-\x{0c28} |
498
|
|
|
|
|
|
|
\x{0c2a}-\x{0c33} |
499
|
|
|
|
|
|
|
\x{0c35}-\x{0c39} |
500
|
|
|
|
|
|
|
\x{0c3e}-\x{0c44} |
501
|
|
|
|
|
|
|
\x{0c46}-\x{0c48} |
502
|
|
|
|
|
|
|
\x{0c4a}-\x{0c4d} |
503
|
|
|
|
|
|
|
\x{0c55}-\x{0c56} |
504
|
|
|
|
|
|
|
\x{0c60}-\x{0c61} |
505
|
|
|
|
|
|
|
\x{0c66}-\x{0c6f} |
506
|
|
|
|
|
|
|
\x{0c82}-\x{0c83} |
507
|
|
|
|
|
|
|
\x{0c85}-\x{0c8c} |
508
|
|
|
|
|
|
|
\x{0c8e}-\x{0c90} |
509
|
|
|
|
|
|
|
\x{0c92}-\x{0ca8} |
510
|
|
|
|
|
|
|
\x{0caa}-\x{0cb3} |
511
|
|
|
|
|
|
|
\x{0cb5}-\x{0cb9} |
512
|
|
|
|
|
|
|
\x{0cbe}-\x{0cc4} |
513
|
|
|
|
|
|
|
\x{0cc6}-\x{0cc8} |
514
|
|
|
|
|
|
|
\x{0cca}-\x{0ccd} |
515
|
|
|
|
|
|
|
\x{0cd5}-\x{0cd6} |
516
|
|
|
|
|
|
|
\x{0cde} |
517
|
|
|
|
|
|
|
\x{0ce0}-\x{0ce1} |
518
|
|
|
|
|
|
|
\x{0ce6}-\x{0cef} |
519
|
|
|
|
|
|
|
\x{0d02}-\x{0d03} |
520
|
|
|
|
|
|
|
\x{0d05}-\x{0d0c} |
521
|
|
|
|
|
|
|
\x{0d0e}-\x{0d10} |
522
|
|
|
|
|
|
|
\x{0d12}-\x{0d28} |
523
|
|
|
|
|
|
|
\x{0d2a}-\x{0d39} |
524
|
|
|
|
|
|
|
\x{0d3e}-\x{0d43} |
525
|
|
|
|
|
|
|
\x{0d46}-\x{0d48} |
526
|
|
|
|
|
|
|
\x{0d4a}-\x{0d4d} |
527
|
|
|
|
|
|
|
\x{0d57} |
528
|
|
|
|
|
|
|
\x{0d60}-\x{0d61} |
529
|
|
|
|
|
|
|
\x{0d66}-\x{0d6f} |
530
|
|
|
|
|
|
|
\x{0e01}-\x{0e2e} |
531
|
|
|
|
|
|
|
\x{0e32}-\x{0e3a} |
532
|
|
|
|
|
|
|
\x{0e46}-\x{0e4e} |
533
|
|
|
|
|
|
|
\x{0e50}-\x{0e59} |
534
|
|
|
|
|
|
|
\x{0e81}-\x{0e82} |
535
|
|
|
|
|
|
|
\x{0e84} |
536
|
|
|
|
|
|
|
\x{0e87}-\x{0e88} |
537
|
|
|
|
|
|
|
\x{0e8a} |
538
|
|
|
|
|
|
|
\x{0e8d} |
539
|
|
|
|
|
|
|
\x{0e94}-\x{0e97} |
540
|
|
|
|
|
|
|
\x{0e99}-\x{0e9f} |
541
|
|
|
|
|
|
|
\x{0ea1}-\x{0ea3} |
542
|
|
|
|
|
|
|
\x{0ea5} |
543
|
|
|
|
|
|
|
\x{0ea7} |
544
|
|
|
|
|
|
|
\x{0eaa}-\x{0eab} |
545
|
|
|
|
|
|
|
\x{0ead}-\x{0eae} |
546
|
|
|
|
|
|
|
\x{0eb2}-\x{0eb9} |
547
|
|
|
|
|
|
|
\x{0ebb}-\x{0ebd} |
548
|
|
|
|
|
|
|
\x{0ec0}-\x{0ec4} |
549
|
|
|
|
|
|
|
\x{0ec6} |
550
|
|
|
|
|
|
|
\x{0ec8}-\x{0ecd} |
551
|
|
|
|
|
|
|
\x{0ed0}-\x{0ed9} |
552
|
|
|
|
|
|
|
\x{0f18}-\x{0f19} |
553
|
|
|
|
|
|
|
\x{0f20}-\x{0f29} |
554
|
|
|
|
|
|
|
\x{0f35} |
555
|
|
|
|
|
|
|
\x{0f37} |
556
|
|
|
|
|
|
|
\x{0f39} |
557
|
|
|
|
|
|
|
\x{0f3f}-\x{0f47} |
558
|
|
|
|
|
|
|
\x{0f49}-\x{0f69} |
559
|
|
|
|
|
|
|
\x{0f71}-\x{0f84} |
560
|
|
|
|
|
|
|
\x{0f86}-\x{0f8b} |
561
|
|
|
|
|
|
|
\x{0f90}-\x{0f95} |
562
|
|
|
|
|
|
|
\x{0f97} |
563
|
|
|
|
|
|
|
\x{0f99}-\x{0fad} |
564
|
|
|
|
|
|
|
\x{0fb1}-\x{0fb7} |
565
|
|
|
|
|
|
|
\x{0fb9} |
566
|
|
|
|
|
|
|
\x{10a0}-\x{10c5} |
567
|
|
|
|
|
|
|
\x{10d0}-\x{10f6} |
568
|
|
|
|
|
|
|
\x{1100} |
569
|
|
|
|
|
|
|
\x{1102}-\x{1103} |
570
|
|
|
|
|
|
|
\x{1105}-\x{1107} |
571
|
|
|
|
|
|
|
\x{1109} |
572
|
|
|
|
|
|
|
\x{110b}-\x{110c} |
573
|
|
|
|
|
|
|
\x{110e}-\x{1112} |
574
|
|
|
|
|
|
|
\x{113c} |
575
|
|
|
|
|
|
|
\x{113e} |
576
|
|
|
|
|
|
|
\x{1140} |
577
|
|
|
|
|
|
|
\x{114c} |
578
|
|
|
|
|
|
|
\x{114e} |
579
|
|
|
|
|
|
|
\x{1150} |
580
|
|
|
|
|
|
|
\x{1154}-\x{1155} |
581
|
|
|
|
|
|
|
\x{1159} |
582
|
|
|
|
|
|
|
\x{115f}-\x{1161} |
583
|
|
|
|
|
|
|
\x{1163} |
584
|
|
|
|
|
|
|
\x{1165} |
585
|
|
|
|
|
|
|
\x{1167} |
586
|
|
|
|
|
|
|
\x{1169} |
587
|
|
|
|
|
|
|
\x{116d}-\x{116e} |
588
|
|
|
|
|
|
|
\x{1172}-\x{1173} |
589
|
|
|
|
|
|
|
\x{1175} |
590
|
|
|
|
|
|
|
\x{119e} |
591
|
|
|
|
|
|
|
\x{11a8} |
592
|
|
|
|
|
|
|
\x{11ab} |
593
|
|
|
|
|
|
|
\x{11ae}-\x{11af} |
594
|
|
|
|
|
|
|
\x{11b7}-\x{11b8} |
595
|
|
|
|
|
|
|
\x{11ba} |
596
|
|
|
|
|
|
|
\x{11bc}-\x{11c2} |
597
|
|
|
|
|
|
|
\x{11eb} |
598
|
|
|
|
|
|
|
\x{11f0} |
599
|
|
|
|
|
|
|
\x{11f9} |
600
|
|
|
|
|
|
|
\x{1e00}-\x{1e9b} |
601
|
|
|
|
|
|
|
\x{1ea0}-\x{1ef9} |
602
|
|
|
|
|
|
|
\x{1f00}-\x{1f15} |
603
|
|
|
|
|
|
|
\x{1f18}-\x{1f1d} |
604
|
|
|
|
|
|
|
\x{1f20}-\x{1f45} |
605
|
|
|
|
|
|
|
\x{1f48}-\x{1f4d} |
606
|
|
|
|
|
|
|
\x{1f50}-\x{1f57} |
607
|
|
|
|
|
|
|
\x{1f59} |
608
|
|
|
|
|
|
|
\x{1f5b} |
609
|
|
|
|
|
|
|
\x{1f5d} |
610
|
|
|
|
|
|
|
\x{1f5f}-\x{1f7d} |
611
|
|
|
|
|
|
|
\x{1f80}-\x{1fb4} |
612
|
|
|
|
|
|
|
\x{1fb6}-\x{1fbc} |
613
|
|
|
|
|
|
|
\x{1fbe} |
614
|
|
|
|
|
|
|
\x{1fc2}-\x{1fc4} |
615
|
|
|
|
|
|
|
\x{1fc6}-\x{1fcc} |
616
|
|
|
|
|
|
|
\x{1fd0}-\x{1fd3} |
617
|
|
|
|
|
|
|
\x{1fd6}-\x{1fdb} |
618
|
|
|
|
|
|
|
\x{1fe0}-\x{1fec} |
619
|
|
|
|
|
|
|
\x{1ff2}-\x{1ff4} |
620
|
|
|
|
|
|
|
\x{1ff6}-\x{1ffc} |
621
|
|
|
|
|
|
|
\x{20d0}-\x{20dc} |
622
|
|
|
|
|
|
|
\x{20e1} |
623
|
|
|
|
|
|
|
\x{2126} |
624
|
|
|
|
|
|
|
\x{212a}-\x{212b} |
625
|
|
|
|
|
|
|
\x{212e} |
626
|
|
|
|
|
|
|
\x{2180}-\x{2182} |
627
|
|
|
|
|
|
|
\x{3005} |
628
|
|
|
|
|
|
|
\x{3007} |
629
|
|
|
|
|
|
|
\x{3021}-\x{302f} |
630
|
|
|
|
|
|
|
\x{3031}-\x{3035} |
631
|
|
|
|
|
|
|
\x{3041}-\x{3094} |
632
|
|
|
|
|
|
|
\x{3099}-\x{309a} |
633
|
|
|
|
|
|
|
\x{309d}-\x{309e} |
634
|
|
|
|
|
|
|
\x{30a1}-\x{30fa} |
635
|
|
|
|
|
|
|
\x{30fc}-\x{30fe} |
636
|
|
|
|
|
|
|
\x{3105}-\x{312c} |
637
|
|
|
|
|
|
|
\x{4e00}-\x{9fa5} |
638
|
|
|
|
|
|
|
\x{ac00}-\x{d7a3} |
639
|
|
|
|
|
|
|
)); |
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
=item $xml10_name_rx |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
A name, of the type used to identify element types, attributes, entities, |
644
|
|
|
|
|
|
|
and other things in XML. |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=cut |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
our $xml10_name_rx = qr/$xml10_namestartchar_rx$xml10_namechar_rx*/o; |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
=item $xml10_names_rx |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
A space-separated list of one or more names. |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=cut |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
our $xml10_names_rx = qr/$xml10_name_rx(?:\x{20}$xml10_name_rx)*/o; |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
=item $xml10_nmtoken_rx |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
A name-like token, much like a name except that the first character is |
661
|
|
|
|
|
|
|
no more restricted than the remaining characters. These tokens play no |
662
|
|
|
|
|
|
|
part in basic XML syntax, and in the specification are only used as part |
663
|
|
|
|
|
|
|
of attribute typing. |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
=cut |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
our $xml10_nmtoken_rx = qr/$xml10_namechar_rx+/o; |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=item $xml10_nmtokens_rx |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
A space-separated list of one or more name-like tokens. |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
=cut |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
our $xml10_nmtokens_rx = qr/$xml10_nmtoken_rx(?:\x{20}$xml10_nmtoken_rx)*/o; |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
=back |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=head2 References |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=over |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=item $xml10_charref_rx |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
A numeric character reference (beginning with "B<>" and ending with |
686
|
|
|
|
|
|
|
"B<;>"). There is a non-syntactic well-formedness constraint: the |
687
|
|
|
|
|
|
|
codepoint is required to be within the Unicode range and to refer to an |
688
|
|
|
|
|
|
|
acceptable character (as discussed at C<$xml10_char_rx>). |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
=cut |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
our $xml10_charref_rx = qr/(?:[0-9]+|x[0-9a-fA-F]+);/; |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=item $xml10_entityref_rx |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
A general entity reference (beginning with "B<&>" and ending with "B<;>"). |
697
|
|
|
|
|
|
|
There are non-syntactic well-formedness constraints: the referenced entity |
698
|
|
|
|
|
|
|
must be declared (possibly implicitly), must not be an unparsed entity, |
699
|
|
|
|
|
|
|
must not contain a recursive reference to itself, and its replacement |
700
|
|
|
|
|
|
|
text must itself be well-formed. |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
=cut |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
our $xml10_entityref_rx = qr/&$xml10_name_rx;/o; |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=item $xml10_reference_rx |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
Either a character reference or an entity reference. The well-formedness |
709
|
|
|
|
|
|
|
constraints of both reference types (see above) apply. |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
=cut |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
our $xml10_reference_rx = qr/$xml10_entityref_rx|$xml10_charref_rx/o; |
714
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
=back |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
=head2 Character data |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
=over |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
=item $xml10_chardata_rx |
722
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
Ordinary literal character data. This consists of zero or more acceptable |
724
|
|
|
|
|
|
|
characters, other than the metacharacters "B<< < >>" and "B<&>", and |
725
|
|
|
|
|
|
|
not including "B<< ]]> >>" as a subsequence. Such data stands for |
726
|
|
|
|
|
|
|
itself when it appears between the start and end tags of an element, |
727
|
|
|
|
|
|
|
where it can be interspersed with references, CDATA sections, comments, |
728
|
|
|
|
|
|
|
and processing instructions. |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
In the XML grammar, character data is parsed, and taken literally, |
731
|
|
|
|
|
|
|
I line endings have been canonicalised (to the newline character). |
732
|
|
|
|
|
|
|
Pre-canonicalisation character data, with variable line endings, will |
733
|
|
|
|
|
|
|
still match this production but should not be interpreted literally. |
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
Beware that a string that does not match this production might parse as |
736
|
|
|
|
|
|
|
two adjacent strings each of which matches. This can happen because |
737
|
|
|
|
|
|
|
of the prohibition on "B<< ]]> >>" being embedded in character data, |
738
|
|
|
|
|
|
|
while the characters of that sequence are acceptable individually. |
739
|
|
|
|
|
|
|
The XML grammar does not allow two instances of this production to abut. |
740
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
=cut |
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
our $xml10_chardata_rx = qr/(?: |
744
|
|
|
|
|
|
|
\]?(?![<&\]])$xml10_char_rx |
745
|
|
|
|
|
|
|
|\]{2,}(?![<&\>\]])$xml10_char_rx |
746
|
|
|
|
|
|
|
)*\]*/xo; |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=item $xml10_cdata_rx |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
Literal character data in a CDATA section. This consists of zero or |
751
|
|
|
|
|
|
|
more acceptable characters, not including "B<< ]]> >>" as a subsequence. |
752
|
|
|
|
|
|
|
Unlike ordinary literal character data, the characters "B<< < >>" and |
753
|
|
|
|
|
|
|
"B<&>" are not metacharacters here. Such data stands for itself when |
754
|
|
|
|
|
|
|
it appears within a CDATA section. |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
As with ordinary literal character data (see above), this data is meant |
757
|
|
|
|
|
|
|
to be taken literally only after line endings have been canonicalised. |
758
|
|
|
|
|
|
|
Also, as with ordinary literal character data, two instances of this |
759
|
|
|
|
|
|
|
production should not abut. |
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
=cut |
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
our $xml10_cdata_rx = qr/(?: |
764
|
|
|
|
|
|
|
\]?(?!\])$xml10_char_rx |
765
|
|
|
|
|
|
|
|\]{2,}(?![\>\]])$xml10_char_rx |
766
|
|
|
|
|
|
|
)*\]*/xo; |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=item $xml10_cdstart_rx |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
=item $xml10_cdend_rx |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
The fixed strings "B<< >" and "B<< ]]> >>" which begin and |
773
|
|
|
|
|
|
|
finish a CDATA section. |
774
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
=cut |
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
our $xml10_cdstart_rx = qr/
|
778
|
|
|
|
|
|
|
our $xml10_cdend_rx = qr/\]\]>/; |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=item $xml10_cdsect_rx |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
A CDATA section. This consists of "B<< >", literal character |
783
|
|
|
|
|
|
|
data with metacharacters disabled, and "B<< ]]> >>". |
784
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
=cut |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
# Note: using the $xml10_cdata_rx regexp (from above) here would be much |
788
|
|
|
|
|
|
|
# less efficient than this use of (?>...). It would also run into the |
789
|
|
|
|
|
|
|
# perl bug described in L. |
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
our $xml10_cdsect_rx = qr/(?>)/o; |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
=back |
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
=head2 Tags |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
=over |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
=item $xml10_attvalue_rx |
800
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
A quoted attribute value. This consists of acceptable characters |
802
|
|
|
|
|
|
|
other than "B<< < >>", "B<&>", and the quote character, interspersed |
803
|
|
|
|
|
|
|
with references, surrounded by matching "B<">" or "B<'>" quotes. |
804
|
|
|
|
|
|
|
The well-formedness constraints of references apply, and additionally |
805
|
|
|
|
|
|
|
the replacement text of any referenced entities must not contain any "B<< |
806
|
|
|
|
|
|
|
< >>" characters, and it is not permitted to refer to external entities. |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
=cut |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
our $xml10_attvalue_rx = qr/"(?:(?![<&"])$xml10_char_rx|$xml10_reference_rx)*" |
811
|
|
|
|
|
|
|
|'(?:(?![<&'])$xml10_char_rx|$xml10_reference_rx)*' |
812
|
|
|
|
|
|
|
/xo; |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
=item $xml10_attribute_rx |
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
A complete attribute, consisting of name, equals sign, and quoted value. |
817
|
|
|
|
|
|
|
The well-formedness constraints of attribute values (pertaining to |
818
|
|
|
|
|
|
|
references) apply. |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
=cut |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
our $xml10_attribute_rx = qr/$xml10_name_rx$xml10_eq_rx$xml10_attvalue_rx/o; |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
=item $xml10_stag_rx |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
A start-tag, used to begin an element. This consists of "B<< < >>", |
827
|
|
|
|
|
|
|
the element type name, whitespace-separated list of attributes, and "B<< |
828
|
|
|
|
|
|
|
> >>". The well-formedness constraints of attribute values (pertaining |
829
|
|
|
|
|
|
|
to references) apply. There is also a well-formedness constraint that |
830
|
|
|
|
|
|
|
attribute names must be unique within the tag. |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
=cut |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
our $xml10_stag_rx = qr#<$xml10_name_rx |
835
|
|
|
|
|
|
|
(?:$xml10_s_rx$xml10_attribute_rx)* |
836
|
|
|
|
|
|
|
$xml10_s_rx?>#xo; |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
=item $xml10_etag_rx |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
An end-tag, used to finish an element. This consists of "B<< >>", |
841
|
|
|
|
|
|
|
the element type name, and "B<< > >>". |
842
|
|
|
|
|
|
|
|
843
|
|
|
|
|
|
|
=cut |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
our $xml10_etag_rx = qr#$xml10_name_rx$xml10_s_rx?>#o; |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
=item $xml10_emptyelemtag_rx |
848
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
An empty-element tag, used to represent an element with no content. |
850
|
|
|
|
|
|
|
This consists of "B<< < >>", the element type name, whitespace-separated |
851
|
|
|
|
|
|
|
list of attributes, and "B<< /> >>". The well-formedness constraints |
852
|
|
|
|
|
|
|
of attribute values (pertaining to references) apply. There is also a |
853
|
|
|
|
|
|
|
well-formedness constraint that attribute names must be unique within |
854
|
|
|
|
|
|
|
the tag. (These are the same constraints as for start-tags.) |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=cut |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
our $xml10_emptyelemtag_rx = qr#<$xml10_name_rx |
859
|
|
|
|
|
|
|
(?:$xml10_s_rx$xml10_attribute_rx)* |
860
|
|
|
|
|
|
|
$xml10_s_rx?/>#xo; |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
=back |
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
=head2 Non-data content |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
=over |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
=item $xml10_comment_rx |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
A comment. This does not contribute to the data content of an |
871
|
|
|
|
|
|
|
XML document. It consists of "B<< >>". It is not permitted for the content to |
873
|
|
|
|
|
|
|
include "B<-->" as a subsequence, nor for it to end with "B<->". |
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
=cut |
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
# Note perl bug: the theoretically-cleaner way of expressing this syntax, |
878
|
|
|
|
|
|
|
# //, runs into a problem where the |
879
|
|
|
|
|
|
|
# "*" acts as "{0,32767}", discussed in L, and so fails to match |
880
|
|
|
|
|
|
|
# longer comments. The way that is used here, with a sufficiently simple |
881
|
|
|
|
|
|
|
# expression inside the "*", doesn't run into that problem, but instead |
882
|
|
|
|
|
|
|
# relies on the (?>...) together with the non-greedy quantifier for |
883
|
|
|
|
|
|
|
# proper parsing. It is important for this regexp to not suffer from |
884
|
|
|
|
|
|
|
# this bug, because it is used in the pure-Perl parser. |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
our $xml10_comment_rx = qr/ |