@pokash/n8n-nodes-ksef 0.2.16 → 0.2.18
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.
- package/package.json +10 -11
- package/node_modules/@oozcitak/dom/LICENSE +0 -21
- package/node_modules/@oozcitak/dom/README.md +0 -32
- package/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.d.ts +0 -21
- package/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js +0 -79
- package/node_modules/@oozcitak/dom/lib/algorithm/AbortAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.d.ts +0 -8
- package/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js +0 -23
- package/node_modules/@oozcitak/dom/lib/algorithm/AttrAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.d.ts +0 -8
- package/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js +0 -76
- package/node_modules/@oozcitak/dom/lib/algorithm/BoundaryPointAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.d.ts +0 -19
- package/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js +0 -140
- package/node_modules/@oozcitak/dom/lib/algorithm/CharacterDataAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.d.ts +0 -192
- package/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js +0 -303
- package/node_modules/@oozcitak/dom/lib/algorithm/CreateAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.d.ts +0 -61
- package/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js +0 -108
- package/node_modules/@oozcitak/dom/lib/algorithm/CustomElementAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.d.ts +0 -72
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js +0 -288
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.d.ts +0 -21
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js +0 -61
- package/node_modules/@oozcitak/dom/lib/algorithm/DOMTokenListAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.d.ts +0 -29
- package/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js +0 -161
- package/node_modules/@oozcitak/dom/lib/algorithm/DocumentAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.d.ts +0 -121
- package/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js +0 -608
- package/node_modules/@oozcitak/dom/lib/algorithm/ElementAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.d.ts +0 -146
- package/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js +0 -995
- package/node_modules/@oozcitak/dom/lib/algorithm/EventAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.d.ts +0 -33
- package/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js +0 -142
- package/node_modules/@oozcitak/dom/lib/algorithm/EventTargetAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.d.ts +0 -66
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js +0 -1173
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.d.ts +0 -43
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js +0 -276
- package/node_modules/@oozcitak/dom/lib/algorithm/MutationObserverAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.d.ts +0 -25
- package/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js +0 -85
- package/node_modules/@oozcitak/dom/lib/algorithm/NamespaceAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.d.ts +0 -68
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js +0 -543
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.d.ts +0 -15
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js +0 -105
- package/node_modules/@oozcitak/dom/lib/algorithm/NodeIteratorAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.d.ts +0 -27
- package/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js +0 -125
- package/node_modules/@oozcitak/dom/lib/algorithm/OrderedSetAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.d.ts +0 -9
- package/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js +0 -69
- package/node_modules/@oozcitak/dom/lib/algorithm/ParentNodeAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.d.ts +0 -82
- package/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js +0 -829
- package/node_modules/@oozcitak/dom/lib/algorithm/RangeAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.d.ts +0 -8
- package/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js +0 -21
- package/node_modules/@oozcitak/dom/lib/algorithm/SelectorsAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.d.ts +0 -57
- package/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js +0 -316
- package/node_modules/@oozcitak/dom/lib/algorithm/ShadowTreeAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.d.ts +0 -30
- package/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js +0 -226
- package/node_modules/@oozcitak/dom/lib/algorithm/TextAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.d.ts +0 -8
- package/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js +0 -62
- package/node_modules/@oozcitak/dom/lib/algorithm/TraversalAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.d.ts +0 -268
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js +0 -853
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.d.ts +0 -17
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js +0 -147
- package/node_modules/@oozcitak/dom/lib/algorithm/TreeWalkerAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.d.ts +0 -8
- package/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js +0 -14
- package/node_modules/@oozcitak/dom/lib/algorithm/WebIDLAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.d.ts +0 -25
- package/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js +0 -164
- package/node_modules/@oozcitak/dom/lib/algorithm/XMLAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/algorithm/index.d.ts +0 -28
- package/node_modules/@oozcitak/dom/lib/algorithm/index.js +0 -34
- package/node_modules/@oozcitak/dom/lib/algorithm/index.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.d.ts +0 -15
- package/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js +0 -32
- package/node_modules/@oozcitak/dom/lib/dom/AbortControllerImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.d.ts +0 -23
- package/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js +0 -59
- package/node_modules/@oozcitak/dom/lib/dom/AbortSignalImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.d.ts +0 -23
- package/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js +0 -70
- package/node_modules/@oozcitak/dom/lib/dom/AbstractRangeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/AttrImpl.d.ts +0 -45
- package/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js +0 -118
- package/node_modules/@oozcitak/dom/lib/dom/AttrImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.d.ts +0 -21
- package/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js +0 -51
- package/node_modules/@oozcitak/dom/lib/dom/CDATASectionImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.d.ts +0 -35
- package/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js +0 -132
- package/node_modules/@oozcitak/dom/lib/dom/CharacterDataImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.d.ts +0 -16
- package/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js +0 -165
- package/node_modules/@oozcitak/dom/lib/dom/ChildNodeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/CommentImpl.d.ts +0 -21
- package/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js +0 -52
- package/node_modules/@oozcitak/dom/lib/dom/CommentImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.d.ts +0 -16
- package/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js +0 -60
- package/node_modules/@oozcitak/dom/lib/dom/CustomEventImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/DOMException.d.ts +0 -171
- package/node_modules/@oozcitak/dom/lib/dom/DOMException.js +0 -347
- package/node_modules/@oozcitak/dom/lib/dom/DOMException.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/DOMImpl.d.ts +0 -48
- package/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js +0 -100
- package/node_modules/@oozcitak/dom/lib/dom/DOMImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.d.ts +0 -29
- package/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js +0 -149
- package/node_modules/@oozcitak/dom/lib/dom/DOMImplementationImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.d.ts +0 -46
- package/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js +0 -312
- package/node_modules/@oozcitak/dom/lib/dom/DOMTokenListImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.d.ts +0 -32
- package/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js +0 -103
- package/node_modules/@oozcitak/dom/lib/dom/DocumentFragmentImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.d.ts +0 -116
- package/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js +0 -545
- package/node_modules/@oozcitak/dom/lib/dom/DocumentImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.d.ts +0 -11
- package/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js +0 -17
- package/node_modules/@oozcitak/dom/lib/dom/DocumentOrShadowRootImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.d.ts +0 -39
- package/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js +0 -109
- package/node_modules/@oozcitak/dom/lib/dom/DocumentTypeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/ElementImpl.d.ts +0 -132
- package/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js +0 -714
- package/node_modules/@oozcitak/dom/lib/dom/ElementImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/EventImpl.d.ts +0 -74
- package/node_modules/@oozcitak/dom/lib/dom/EventImpl.js +0 -313
- package/node_modules/@oozcitak/dom/lib/dom/EventImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.d.ts +0 -30
- package/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js +0 -133
- package/node_modules/@oozcitak/dom/lib/dom/EventTargetImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.d.ts +0 -44
- package/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js +0 -157
- package/node_modules/@oozcitak/dom/lib/dom/HTMLCollectionImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.d.ts +0 -22
- package/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js +0 -184
- package/node_modules/@oozcitak/dom/lib/dom/MutationObserverImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.d.ts +0 -73
- package/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js +0 -116
- package/node_modules/@oozcitak/dom/lib/dom/MutationRecordImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.d.ts +0 -34
- package/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js +0 -112
- package/node_modules/@oozcitak/dom/lib/dom/NamedNodeMapImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.d.ts +0 -50
- package/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js +0 -64
- package/node_modules/@oozcitak/dom/lib/dom/NodeFilterImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeImpl.d.ts +0 -252
- package/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js +0 -891
- package/node_modules/@oozcitak/dom/lib/dom/NodeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.d.ts +0 -34
- package/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js +0 -86
- package/node_modules/@oozcitak/dom/lib/dom/NodeIteratorImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.d.ts +0 -46
- package/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js +0 -198
- package/node_modules/@oozcitak/dom/lib/dom/NodeListImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.d.ts +0 -49
- package/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js +0 -188
- package/node_modules/@oozcitak/dom/lib/dom/NodeListStaticImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.d.ts +0 -12
- package/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js +0 -53
- package/node_modules/@oozcitak/dom/lib/dom/NonDocumentTypeChildNodeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.d.ts +0 -9
- package/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js +0 -31
- package/node_modules/@oozcitak/dom/lib/dom/NonElementParentNodeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.d.ts +0 -24
- package/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js +0 -158
- package/node_modules/@oozcitak/dom/lib/dom/ParentNodeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.d.ts +0 -25
- package/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js +0 -59
- package/node_modules/@oozcitak/dom/lib/dom/ProcessingInstructionImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/RangeImpl.d.ts +0 -71
- package/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js +0 -649
- package/node_modules/@oozcitak/dom/lib/dom/RangeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.d.ts +0 -33
- package/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js +0 -82
- package/node_modules/@oozcitak/dom/lib/dom/ShadowRootImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.d.ts +0 -16
- package/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js +0 -35
- package/node_modules/@oozcitak/dom/lib/dom/SlotableImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.d.ts +0 -13
- package/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js +0 -48
- package/node_modules/@oozcitak/dom/lib/dom/StaticRangeImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/TextImpl.d.ts +0 -28
- package/node_modules/@oozcitak/dom/lib/dom/TextImpl.js +0 -109
- package/node_modules/@oozcitak/dom/lib/dom/TextImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.d.ts +0 -23
- package/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js +0 -41
- package/node_modules/@oozcitak/dom/lib/dom/TraverserImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.d.ts +0 -36
- package/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js +0 -249
- package/node_modules/@oozcitak/dom/lib/dom/TreeWalkerImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/WindowImpl.d.ts +0 -26
- package/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js +0 -57
- package/node_modules/@oozcitak/dom/lib/dom/WindowImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.d.ts +0 -11
- package/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js +0 -31
- package/node_modules/@oozcitak/dom/lib/dom/XMLDocumentImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/index.d.ts +0 -36
- package/node_modules/@oozcitak/dom/lib/dom/index.js +0 -102
- package/node_modules/@oozcitak/dom/lib/dom/index.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/dom/interfaces.d.ts +0 -2218
- package/node_modules/@oozcitak/dom/lib/dom/interfaces.js +0 -91
- package/node_modules/@oozcitak/dom/lib/dom/interfaces.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/index.d.ts +0 -3
- package/node_modules/@oozcitak/dom/lib/index.js +0 -11
- package/node_modules/@oozcitak/dom/lib/index.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.d.ts +0 -11
- package/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js +0 -37
- package/node_modules/@oozcitak/dom/lib/parser/DOMParserImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.d.ts +0 -26
- package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js +0 -240
- package/node_modules/@oozcitak/dom/lib/parser/XMLParserImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.d.ts +0 -159
- package/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js +0 -512
- package/node_modules/@oozcitak/dom/lib/parser/XMLStringLexer.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/parser/index.d.ts +0 -1
- package/node_modules/@oozcitak/dom/lib/parser/index.js +0 -6
- package/node_modules/@oozcitak/dom/lib/parser/index.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/parser/interfaces.d.ts +0 -131
- package/node_modules/@oozcitak/dom/lib/parser/interfaces.js +0 -18
- package/node_modules/@oozcitak/dom/lib/parser/interfaces.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.d.ts +0 -27
- package/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js +0 -56
- package/node_modules/@oozcitak/dom/lib/serializer/LocalNameSet.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.d.ts +0 -52
- package/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js +0 -151
- package/node_modules/@oozcitak/dom/lib/serializer/NamespacePrefixMap.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.d.ts +0 -166
- package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js +0 -1479
- package/node_modules/@oozcitak/dom/lib/serializer/XMLSerializerImpl.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/serializer/index.d.ts +0 -1
- package/node_modules/@oozcitak/dom/lib/serializer/index.js +0 -6
- package/node_modules/@oozcitak/dom/lib/serializer/index.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/serializer/interfaces.d.ts +0 -15
- package/node_modules/@oozcitak/dom/lib/serializer/interfaces.js +0 -3
- package/node_modules/@oozcitak/dom/lib/serializer/interfaces.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/util/Cast.d.ts +0 -12
- package/node_modules/@oozcitak/dom/lib/util/Cast.js +0 -26
- package/node_modules/@oozcitak/dom/lib/util/Cast.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/util/EmptySet.d.ts +0 -13
- package/node_modules/@oozcitak/dom/lib/util/EmptySet.js +0 -61
- package/node_modules/@oozcitak/dom/lib/util/EmptySet.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/util/Guard.d.ts +0 -135
- package/node_modules/@oozcitak/dom/lib/util/Guard.js +0 -192
- package/node_modules/@oozcitak/dom/lib/util/Guard.js.map +0 -1
- package/node_modules/@oozcitak/dom/lib/util/index.d.ts +0 -3
- package/node_modules/@oozcitak/dom/lib/util/index.js +0 -9
- package/node_modules/@oozcitak/dom/lib/util/index.js.map +0 -1
- package/node_modules/@oozcitak/dom/package.json +0 -72
- package/node_modules/@oozcitak/infra/LICENSE +0 -21
- package/node_modules/@oozcitak/infra/README.md +0 -13
- package/node_modules/@oozcitak/infra/lib/Base64.d.ts +0 -12
- package/node_modules/@oozcitak/infra/lib/Base64.js +0 -82
- package/node_modules/@oozcitak/infra/lib/Base64.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/Byte.d.ts +0 -6
- package/node_modules/@oozcitak/infra/lib/Byte.js +0 -15
- package/node_modules/@oozcitak/infra/lib/Byte.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/ByteSequence.d.ts +0 -45
- package/node_modules/@oozcitak/infra/lib/ByteSequence.js +0 -171
- package/node_modules/@oozcitak/infra/lib/ByteSequence.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/CodePoints.d.ts +0 -82
- package/node_modules/@oozcitak/infra/lib/CodePoints.js +0 -85
- package/node_modules/@oozcitak/infra/lib/CodePoints.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/JSON.d.ts +0 -24
- package/node_modules/@oozcitak/infra/lib/JSON.js +0 -123
- package/node_modules/@oozcitak/infra/lib/JSON.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/List.d.ts +0 -101
- package/node_modules/@oozcitak/infra/lib/List.js +0 -325
- package/node_modules/@oozcitak/infra/lib/List.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/Map.d.ts +0 -87
- package/node_modules/@oozcitak/infra/lib/Map.js +0 -308
- package/node_modules/@oozcitak/infra/lib/Map.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/Namespace.d.ts +0 -6
- package/node_modules/@oozcitak/infra/lib/Namespace.js +0 -9
- package/node_modules/@oozcitak/infra/lib/Namespace.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/Queue.d.ts +0 -13
- package/node_modules/@oozcitak/infra/lib/Queue.js +0 -22
- package/node_modules/@oozcitak/infra/lib/Queue.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/Set.d.ts +0 -136
- package/node_modules/@oozcitak/infra/lib/Set.js +0 -467
- package/node_modules/@oozcitak/infra/lib/Set.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/Stack.d.ts +0 -13
- package/node_modules/@oozcitak/infra/lib/Stack.js +0 -22
- package/node_modules/@oozcitak/infra/lib/Stack.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/String.d.ts +0 -129
- package/node_modules/@oozcitak/infra/lib/String.js +0 -472
- package/node_modules/@oozcitak/infra/lib/String.js.map +0 -1
- package/node_modules/@oozcitak/infra/lib/index.d.ts +0 -13
- package/node_modules/@oozcitak/infra/lib/index.js +0 -34
- package/node_modules/@oozcitak/infra/lib/index.js.map +0 -1
- package/node_modules/@oozcitak/infra/package.json +0 -54
- package/node_modules/@oozcitak/url/LICENSE +0 -21
- package/node_modules/@oozcitak/url/README.md +0 -27
- package/node_modules/@oozcitak/url/lib/URLAlgorithm.d.ts +0 -267
- package/node_modules/@oozcitak/url/lib/URLAlgorithm.js +0 -2758
- package/node_modules/@oozcitak/url/lib/URLAlgorithm.js.map +0 -1
- package/node_modules/@oozcitak/url/lib/URLImpl.d.ts +0 -53
- package/node_modules/@oozcitak/url/lib/URLImpl.js +0 -377
- package/node_modules/@oozcitak/url/lib/URLImpl.js.map +0 -1
- package/node_modules/@oozcitak/url/lib/URLSearchParamsImpl.d.ts +0 -38
- package/node_modules/@oozcitak/url/lib/URLSearchParamsImpl.js +0 -303
- package/node_modules/@oozcitak/url/lib/URLSearchParamsImpl.js.map +0 -1
- package/node_modules/@oozcitak/url/lib/index.d.ts +0 -2
- package/node_modules/@oozcitak/url/lib/index.js +0 -7
- package/node_modules/@oozcitak/url/lib/index.js.map +0 -1
- package/node_modules/@oozcitak/url/lib/interfaces.d.ts +0 -195
- package/node_modules/@oozcitak/url/lib/interfaces.js +0 -31
- package/node_modules/@oozcitak/url/lib/interfaces.js.map +0 -1
- package/node_modules/@oozcitak/url/package.json +0 -55
- package/node_modules/@oozcitak/util/LICENSE +0 -21
- package/node_modules/@oozcitak/util/README.md +0 -10
- package/node_modules/@oozcitak/util/lib/CompareCache.d.ts +0 -32
- package/node_modules/@oozcitak/util/lib/CompareCache.js +0 -59
- package/node_modules/@oozcitak/util/lib/CompareCache.js.map +0 -1
- package/node_modules/@oozcitak/util/lib/FixedSizeSet.d.ts +0 -64
- package/node_modules/@oozcitak/util/lib/FixedSizeSet.js +0 -174
- package/node_modules/@oozcitak/util/lib/FixedSizeSet.js.map +0 -1
- package/node_modules/@oozcitak/util/lib/Lazy.d.ts +0 -18
- package/node_modules/@oozcitak/util/lib/Lazy.js +0 -34
- package/node_modules/@oozcitak/util/lib/Lazy.js.map +0 -1
- package/node_modules/@oozcitak/util/lib/ObjectCache.d.ts +0 -71
- package/node_modules/@oozcitak/util/lib/ObjectCache.js +0 -181
- package/node_modules/@oozcitak/util/lib/ObjectCache.js.map +0 -1
- package/node_modules/@oozcitak/util/lib/StringWalker.d.ts +0 -49
- package/node_modules/@oozcitak/util/lib/StringWalker.js +0 -105
- package/node_modules/@oozcitak/util/lib/StringWalker.js.map +0 -1
- package/node_modules/@oozcitak/util/lib/index.d.ts +0 -178
- package/node_modules/@oozcitak/util/lib/index.js +0 -439
- package/node_modules/@oozcitak/util/lib/index.js.map +0 -1
- package/node_modules/@oozcitak/util/package.json +0 -50
- package/node_modules/@xmldom/is-dom-node/LICENSE.md +0 -21
- package/node_modules/@xmldom/is-dom-node/README.md +0 -91
- package/node_modules/@xmldom/is-dom-node/dist/index.d.ts +0 -33
- package/node_modules/@xmldom/is-dom-node/dist/index.js +0 -91
- package/node_modules/@xmldom/is-dom-node/dist/index.js.map +0 -1
- package/node_modules/@xmldom/is-dom-node/package.json +0 -69
- package/node_modules/@xmldom/xmldom/CHANGELOG.md +0 -468
- package/node_modules/@xmldom/xmldom/LICENSE +0 -8
- package/node_modules/@xmldom/xmldom/SECURITY.md +0 -50
- package/node_modules/@xmldom/xmldom/index.d.ts +0 -43
- package/node_modules/@xmldom/xmldom/lib/.eslintrc.yml +0 -2
- package/node_modules/@xmldom/xmldom/lib/conventions.js +0 -203
- package/node_modules/@xmldom/xmldom/lib/dom-parser.js +0 -322
- package/node_modules/@xmldom/xmldom/lib/dom.js +0 -1879
- package/node_modules/@xmldom/xmldom/lib/entities.js +0 -2166
- package/node_modules/@xmldom/xmldom/lib/index.js +0 -4
- package/node_modules/@xmldom/xmldom/lib/sax.js +0 -662
- package/node_modules/@xmldom/xmldom/package.json +0 -71
- package/node_modules/@xmldom/xmldom/readme.md +0 -356
- package/node_modules/esprima/ChangeLog +0 -235
- package/node_modules/esprima/LICENSE.BSD +0 -21
- package/node_modules/esprima/README.md +0 -46
- package/node_modules/esprima/bin/esparse.js +0 -139
- package/node_modules/esprima/bin/esvalidate.js +0 -236
- package/node_modules/esprima/dist/esprima.js +0 -6709
- package/node_modules/esprima/package.json +0 -112
- package/node_modules/node-forge/LICENSE +0 -331
- package/node_modules/node-forge/README.md +0 -2071
- package/node_modules/node-forge/dist/forge.all.min.js +0 -2
- package/node_modules/node-forge/dist/forge.all.min.js.map +0 -1
- package/node_modules/node-forge/dist/forge.min.js +0 -2
- package/node_modules/node-forge/dist/forge.min.js.map +0 -1
- package/node_modules/node-forge/dist/prime.worker.min.js +0 -2
- package/node_modules/node-forge/dist/prime.worker.min.js.map +0 -1
- package/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
- package/node_modules/node-forge/lib/aes.js +0 -1091
- package/node_modules/node-forge/lib/aesCipherSuites.js +0 -282
- package/node_modules/node-forge/lib/asn1-validator.js +0 -91
- package/node_modules/node-forge/lib/asn1.js +0 -1503
- package/node_modules/node-forge/lib/baseN.js +0 -186
- package/node_modules/node-forge/lib/cipher.js +0 -230
- package/node_modules/node-forge/lib/cipherModes.js +0 -999
- package/node_modules/node-forge/lib/des.js +0 -496
- package/node_modules/node-forge/lib/ed25519.js +0 -1072
- package/node_modules/node-forge/lib/forge.js +0 -13
- package/node_modules/node-forge/lib/form.js +0 -149
- package/node_modules/node-forge/lib/hmac.js +0 -146
- package/node_modules/node-forge/lib/http.js +0 -1346
- package/node_modules/node-forge/lib/index.all.js +0 -16
- package/node_modules/node-forge/lib/index.js +0 -33
- package/node_modules/node-forge/lib/jsbn.js +0 -1264
- package/node_modules/node-forge/lib/kem.js +0 -168
- package/node_modules/node-forge/lib/log.js +0 -319
- package/node_modules/node-forge/lib/md.all.js +0 -13
- package/node_modules/node-forge/lib/md.js +0 -11
- package/node_modules/node-forge/lib/md5.js +0 -289
- package/node_modules/node-forge/lib/mgf.js +0 -12
- package/node_modules/node-forge/lib/mgf1.js +0 -57
- package/node_modules/node-forge/lib/oids.js +0 -179
- package/node_modules/node-forge/lib/pbe.js +0 -1023
- package/node_modules/node-forge/lib/pbkdf2.js +0 -211
- package/node_modules/node-forge/lib/pem.js +0 -237
- package/node_modules/node-forge/lib/pkcs1.js +0 -276
- package/node_modules/node-forge/lib/pkcs12.js +0 -1078
- package/node_modules/node-forge/lib/pkcs7.js +0 -1260
- package/node_modules/node-forge/lib/pkcs7asn1.js +0 -410
- package/node_modules/node-forge/lib/pki.js +0 -102
- package/node_modules/node-forge/lib/prime.js +0 -297
- package/node_modules/node-forge/lib/prime.worker.js +0 -168
- package/node_modules/node-forge/lib/prng.js +0 -419
- package/node_modules/node-forge/lib/pss.js +0 -241
- package/node_modules/node-forge/lib/random.js +0 -191
- package/node_modules/node-forge/lib/rc2.js +0 -410
- package/node_modules/node-forge/lib/rsa.js +0 -1949
- package/node_modules/node-forge/lib/sha1.js +0 -319
- package/node_modules/node-forge/lib/sha256.js +0 -327
- package/node_modules/node-forge/lib/sha512.js +0 -561
- package/node_modules/node-forge/lib/socket.js +0 -287
- package/node_modules/node-forge/lib/ssh.js +0 -236
- package/node_modules/node-forge/lib/tls.js +0 -4282
- package/node_modules/node-forge/lib/tlssocket.js +0 -249
- package/node_modules/node-forge/lib/util.js +0 -2652
- package/node_modules/node-forge/lib/x509.js +0 -3242
- package/node_modules/node-forge/lib/xhr.js +0 -738
- package/node_modules/node-forge/package.json +0 -123
- package/node_modules/sprintf-js/.npmignore +0 -1
- package/node_modules/sprintf-js/LICENSE +0 -24
- package/node_modules/sprintf-js/README.md +0 -88
- package/node_modules/sprintf-js/bower.json +0 -14
- package/node_modules/sprintf-js/demo/angular.html +0 -20
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js +0 -4
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +0 -1
- package/node_modules/sprintf-js/dist/angular-sprintf.min.map +0 -1
- package/node_modules/sprintf-js/dist/sprintf.min.js +0 -4
- package/node_modules/sprintf-js/dist/sprintf.min.js.map +0 -1
- package/node_modules/sprintf-js/dist/sprintf.min.map +0 -1
- package/node_modules/sprintf-js/gruntfile.js +0 -36
- package/node_modules/sprintf-js/package.json +0 -22
- package/node_modules/sprintf-js/src/angular-sprintf.js +0 -18
- package/node_modules/sprintf-js/src/sprintf.js +0 -208
- package/node_modules/sprintf-js/test/test.js +0 -82
- package/node_modules/xml-crypto/LICENSE +0 -22
- package/node_modules/xml-crypto/README.md +0 -557
- package/node_modules/xml-crypto/lib/c14n-canonicalization.d.ts +0 -39
- package/node_modules/xml-crypto/lib/c14n-canonicalization.js +0 -230
- package/node_modules/xml-crypto/lib/c14n-canonicalization.js.map +0 -1
- package/node_modules/xml-crypto/lib/enveloped-signature.d.ts +0 -7
- package/node_modules/xml-crypto/lib/enveloped-signature.js +0 -43
- package/node_modules/xml-crypto/lib/enveloped-signature.js.map +0 -1
- package/node_modules/xml-crypto/lib/exclusive-canonicalization.d.ts +0 -38
- package/node_modules/xml-crypto/lib/exclusive-canonicalization.js +0 -246
- package/node_modules/xml-crypto/lib/exclusive-canonicalization.js.map +0 -1
- package/node_modules/xml-crypto/lib/hash-algorithms.d.ts +0 -13
- package/node_modules/xml-crypto/lib/hash-algorithms.js +0 -47
- package/node_modules/xml-crypto/lib/hash-algorithms.js.map +0 -1
- package/node_modules/xml-crypto/lib/index.d.ts +0 -5
- package/node_modules/xml-crypto/lib/index.js +0 -28
- package/node_modules/xml-crypto/lib/index.js.map +0 -1
- package/node_modules/xml-crypto/lib/signature-algorithms.d.ts +0 -47
- package/node_modules/xml-crypto/lib/signature-algorithms.js +0 -86
- package/node_modules/xml-crypto/lib/signature-algorithms.js.map +0 -1
- package/node_modules/xml-crypto/lib/signed-xml.d.ts +0 -225
- package/node_modules/xml-crypto/lib/signed-xml.js +0 -960
- package/node_modules/xml-crypto/lib/signed-xml.js.map +0 -1
- package/node_modules/xml-crypto/lib/types.d.ts +0 -125
- package/node_modules/xml-crypto/lib/types.js +0 -57
- package/node_modules/xml-crypto/lib/types.js.map +0 -1
- package/node_modules/xml-crypto/lib/utils.d.ts +0 -65
- package/node_modules/xml-crypto/lib/utils.js +0 -256
- package/node_modules/xml-crypto/lib/utils.js.map +0 -1
- package/node_modules/xml-crypto/node_modules/xpath/LICENSE +0 -22
- package/node_modules/xml-crypto/node_modules/xpath/README.md +0 -133
- package/node_modules/xml-crypto/node_modules/xpath/docs/XPathEvaluator.md +0 -62
- package/node_modules/xml-crypto/node_modules/xpath/docs/XPathResult.md +0 -47
- package/node_modules/xml-crypto/node_modules/xpath/docs/function resolvers.md +0 -88
- package/node_modules/xml-crypto/node_modules/xpath/docs/namespace resolvers.md +0 -69
- package/node_modules/xml-crypto/node_modules/xpath/docs/parsed expressions.md +0 -21
- package/node_modules/xml-crypto/node_modules/xpath/docs/variable resolvers.md +0 -89
- package/node_modules/xml-crypto/node_modules/xpath/docs/xpath methods.md +0 -39
- package/node_modules/xml-crypto/node_modules/xpath/package.json +0 -39
- package/node_modules/xml-crypto/node_modules/xpath/test.js +0 -1186
- package/node_modules/xml-crypto/node_modules/xpath/xpath.d.ts +0 -51
- package/node_modules/xml-crypto/node_modules/xpath/xpath.js +0 -4938
- package/node_modules/xml-crypto/package.json +0 -73
- package/node_modules/xmlbuilder2/CHANGELOG.md +0 -309
- package/node_modules/xmlbuilder2/LICENSE +0 -21
- package/node_modules/xmlbuilder2/README.md +0 -183
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctions.d.ts +0 -236
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctions.js +0 -108
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctions.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctionsCB.d.ts +0 -17
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctionsCB.js +0 -26
- package/node_modules/xmlbuilder2/lib/builder/BuilderFunctionsCB.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.d.ts +0 -124
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.js +0 -782
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderCBImpl.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderImpl.d.ts +0 -143
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderImpl.js +0 -841
- package/node_modules/xmlbuilder2/lib/builder/XMLBuilderImpl.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/builder/dom.d.ts +0 -8
- package/node_modules/xmlbuilder2/lib/builder/dom.js +0 -67
- package/node_modules/xmlbuilder2/lib/builder/dom.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/builder/index.d.ts +0 -4
- package/node_modules/xmlbuilder2/lib/builder/index.js +0 -15
- package/node_modules/xmlbuilder2/lib/builder/index.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/constants.d.ts +0 -1
- package/node_modules/xmlbuilder2/lib/constants.js +0 -4
- package/node_modules/xmlbuilder2/lib/constants.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/index.d.ts +0 -1
- package/node_modules/xmlbuilder2/lib/index.js +0 -10
- package/node_modules/xmlbuilder2/lib/index.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/interfaces.d.ts +0 -1355
- package/node_modules/xmlbuilder2/lib/interfaces.js +0 -76
- package/node_modules/xmlbuilder2/lib/interfaces.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/readers/BaseReader.d.ts +0 -109
- package/node_modules/xmlbuilder2/lib/readers/BaseReader.js +0 -167
- package/node_modules/xmlbuilder2/lib/readers/BaseReader.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/readers/JSONReader.d.ts +0 -14
- package/node_modules/xmlbuilder2/lib/readers/JSONReader.js +0 -38
- package/node_modules/xmlbuilder2/lib/readers/JSONReader.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/readers/ObjectReader.d.ts +0 -15
- package/node_modules/xmlbuilder2/lib/readers/ObjectReader.js +0 -168
- package/node_modules/xmlbuilder2/lib/readers/ObjectReader.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/readers/XMLReader.d.ts +0 -14
- package/node_modules/xmlbuilder2/lib/readers/XMLReader.js +0 -206
- package/node_modules/xmlbuilder2/lib/readers/XMLReader.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/readers/YAMLReader.d.ts +0 -14
- package/node_modules/xmlbuilder2/lib/readers/YAMLReader.js +0 -44
- package/node_modules/xmlbuilder2/lib/readers/YAMLReader.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/readers/index.d.ts +0 -4
- package/node_modules/xmlbuilder2/lib/readers/index.js +0 -11
- package/node_modules/xmlbuilder2/lib/readers/index.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/BaseCBWriter.d.ts +0 -110
- package/node_modules/xmlbuilder2/lib/writers/BaseCBWriter.js +0 -23
- package/node_modules/xmlbuilder2/lib/writers/BaseCBWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/BaseWriter.d.ts +0 -276
- package/node_modules/xmlbuilder2/lib/writers/BaseWriter.js +0 -1603
- package/node_modules/xmlbuilder2/lib/writers/BaseWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/JSONCBWriter.d.ts +0 -68
- package/node_modules/xmlbuilder2/lib/writers/JSONCBWriter.js +0 -172
- package/node_modules/xmlbuilder2/lib/writers/JSONCBWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/JSONWriter.d.ts +0 -67
- package/node_modules/xmlbuilder2/lib/writers/JSONWriter.js +0 -222
- package/node_modules/xmlbuilder2/lib/writers/JSONWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/MapWriter.d.ts +0 -27
- package/node_modules/xmlbuilder2/lib/writers/MapWriter.js +0 -84
- package/node_modules/xmlbuilder2/lib/writers/MapWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.d.ts +0 -56
- package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.js +0 -483
- package/node_modules/xmlbuilder2/lib/writers/ObjectWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/XMLCBWriter.d.ts +0 -51
- package/node_modules/xmlbuilder2/lib/writers/XMLCBWriter.js +0 -165
- package/node_modules/xmlbuilder2/lib/writers/XMLCBWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/XMLWriter.d.ts +0 -60
- package/node_modules/xmlbuilder2/lib/writers/XMLWriter.js +0 -236
- package/node_modules/xmlbuilder2/lib/writers/XMLWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/YAMLCBWriter.d.ts +0 -61
- package/node_modules/xmlbuilder2/lib/writers/YAMLCBWriter.js +0 -161
- package/node_modules/xmlbuilder2/lib/writers/YAMLCBWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.d.ts +0 -55
- package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.js +0 -186
- package/node_modules/xmlbuilder2/lib/writers/YAMLWriter.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/writers/index.d.ts +0 -5
- package/node_modules/xmlbuilder2/lib/writers/index.js +0 -13
- package/node_modules/xmlbuilder2/lib/writers/index.js.map +0 -1
- package/node_modules/xmlbuilder2/lib/xmlbuilder2.min.js +0 -8
- package/node_modules/xmlbuilder2/node_modules/argparse/CHANGELOG.md +0 -185
- package/node_modules/xmlbuilder2/node_modules/argparse/LICENSE +0 -21
- package/node_modules/xmlbuilder2/node_modules/argparse/README.md +0 -257
- package/node_modules/xmlbuilder2/node_modules/argparse/index.js +0 -3
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/append/constant.js +0 -47
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/append.js +0 -53
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/count.js +0 -40
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/help.js +0 -47
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/store/constant.js +0 -43
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/store/false.js +0 -27
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/store/true.js +0 -26
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/store.js +0 -50
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/subparsers.js +0 -149
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action/version.js +0 -47
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action.js +0 -146
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/action_container.js +0 -482
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argparse.js +0 -14
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argument/error.js +0 -50
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argument/exclusive.js +0 -54
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argument/group.js +0 -75
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/argument_parser.js +0 -1161
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/const.js +0 -21
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/help/added_formatters.js +0 -87
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/help/formatter.js +0 -795
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/namespace.js +0 -76
- package/node_modules/xmlbuilder2/node_modules/argparse/lib/utils.js +0 -57
- package/node_modules/xmlbuilder2/node_modules/argparse/package.json +0 -34
- package/node_modules/xmlbuilder2/node_modules/js-yaml/CHANGELOG.md +0 -557
- package/node_modules/xmlbuilder2/node_modules/js-yaml/LICENSE +0 -21
- package/node_modules/xmlbuilder2/node_modules/js-yaml/README.md +0 -299
- package/node_modules/xmlbuilder2/node_modules/js-yaml/bin/js-yaml.js +0 -132
- package/node_modules/xmlbuilder2/node_modules/js-yaml/dist/js-yaml.js +0 -3989
- package/node_modules/xmlbuilder2/node_modules/js-yaml/dist/js-yaml.min.js +0 -1
- package/node_modules/xmlbuilder2/node_modules/js-yaml/index.js +0 -7
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/common.js +0 -59
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/dumper.js +0 -850
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/exception.js +0 -43
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/loader.js +0 -1644
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/mark.js +0 -76
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema/core.js +0 -18
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +0 -25
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +0 -28
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +0 -17
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema/json.js +0 -25
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/schema.js +0 -108
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/binary.js +0 -138
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/bool.js +0 -35
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/float.js +0 -116
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/int.js +0 -173
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/js/function.js +0 -93
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +0 -60
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +0 -28
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/map.js +0 -8
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/merge.js +0 -12
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/null.js +0 -34
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/omap.js +0 -44
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/pairs.js +0 -53
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/seq.js +0 -8
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/set.js +0 -29
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/str.js +0 -8
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +0 -88
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml/type.js +0 -61
- package/node_modules/xmlbuilder2/node_modules/js-yaml/lib/js-yaml.js +0 -39
- package/node_modules/xmlbuilder2/node_modules/js-yaml/package.json +0 -49
- package/node_modules/xmlbuilder2/package.json +0 -82
- package/node_modules/xpath/LICENSE +0 -22
- package/node_modules/xpath/README.md +0 -133
- package/node_modules/xpath/package.json +0 -43
- package/node_modules/xpath/xpath.d.ts +0 -51
- package/node_modules/xpath/xpath.js +0 -5041
|
@@ -1,4938 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* xpath.js
|
|
3
|
-
*
|
|
4
|
-
* An XPath 1.0 library for JavaScript.
|
|
5
|
-
*
|
|
6
|
-
* Cameron McCormack <cam (at) mcc.id.au>
|
|
7
|
-
*
|
|
8
|
-
* This work is licensed under the MIT License.
|
|
9
|
-
*
|
|
10
|
-
* Revision 20: April 26, 2011
|
|
11
|
-
* Fixed a typo resulting in FIRST_ORDERED_NODE_TYPE results being wrong,
|
|
12
|
-
* thanks to <shi_a009 (at) hotmail.com>.
|
|
13
|
-
*
|
|
14
|
-
* Revision 19: November 29, 2005
|
|
15
|
-
* Nodesets now store their nodes in a height balanced tree, increasing
|
|
16
|
-
* performance for the common case of selecting nodes in document order,
|
|
17
|
-
* thanks to Sébastien Cramatte <contact (at) zeninteractif.com>.
|
|
18
|
-
* AVL tree code adapted from Raimund Neumann <rnova (at) gmx.net>.
|
|
19
|
-
*
|
|
20
|
-
* Revision 18: October 27, 2005
|
|
21
|
-
* DOM 3 XPath support. Caveats:
|
|
22
|
-
* - namespace prefixes aren't resolved in XPathEvaluator.createExpression,
|
|
23
|
-
* but in XPathExpression.evaluate.
|
|
24
|
-
* - XPathResult.invalidIteratorState is not implemented.
|
|
25
|
-
*
|
|
26
|
-
* Revision 17: October 25, 2005
|
|
27
|
-
* Some core XPath function fixes and a patch to avoid crashing certain
|
|
28
|
-
* versions of MSXML in PathExpr.prototype.getOwnerElement, thanks to
|
|
29
|
-
* Sébastien Cramatte <contact (at) zeninteractif.com>.
|
|
30
|
-
*
|
|
31
|
-
* Revision 16: September 22, 2005
|
|
32
|
-
* Workarounds for some IE 5.5 deficiencies.
|
|
33
|
-
* Fixed problem with prefix node tests on attribute nodes.
|
|
34
|
-
*
|
|
35
|
-
* Revision 15: May 21, 2005
|
|
36
|
-
* Fixed problem with QName node tests on elements with an xmlns="...".
|
|
37
|
-
*
|
|
38
|
-
* Revision 14: May 19, 2005
|
|
39
|
-
* Fixed QName node tests on attribute node regression.
|
|
40
|
-
*
|
|
41
|
-
* Revision 13: May 3, 2005
|
|
42
|
-
* Node tests are case insensitive now if working in an HTML DOM.
|
|
43
|
-
*
|
|
44
|
-
* Revision 12: April 26, 2005
|
|
45
|
-
* Updated licence. Slight code changes to enable use of Dean
|
|
46
|
-
* Edwards' script compression, http://dean.edwards.name/packer/ .
|
|
47
|
-
*
|
|
48
|
-
* Revision 11: April 23, 2005
|
|
49
|
-
* Fixed bug with 'and' and 'or' operators, fix thanks to
|
|
50
|
-
* Sandy McArthur <sandy (at) mcarthur.org>.
|
|
51
|
-
*
|
|
52
|
-
* Revision 10: April 15, 2005
|
|
53
|
-
* Added support for a virtual root node, supposedly helpful for
|
|
54
|
-
* implementing XForms. Fixed problem with QName node tests and
|
|
55
|
-
* the parent axis.
|
|
56
|
-
*
|
|
57
|
-
* Revision 9: March 17, 2005
|
|
58
|
-
* Namespace resolver tweaked so using the document node as the context
|
|
59
|
-
* for namespace lookups is equivalent to using the document element.
|
|
60
|
-
*
|
|
61
|
-
* Revision 8: February 13, 2005
|
|
62
|
-
* Handle implicit declaration of 'xmlns' namespace prefix.
|
|
63
|
-
* Fixed bug when comparing nodesets.
|
|
64
|
-
* Instance data can now be associated with a FunctionResolver, and
|
|
65
|
-
* workaround for MSXML not supporting 'localName' and 'getElementById',
|
|
66
|
-
* thanks to Grant Gongaware.
|
|
67
|
-
* Fix a few problems when the context node is the root node.
|
|
68
|
-
*
|
|
69
|
-
* Revision 7: February 11, 2005
|
|
70
|
-
* Default namespace resolver fix from Grant Gongaware
|
|
71
|
-
* <grant (at) gongaware.com>.
|
|
72
|
-
*
|
|
73
|
-
* Revision 6: February 10, 2005
|
|
74
|
-
* Fixed bug in 'number' function.
|
|
75
|
-
*
|
|
76
|
-
* Revision 5: February 9, 2005
|
|
77
|
-
* Fixed bug where text nodes not getting converted to string values.
|
|
78
|
-
*
|
|
79
|
-
* Revision 4: January 21, 2005
|
|
80
|
-
* Bug in 'name' function, fix thanks to Bill Edney.
|
|
81
|
-
* Fixed incorrect processing of namespace nodes.
|
|
82
|
-
* Fixed NamespaceResolver to resolve 'xml' namespace.
|
|
83
|
-
* Implemented union '|' operator.
|
|
84
|
-
*
|
|
85
|
-
* Revision 3: January 14, 2005
|
|
86
|
-
* Fixed bug with nodeset comparisons, bug lexing < and >.
|
|
87
|
-
*
|
|
88
|
-
* Revision 2: October 26, 2004
|
|
89
|
-
* QName node test namespace handling fixed. Few other bug fixes.
|
|
90
|
-
*
|
|
91
|
-
* Revision 1: August 13, 2004
|
|
92
|
-
* Bug fixes from William J. Edney <bedney (at) technicalpursuit.com>.
|
|
93
|
-
* Added minimal licence.
|
|
94
|
-
*
|
|
95
|
-
* Initial version: June 14, 2004
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
// non-node wrapper
|
|
99
|
-
var xpath = (typeof exports === 'undefined') ? {} : exports;
|
|
100
|
-
|
|
101
|
-
(function (exports) {
|
|
102
|
-
"use strict";
|
|
103
|
-
|
|
104
|
-
// functional helpers
|
|
105
|
-
function curry(func) {
|
|
106
|
-
var slice = Array.prototype.slice,
|
|
107
|
-
totalargs = func.length,
|
|
108
|
-
partial = function (args, fn) {
|
|
109
|
-
return function () {
|
|
110
|
-
return fn.apply(this, args.concat(slice.call(arguments)));
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
fn = function () {
|
|
114
|
-
var args = slice.call(arguments);
|
|
115
|
-
return (args.length < totalargs) ?
|
|
116
|
-
partial(args, fn) :
|
|
117
|
-
func.apply(this, slice.apply(arguments, [0, totalargs]));
|
|
118
|
-
};
|
|
119
|
-
return fn;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
var forEach = function (f, xs) {
|
|
123
|
-
for (var i = 0; i < xs.length; i += 1) {
|
|
124
|
-
f(xs[i], i, xs);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
var reduce = function (f, seed, xs) {
|
|
129
|
-
var acc = seed;
|
|
130
|
-
|
|
131
|
-
forEach(function (x, i) { acc = f(acc, x, i); }, xs);
|
|
132
|
-
|
|
133
|
-
return acc;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
var map = function (f, xs) {
|
|
137
|
-
var mapped = new Array(xs.length);
|
|
138
|
-
|
|
139
|
-
forEach(function (x, i) { mapped[i] = f(x); }, xs);
|
|
140
|
-
|
|
141
|
-
return mapped;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
var filter = function (f, xs) {
|
|
145
|
-
var filtered = [];
|
|
146
|
-
|
|
147
|
-
forEach(function (x, i) { if (f(x, i)) { filtered.push(x); } }, xs);
|
|
148
|
-
|
|
149
|
-
return filtered;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
var includes = function (values, value) {
|
|
153
|
-
for (var i = 0; i < values.length; i += 1) {
|
|
154
|
-
if (values[i] === value) {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return false;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
function always(value) { return function () { return value; } }
|
|
163
|
-
|
|
164
|
-
function toString(x) { return x.toString(); }
|
|
165
|
-
var join = function (s, xs) { return xs.join(s); };
|
|
166
|
-
var wrap = function (pref, suf, str) { return pref + str + suf; };
|
|
167
|
-
|
|
168
|
-
var prototypeConcat = Array.prototype.concat;
|
|
169
|
-
|
|
170
|
-
// .apply() fails above a certain number of arguments - https://github.com/goto100/xpath/pull/98
|
|
171
|
-
var MAX_ARGUMENT_LENGTH = 32767;
|
|
172
|
-
|
|
173
|
-
function flatten(arr) {
|
|
174
|
-
var result = [];
|
|
175
|
-
|
|
176
|
-
for (var start = 0; start < arr.length; start += MAX_ARGUMENT_LENGTH) {
|
|
177
|
-
var chunk = arr.slice(start, start + MAX_ARGUMENT_LENGTH);
|
|
178
|
-
|
|
179
|
-
result = prototypeConcat.apply(result, chunk);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return result;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function assign(target, varArgs) { // .length of function is 2
|
|
186
|
-
var to = Object(target);
|
|
187
|
-
|
|
188
|
-
for (var index = 1; index < arguments.length; index++) {
|
|
189
|
-
var nextSource = arguments[index];
|
|
190
|
-
|
|
191
|
-
if (nextSource != null) { // Skip over if undefined or null
|
|
192
|
-
for (var nextKey in nextSource) {
|
|
193
|
-
// Avoid bugs when hasOwnProperty is shadowed
|
|
194
|
-
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
195
|
-
to[nextKey] = nextSource[nextKey];
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return to;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
var NodeTypes = {
|
|
205
|
-
ELEMENT_NODE: 1,
|
|
206
|
-
ATTRIBUTE_NODE: 2,
|
|
207
|
-
TEXT_NODE: 3,
|
|
208
|
-
CDATA_SECTION_NODE: 4,
|
|
209
|
-
PROCESSING_INSTRUCTION_NODE: 7,
|
|
210
|
-
COMMENT_NODE: 8,
|
|
211
|
-
DOCUMENT_NODE: 9,
|
|
212
|
-
DOCUMENT_TYPE_NODE: 10,
|
|
213
|
-
DOCUMENT_FRAGMENT_NODE: 11,
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// XPathParser ///////////////////////////////////////////////////////////////
|
|
217
|
-
|
|
218
|
-
XPathParser.prototype = new Object();
|
|
219
|
-
XPathParser.prototype.constructor = XPathParser;
|
|
220
|
-
XPathParser.superclass = Object.prototype;
|
|
221
|
-
|
|
222
|
-
function XPathParser() {
|
|
223
|
-
this.init();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
XPathParser.prototype.init = function () {
|
|
227
|
-
this.reduceActions = [];
|
|
228
|
-
|
|
229
|
-
this.reduceActions[3] = function (rhs) {
|
|
230
|
-
return new OrOperation(rhs[0], rhs[2]);
|
|
231
|
-
};
|
|
232
|
-
this.reduceActions[5] = function (rhs) {
|
|
233
|
-
return new AndOperation(rhs[0], rhs[2]);
|
|
234
|
-
};
|
|
235
|
-
this.reduceActions[7] = function (rhs) {
|
|
236
|
-
return new EqualsOperation(rhs[0], rhs[2]);
|
|
237
|
-
};
|
|
238
|
-
this.reduceActions[8] = function (rhs) {
|
|
239
|
-
return new NotEqualOperation(rhs[0], rhs[2]);
|
|
240
|
-
};
|
|
241
|
-
this.reduceActions[10] = function (rhs) {
|
|
242
|
-
return new LessThanOperation(rhs[0], rhs[2]);
|
|
243
|
-
};
|
|
244
|
-
this.reduceActions[11] = function (rhs) {
|
|
245
|
-
return new GreaterThanOperation(rhs[0], rhs[2]);
|
|
246
|
-
};
|
|
247
|
-
this.reduceActions[12] = function (rhs) {
|
|
248
|
-
return new LessThanOrEqualOperation(rhs[0], rhs[2]);
|
|
249
|
-
};
|
|
250
|
-
this.reduceActions[13] = function (rhs) {
|
|
251
|
-
return new GreaterThanOrEqualOperation(rhs[0], rhs[2]);
|
|
252
|
-
};
|
|
253
|
-
this.reduceActions[15] = function (rhs) {
|
|
254
|
-
return new PlusOperation(rhs[0], rhs[2]);
|
|
255
|
-
};
|
|
256
|
-
this.reduceActions[16] = function (rhs) {
|
|
257
|
-
return new MinusOperation(rhs[0], rhs[2]);
|
|
258
|
-
};
|
|
259
|
-
this.reduceActions[18] = function (rhs) {
|
|
260
|
-
return new MultiplyOperation(rhs[0], rhs[2]);
|
|
261
|
-
};
|
|
262
|
-
this.reduceActions[19] = function (rhs) {
|
|
263
|
-
return new DivOperation(rhs[0], rhs[2]);
|
|
264
|
-
};
|
|
265
|
-
this.reduceActions[20] = function (rhs) {
|
|
266
|
-
return new ModOperation(rhs[0], rhs[2]);
|
|
267
|
-
};
|
|
268
|
-
this.reduceActions[22] = function (rhs) {
|
|
269
|
-
return new UnaryMinusOperation(rhs[1]);
|
|
270
|
-
};
|
|
271
|
-
this.reduceActions[24] = function (rhs) {
|
|
272
|
-
return new BarOperation(rhs[0], rhs[2]);
|
|
273
|
-
};
|
|
274
|
-
this.reduceActions[25] = function (rhs) {
|
|
275
|
-
return new PathExpr(undefined, undefined, rhs[0]);
|
|
276
|
-
};
|
|
277
|
-
this.reduceActions[27] = function (rhs) {
|
|
278
|
-
rhs[0].locationPath = rhs[2];
|
|
279
|
-
return rhs[0];
|
|
280
|
-
};
|
|
281
|
-
this.reduceActions[28] = function (rhs) {
|
|
282
|
-
rhs[0].locationPath = rhs[2];
|
|
283
|
-
rhs[0].locationPath.steps.unshift(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
|
|
284
|
-
return rhs[0];
|
|
285
|
-
};
|
|
286
|
-
this.reduceActions[29] = function (rhs) {
|
|
287
|
-
return new PathExpr(rhs[0], [], undefined);
|
|
288
|
-
};
|
|
289
|
-
this.reduceActions[30] = function (rhs) {
|
|
290
|
-
if (Utilities.instance_of(rhs[0], PathExpr)) {
|
|
291
|
-
if (rhs[0].filterPredicates == undefined) {
|
|
292
|
-
rhs[0].filterPredicates = [];
|
|
293
|
-
}
|
|
294
|
-
rhs[0].filterPredicates.push(rhs[1]);
|
|
295
|
-
return rhs[0];
|
|
296
|
-
} else {
|
|
297
|
-
return new PathExpr(rhs[0], [rhs[1]], undefined);
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
this.reduceActions[32] = function (rhs) {
|
|
301
|
-
return rhs[1];
|
|
302
|
-
};
|
|
303
|
-
this.reduceActions[33] = function (rhs) {
|
|
304
|
-
return new XString(rhs[0]);
|
|
305
|
-
};
|
|
306
|
-
this.reduceActions[34] = function (rhs) {
|
|
307
|
-
return new XNumber(rhs[0]);
|
|
308
|
-
};
|
|
309
|
-
this.reduceActions[36] = function (rhs) {
|
|
310
|
-
return new FunctionCall(rhs[0], []);
|
|
311
|
-
};
|
|
312
|
-
this.reduceActions[37] = function (rhs) {
|
|
313
|
-
return new FunctionCall(rhs[0], rhs[2]);
|
|
314
|
-
};
|
|
315
|
-
this.reduceActions[38] = function (rhs) {
|
|
316
|
-
return [rhs[0]];
|
|
317
|
-
};
|
|
318
|
-
this.reduceActions[39] = function (rhs) {
|
|
319
|
-
rhs[2].unshift(rhs[0]);
|
|
320
|
-
return rhs[2];
|
|
321
|
-
};
|
|
322
|
-
this.reduceActions[43] = function (rhs) {
|
|
323
|
-
return new LocationPath(true, []);
|
|
324
|
-
};
|
|
325
|
-
this.reduceActions[44] = function (rhs) {
|
|
326
|
-
rhs[1].absolute = true;
|
|
327
|
-
return rhs[1];
|
|
328
|
-
};
|
|
329
|
-
this.reduceActions[46] = function (rhs) {
|
|
330
|
-
return new LocationPath(false, [rhs[0]]);
|
|
331
|
-
};
|
|
332
|
-
this.reduceActions[47] = function (rhs) {
|
|
333
|
-
rhs[0].steps.push(rhs[2]);
|
|
334
|
-
return rhs[0];
|
|
335
|
-
};
|
|
336
|
-
this.reduceActions[49] = function (rhs) {
|
|
337
|
-
return new Step(rhs[0], rhs[1], []);
|
|
338
|
-
};
|
|
339
|
-
this.reduceActions[50] = function (rhs) {
|
|
340
|
-
return new Step(Step.CHILD, rhs[0], []);
|
|
341
|
-
};
|
|
342
|
-
this.reduceActions[51] = function (rhs) {
|
|
343
|
-
return new Step(rhs[0], rhs[1], rhs[2]);
|
|
344
|
-
};
|
|
345
|
-
this.reduceActions[52] = function (rhs) {
|
|
346
|
-
return new Step(Step.CHILD, rhs[0], rhs[1]);
|
|
347
|
-
};
|
|
348
|
-
this.reduceActions[54] = function (rhs) {
|
|
349
|
-
return [rhs[0]];
|
|
350
|
-
};
|
|
351
|
-
this.reduceActions[55] = function (rhs) {
|
|
352
|
-
rhs[1].unshift(rhs[0]);
|
|
353
|
-
return rhs[1];
|
|
354
|
-
};
|
|
355
|
-
this.reduceActions[56] = function (rhs) {
|
|
356
|
-
if (rhs[0] == "ancestor") {
|
|
357
|
-
return Step.ANCESTOR;
|
|
358
|
-
} else if (rhs[0] == "ancestor-or-self") {
|
|
359
|
-
return Step.ANCESTORORSELF;
|
|
360
|
-
} else if (rhs[0] == "attribute") {
|
|
361
|
-
return Step.ATTRIBUTE;
|
|
362
|
-
} else if (rhs[0] == "child") {
|
|
363
|
-
return Step.CHILD;
|
|
364
|
-
} else if (rhs[0] == "descendant") {
|
|
365
|
-
return Step.DESCENDANT;
|
|
366
|
-
} else if (rhs[0] == "descendant-or-self") {
|
|
367
|
-
return Step.DESCENDANTORSELF;
|
|
368
|
-
} else if (rhs[0] == "following") {
|
|
369
|
-
return Step.FOLLOWING;
|
|
370
|
-
} else if (rhs[0] == "following-sibling") {
|
|
371
|
-
return Step.FOLLOWINGSIBLING;
|
|
372
|
-
} else if (rhs[0] == "namespace") {
|
|
373
|
-
return Step.NAMESPACE;
|
|
374
|
-
} else if (rhs[0] == "parent") {
|
|
375
|
-
return Step.PARENT;
|
|
376
|
-
} else if (rhs[0] == "preceding") {
|
|
377
|
-
return Step.PRECEDING;
|
|
378
|
-
} else if (rhs[0] == "preceding-sibling") {
|
|
379
|
-
return Step.PRECEDINGSIBLING;
|
|
380
|
-
} else if (rhs[0] == "self") {
|
|
381
|
-
return Step.SELF;
|
|
382
|
-
}
|
|
383
|
-
return -1;
|
|
384
|
-
};
|
|
385
|
-
this.reduceActions[57] = function (rhs) {
|
|
386
|
-
return Step.ATTRIBUTE;
|
|
387
|
-
};
|
|
388
|
-
this.reduceActions[59] = function (rhs) {
|
|
389
|
-
if (rhs[0] == "comment") {
|
|
390
|
-
return NodeTest.commentTest;
|
|
391
|
-
} else if (rhs[0] == "text") {
|
|
392
|
-
return NodeTest.textTest;
|
|
393
|
-
} else if (rhs[0] == "processing-instruction") {
|
|
394
|
-
return NodeTest.anyPiTest;
|
|
395
|
-
} else if (rhs[0] == "node") {
|
|
396
|
-
return NodeTest.nodeTest;
|
|
397
|
-
}
|
|
398
|
-
return new NodeTest(-1, undefined);
|
|
399
|
-
};
|
|
400
|
-
this.reduceActions[60] = function (rhs) {
|
|
401
|
-
return new NodeTest.PITest(rhs[2]);
|
|
402
|
-
};
|
|
403
|
-
this.reduceActions[61] = function (rhs) {
|
|
404
|
-
return rhs[1];
|
|
405
|
-
};
|
|
406
|
-
this.reduceActions[63] = function (rhs) {
|
|
407
|
-
rhs[1].absolute = true;
|
|
408
|
-
rhs[1].steps.unshift(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
|
|
409
|
-
return rhs[1];
|
|
410
|
-
};
|
|
411
|
-
this.reduceActions[64] = function (rhs) {
|
|
412
|
-
rhs[0].steps.push(new Step(Step.DESCENDANTORSELF, NodeTest.nodeTest, []));
|
|
413
|
-
rhs[0].steps.push(rhs[2]);
|
|
414
|
-
return rhs[0];
|
|
415
|
-
};
|
|
416
|
-
this.reduceActions[65] = function (rhs) {
|
|
417
|
-
return new Step(Step.SELF, NodeTest.nodeTest, []);
|
|
418
|
-
};
|
|
419
|
-
this.reduceActions[66] = function (rhs) {
|
|
420
|
-
return new Step(Step.PARENT, NodeTest.nodeTest, []);
|
|
421
|
-
};
|
|
422
|
-
this.reduceActions[67] = function (rhs) {
|
|
423
|
-
return new VariableReference(rhs[1]);
|
|
424
|
-
};
|
|
425
|
-
this.reduceActions[68] = function (rhs) {
|
|
426
|
-
return NodeTest.nameTestAny;
|
|
427
|
-
};
|
|
428
|
-
this.reduceActions[69] = function (rhs) {
|
|
429
|
-
return new NodeTest.NameTestPrefixAny(rhs[0].split(':')[0]);
|
|
430
|
-
};
|
|
431
|
-
this.reduceActions[70] = function (rhs) {
|
|
432
|
-
return new NodeTest.NameTestQName(rhs[0]);
|
|
433
|
-
};
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
XPathParser.actionTable = [
|
|
437
|
-
" s s sssssssss s ss s ss",
|
|
438
|
-
" s ",
|
|
439
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
440
|
-
" rrrrr ",
|
|
441
|
-
" s s sssssssss s ss s ss",
|
|
442
|
-
"rs rrrrrrrr s sssssrrrrrr rrs rs ",
|
|
443
|
-
" s s sssssssss s ss s ss",
|
|
444
|
-
" s ",
|
|
445
|
-
" s ",
|
|
446
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
447
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
448
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
449
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
450
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
451
|
-
" s ",
|
|
452
|
-
" s ",
|
|
453
|
-
" s s sssss s s ",
|
|
454
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
455
|
-
"a ",
|
|
456
|
-
"r s rr r ",
|
|
457
|
-
"r sr rr r ",
|
|
458
|
-
"r s rr s rr r ",
|
|
459
|
-
"r rssrr rss rr r ",
|
|
460
|
-
"r rrrrr rrrss rr r ",
|
|
461
|
-
"r rrrrrsss rrrrr rr r ",
|
|
462
|
-
"r rrrrrrrr rrrrr rr r ",
|
|
463
|
-
"r rrrrrrrr rrrrrs rr r ",
|
|
464
|
-
"r rrrrrrrr rrrrrr rr r ",
|
|
465
|
-
"r rrrrrrrr rrrrrr rr r ",
|
|
466
|
-
"r srrrrrrrr rrrrrrs rr sr ",
|
|
467
|
-
"r srrrrrrrr rrrrrrs rr r ",
|
|
468
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
469
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
470
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
471
|
-
"r rrrrrrrr rrrrrr rr r ",
|
|
472
|
-
"r rrrrrrrr rrrrrr rr r ",
|
|
473
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
474
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
475
|
-
" sssss ",
|
|
476
|
-
"r rrrrrrrrr rrrrrrr rr sr ",
|
|
477
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
478
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
479
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
480
|
-
" s ",
|
|
481
|
-
"r srrrrrrrr rrrrrrs rr r ",
|
|
482
|
-
"r rrrrrrrr rrrrr rr r ",
|
|
483
|
-
" s ",
|
|
484
|
-
" s ",
|
|
485
|
-
" rrrrr ",
|
|
486
|
-
" s s sssssssss s sss s ss",
|
|
487
|
-
"r srrrrrrrr rrrrrrs rr r ",
|
|
488
|
-
" s s sssssssss s ss s ss",
|
|
489
|
-
" s s sssssssss s ss s ss",
|
|
490
|
-
" s s sssssssss s ss s ss",
|
|
491
|
-
" s s sssssssss s ss s ss",
|
|
492
|
-
" s s sssssssss s ss s ss",
|
|
493
|
-
" s s sssssssss s ss s ss",
|
|
494
|
-
" s s sssssssss s ss s ss",
|
|
495
|
-
" s s sssssssss s ss s ss",
|
|
496
|
-
" s s sssssssss s ss s ss",
|
|
497
|
-
" s s sssssssss s ss s ss",
|
|
498
|
-
" s s sssssssss s ss s ss",
|
|
499
|
-
" s s sssssssss s ss s ss",
|
|
500
|
-
" s s sssssssss s ss s ss",
|
|
501
|
-
" s s sssssssss ss s ss",
|
|
502
|
-
" s s sssssssss s ss s ss",
|
|
503
|
-
" s s sssss s s ",
|
|
504
|
-
" s s sssss s s ",
|
|
505
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
506
|
-
" s s sssss s s ",
|
|
507
|
-
" s s sssss s s ",
|
|
508
|
-
"r rrrrrrrrr rrrrrrr rr sr ",
|
|
509
|
-
"r rrrrrrrrr rrrrrrr rr sr ",
|
|
510
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
511
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
512
|
-
" s ",
|
|
513
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
514
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
515
|
-
" rr ",
|
|
516
|
-
" s ",
|
|
517
|
-
" rs ",
|
|
518
|
-
"r sr rr r ",
|
|
519
|
-
"r s rr s rr r ",
|
|
520
|
-
"r rssrr rss rr r ",
|
|
521
|
-
"r rssrr rss rr r ",
|
|
522
|
-
"r rrrrr rrrss rr r ",
|
|
523
|
-
"r rrrrr rrrss rr r ",
|
|
524
|
-
"r rrrrr rrrss rr r ",
|
|
525
|
-
"r rrrrr rrrss rr r ",
|
|
526
|
-
"r rrrrrsss rrrrr rr r ",
|
|
527
|
-
"r rrrrrsss rrrrr rr r ",
|
|
528
|
-
"r rrrrrrrr rrrrr rr r ",
|
|
529
|
-
"r rrrrrrrr rrrrr rr r ",
|
|
530
|
-
"r rrrrrrrr rrrrr rr r ",
|
|
531
|
-
"r rrrrrrrr rrrrrr rr r ",
|
|
532
|
-
" r ",
|
|
533
|
-
" s ",
|
|
534
|
-
"r srrrrrrrr rrrrrrs rr r ",
|
|
535
|
-
"r srrrrrrrr rrrrrrs rr r ",
|
|
536
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
537
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
538
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
539
|
-
"r rrrrrrrrr rrrrrrr rr r ",
|
|
540
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
541
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
542
|
-
" s s sssssssss s ss s ss",
|
|
543
|
-
"r rrrrrrrrr rrrrrrr rr rr ",
|
|
544
|
-
" r "
|
|
545
|
-
];
|
|
546
|
-
|
|
547
|
-
XPathParser.actionTableNumber = [
|
|
548
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
549
|
-
" J ",
|
|
550
|
-
"a aaaaaaaaa aaaaaaa aa a ",
|
|
551
|
-
" YYYYY ",
|
|
552
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
553
|
-
"K1 KKKKKKKK . +*)('KKKKKK KK# K\" ",
|
|
554
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
555
|
-
" N ",
|
|
556
|
-
" O ",
|
|
557
|
-
"e eeeeeeeee eeeeeee ee ee ",
|
|
558
|
-
"f fffffffff fffffff ff ff ",
|
|
559
|
-
"d ddddddddd ddddddd dd dd ",
|
|
560
|
-
"B BBBBBBBBB BBBBBBB BB BB ",
|
|
561
|
-
"A AAAAAAAAA AAAAAAA AA AA ",
|
|
562
|
-
" P ",
|
|
563
|
-
" Q ",
|
|
564
|
-
" 1 . +*)(' # \" ",
|
|
565
|
-
"b bbbbbbbbb bbbbbbb bb b ",
|
|
566
|
-
" ",
|
|
567
|
-
"! S !! ! ",
|
|
568
|
-
"\" T\" \"\" \" ",
|
|
569
|
-
"$ V $$ U $$ $ ",
|
|
570
|
-
"& &ZY&& &XW && & ",
|
|
571
|
-
") ))))) )))\\[ )) ) ",
|
|
572
|
-
". ....._^] ..... .. . ",
|
|
573
|
-
"1 11111111 11111 11 1 ",
|
|
574
|
-
"5 55555555 55555` 55 5 ",
|
|
575
|
-
"7 77777777 777777 77 7 ",
|
|
576
|
-
"9 99999999 999999 99 9 ",
|
|
577
|
-
": c:::::::: ::::::b :: a: ",
|
|
578
|
-
"I fIIIIIIII IIIIIIe II I ",
|
|
579
|
-
"= ========= ======= == == ",
|
|
580
|
-
"? ????????? ??????? ?? ?? ",
|
|
581
|
-
"C CCCCCCCCC CCCCCCC CC CC ",
|
|
582
|
-
"J JJJJJJJJ JJJJJJ JJ J ",
|
|
583
|
-
"M MMMMMMMM MMMMMM MM M ",
|
|
584
|
-
"N NNNNNNNNN NNNNNNN NN N ",
|
|
585
|
-
"P PPPPPPPPP PPPPPPP PP P ",
|
|
586
|
-
" +*)(' ",
|
|
587
|
-
"R RRRRRRRRR RRRRRRR RR aR ",
|
|
588
|
-
"U UUUUUUUUU UUUUUUU UU U ",
|
|
589
|
-
"Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ",
|
|
590
|
-
"c ccccccccc ccccccc cc cc ",
|
|
591
|
-
" j ",
|
|
592
|
-
"L fLLLLLLLL LLLLLLe LL L ",
|
|
593
|
-
"6 66666666 66666 66 6 ",
|
|
594
|
-
" k ",
|
|
595
|
-
" l ",
|
|
596
|
-
" XXXXX ",
|
|
597
|
-
" 1 0 /.-,+*)(' & %$m # \"!",
|
|
598
|
-
"_ f________ ______e __ _ ",
|
|
599
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
600
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
601
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
602
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
603
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
604
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
605
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
606
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
607
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
608
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
609
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
610
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
611
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
612
|
-
" 1 0 /.-,+*)(' %$ # \"!",
|
|
613
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
614
|
-
" 1 . +*)(' # \" ",
|
|
615
|
-
" 1 . +*)(' # \" ",
|
|
616
|
-
"> >>>>>>>>> >>>>>>> >> >> ",
|
|
617
|
-
" 1 . +*)(' # \" ",
|
|
618
|
-
" 1 . +*)(' # \" ",
|
|
619
|
-
"Q QQQQQQQQQ QQQQQQQ QQ aQ ",
|
|
620
|
-
"V VVVVVVVVV VVVVVVV VV aV ",
|
|
621
|
-
"T TTTTTTTTT TTTTTTT TT T ",
|
|
622
|
-
"@ @@@@@@@@@ @@@@@@@ @@ @@ ",
|
|
623
|
-
" \x87 ",
|
|
624
|
-
"[ [[[[[[[[[ [[[[[[[ [[ [[ ",
|
|
625
|
-
"D DDDDDDDDD DDDDDDD DD DD ",
|
|
626
|
-
" HH ",
|
|
627
|
-
" \x88 ",
|
|
628
|
-
" F\x89 ",
|
|
629
|
-
"# T# ## # ",
|
|
630
|
-
"% V %% U %% % ",
|
|
631
|
-
"' 'ZY'' 'XW '' ' ",
|
|
632
|
-
"( (ZY(( (XW (( ( ",
|
|
633
|
-
"+ +++++ +++\\[ ++ + ",
|
|
634
|
-
"* ***** ***\\[ ** * ",
|
|
635
|
-
"- ----- ---\\[ -- - ",
|
|
636
|
-
", ,,,,, ,,,\\[ ,, , ",
|
|
637
|
-
"0 00000_^] 00000 00 0 ",
|
|
638
|
-
"/ /////_^] ///// // / ",
|
|
639
|
-
"2 22222222 22222 22 2 ",
|
|
640
|
-
"3 33333333 33333 33 3 ",
|
|
641
|
-
"4 44444444 44444 44 4 ",
|
|
642
|
-
"8 88888888 888888 88 8 ",
|
|
643
|
-
" ^ ",
|
|
644
|
-
" \x8a ",
|
|
645
|
-
"; f;;;;;;;; ;;;;;;e ;; ; ",
|
|
646
|
-
"< f<<<<<<<< <<<<<<e << < ",
|
|
647
|
-
"O OOOOOOOOO OOOOOOO OO O ",
|
|
648
|
-
"` ````````` ``````` `` ` ",
|
|
649
|
-
"S SSSSSSSSS SSSSSSS SS S ",
|
|
650
|
-
"W WWWWWWWWW WWWWWWW WW W ",
|
|
651
|
-
"\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ",
|
|
652
|
-
"E EEEEEEEEE EEEEEEE EE EE ",
|
|
653
|
-
" 1 0 /.-,+*)(' & %$ # \"!",
|
|
654
|
-
"] ]]]]]]]]] ]]]]]]] ]] ]] ",
|
|
655
|
-
" G "
|
|
656
|
-
];
|
|
657
|
-
|
|
658
|
-
XPathParser.gotoTable = [
|
|
659
|
-
"3456789:;<=>?@ AB CDEFGH IJ ",
|
|
660
|
-
" ",
|
|
661
|
-
" ",
|
|
662
|
-
" ",
|
|
663
|
-
"L456789:;<=>?@ AB CDEFGH IJ ",
|
|
664
|
-
" M EFGH IJ ",
|
|
665
|
-
" N;<=>?@ AB CDEFGH IJ ",
|
|
666
|
-
" ",
|
|
667
|
-
" ",
|
|
668
|
-
" ",
|
|
669
|
-
" ",
|
|
670
|
-
" ",
|
|
671
|
-
" ",
|
|
672
|
-
" ",
|
|
673
|
-
" ",
|
|
674
|
-
" ",
|
|
675
|
-
" S EFGH IJ ",
|
|
676
|
-
" ",
|
|
677
|
-
" ",
|
|
678
|
-
" ",
|
|
679
|
-
" ",
|
|
680
|
-
" ",
|
|
681
|
-
" ",
|
|
682
|
-
" ",
|
|
683
|
-
" ",
|
|
684
|
-
" ",
|
|
685
|
-
" ",
|
|
686
|
-
" ",
|
|
687
|
-
" ",
|
|
688
|
-
" e ",
|
|
689
|
-
" ",
|
|
690
|
-
" ",
|
|
691
|
-
" ",
|
|
692
|
-
" ",
|
|
693
|
-
" ",
|
|
694
|
-
" ",
|
|
695
|
-
" ",
|
|
696
|
-
" ",
|
|
697
|
-
" h J ",
|
|
698
|
-
" i j ",
|
|
699
|
-
" ",
|
|
700
|
-
" ",
|
|
701
|
-
" ",
|
|
702
|
-
" ",
|
|
703
|
-
" ",
|
|
704
|
-
" ",
|
|
705
|
-
" ",
|
|
706
|
-
" ",
|
|
707
|
-
" ",
|
|
708
|
-
"o456789:;<=>?@ ABpqCDEFGH IJ ",
|
|
709
|
-
" ",
|
|
710
|
-
" r6789:;<=>?@ AB CDEFGH IJ ",
|
|
711
|
-
" s789:;<=>?@ AB CDEFGH IJ ",
|
|
712
|
-
" t89:;<=>?@ AB CDEFGH IJ ",
|
|
713
|
-
" u89:;<=>?@ AB CDEFGH IJ ",
|
|
714
|
-
" v9:;<=>?@ AB CDEFGH IJ ",
|
|
715
|
-
" w9:;<=>?@ AB CDEFGH IJ ",
|
|
716
|
-
" x9:;<=>?@ AB CDEFGH IJ ",
|
|
717
|
-
" y9:;<=>?@ AB CDEFGH IJ ",
|
|
718
|
-
" z:;<=>?@ AB CDEFGH IJ ",
|
|
719
|
-
" {:;<=>?@ AB CDEFGH IJ ",
|
|
720
|
-
" |;<=>?@ AB CDEFGH IJ ",
|
|
721
|
-
" };<=>?@ AB CDEFGH IJ ",
|
|
722
|
-
" ~;<=>?@ AB CDEFGH IJ ",
|
|
723
|
-
" \x7f=>?@ AB CDEFGH IJ ",
|
|
724
|
-
"\x80456789:;<=>?@ AB CDEFGH IJ\x81",
|
|
725
|
-
" \x82 EFGH IJ ",
|
|
726
|
-
" \x83 EFGH IJ ",
|
|
727
|
-
" ",
|
|
728
|
-
" \x84 GH IJ ",
|
|
729
|
-
" \x85 GH IJ ",
|
|
730
|
-
" i \x86 ",
|
|
731
|
-
" i \x87 ",
|
|
732
|
-
" ",
|
|
733
|
-
" ",
|
|
734
|
-
" ",
|
|
735
|
-
" ",
|
|
736
|
-
" ",
|
|
737
|
-
" ",
|
|
738
|
-
" ",
|
|
739
|
-
" ",
|
|
740
|
-
" ",
|
|
741
|
-
" ",
|
|
742
|
-
" ",
|
|
743
|
-
" ",
|
|
744
|
-
" ",
|
|
745
|
-
" ",
|
|
746
|
-
" ",
|
|
747
|
-
" ",
|
|
748
|
-
" ",
|
|
749
|
-
" ",
|
|
750
|
-
" ",
|
|
751
|
-
" ",
|
|
752
|
-
" ",
|
|
753
|
-
" ",
|
|
754
|
-
" ",
|
|
755
|
-
" ",
|
|
756
|
-
" ",
|
|
757
|
-
" ",
|
|
758
|
-
" ",
|
|
759
|
-
" ",
|
|
760
|
-
" ",
|
|
761
|
-
" ",
|
|
762
|
-
" ",
|
|
763
|
-
" ",
|
|
764
|
-
"o456789:;<=>?@ AB\x8cqCDEFGH IJ ",
|
|
765
|
-
" ",
|
|
766
|
-
" "
|
|
767
|
-
];
|
|
768
|
-
|
|
769
|
-
XPathParser.productions = [
|
|
770
|
-
[1, 1, 2],
|
|
771
|
-
[2, 1, 3],
|
|
772
|
-
[3, 1, 4],
|
|
773
|
-
[3, 3, 3, -9, 4],
|
|
774
|
-
[4, 1, 5],
|
|
775
|
-
[4, 3, 4, -8, 5],
|
|
776
|
-
[5, 1, 6],
|
|
777
|
-
[5, 3, 5, -22, 6],
|
|
778
|
-
[5, 3, 5, -5, 6],
|
|
779
|
-
[6, 1, 7],
|
|
780
|
-
[6, 3, 6, -23, 7],
|
|
781
|
-
[6, 3, 6, -24, 7],
|
|
782
|
-
[6, 3, 6, -6, 7],
|
|
783
|
-
[6, 3, 6, -7, 7],
|
|
784
|
-
[7, 1, 8],
|
|
785
|
-
[7, 3, 7, -25, 8],
|
|
786
|
-
[7, 3, 7, -26, 8],
|
|
787
|
-
[8, 1, 9],
|
|
788
|
-
[8, 3, 8, -12, 9],
|
|
789
|
-
[8, 3, 8, -11, 9],
|
|
790
|
-
[8, 3, 8, -10, 9],
|
|
791
|
-
[9, 1, 10],
|
|
792
|
-
[9, 2, -26, 9],
|
|
793
|
-
[10, 1, 11],
|
|
794
|
-
[10, 3, 10, -27, 11],
|
|
795
|
-
[11, 1, 12],
|
|
796
|
-
[11, 1, 13],
|
|
797
|
-
[11, 3, 13, -28, 14],
|
|
798
|
-
[11, 3, 13, -4, 14],
|
|
799
|
-
[13, 1, 15],
|
|
800
|
-
[13, 2, 13, 16],
|
|
801
|
-
[15, 1, 17],
|
|
802
|
-
[15, 3, -29, 2, -30],
|
|
803
|
-
[15, 1, -15],
|
|
804
|
-
[15, 1, -16],
|
|
805
|
-
[15, 1, 18],
|
|
806
|
-
[18, 3, -13, -29, -30],
|
|
807
|
-
[18, 4, -13, -29, 19, -30],
|
|
808
|
-
[19, 1, 20],
|
|
809
|
-
[19, 3, 20, -31, 19],
|
|
810
|
-
[20, 1, 2],
|
|
811
|
-
[12, 1, 14],
|
|
812
|
-
[12, 1, 21],
|
|
813
|
-
[21, 1, -28],
|
|
814
|
-
[21, 2, -28, 14],
|
|
815
|
-
[21, 1, 22],
|
|
816
|
-
[14, 1, 23],
|
|
817
|
-
[14, 3, 14, -28, 23],
|
|
818
|
-
[14, 1, 24],
|
|
819
|
-
[23, 2, 25, 26],
|
|
820
|
-
[23, 1, 26],
|
|
821
|
-
[23, 3, 25, 26, 27],
|
|
822
|
-
[23, 2, 26, 27],
|
|
823
|
-
[23, 1, 28],
|
|
824
|
-
[27, 1, 16],
|
|
825
|
-
[27, 2, 16, 27],
|
|
826
|
-
[25, 2, -14, -3],
|
|
827
|
-
[25, 1, -32],
|
|
828
|
-
[26, 1, 29],
|
|
829
|
-
[26, 3, -20, -29, -30],
|
|
830
|
-
[26, 4, -21, -29, -15, -30],
|
|
831
|
-
[16, 3, -33, 30, -34],
|
|
832
|
-
[30, 1, 2],
|
|
833
|
-
[22, 2, -4, 14],
|
|
834
|
-
[24, 3, 14, -4, 23],
|
|
835
|
-
[28, 1, -35],
|
|
836
|
-
[28, 1, -2],
|
|
837
|
-
[17, 2, -36, -18],
|
|
838
|
-
[29, 1, -17],
|
|
839
|
-
[29, 1, -19],
|
|
840
|
-
[29, 1, -18]
|
|
841
|
-
];
|
|
842
|
-
|
|
843
|
-
XPathParser.DOUBLEDOT = 2;
|
|
844
|
-
XPathParser.DOUBLECOLON = 3;
|
|
845
|
-
XPathParser.DOUBLESLASH = 4;
|
|
846
|
-
XPathParser.NOTEQUAL = 5;
|
|
847
|
-
XPathParser.LESSTHANOREQUAL = 6;
|
|
848
|
-
XPathParser.GREATERTHANOREQUAL = 7;
|
|
849
|
-
XPathParser.AND = 8;
|
|
850
|
-
XPathParser.OR = 9;
|
|
851
|
-
XPathParser.MOD = 10;
|
|
852
|
-
XPathParser.DIV = 11;
|
|
853
|
-
XPathParser.MULTIPLYOPERATOR = 12;
|
|
854
|
-
XPathParser.FUNCTIONNAME = 13;
|
|
855
|
-
XPathParser.AXISNAME = 14;
|
|
856
|
-
XPathParser.LITERAL = 15;
|
|
857
|
-
XPathParser.NUMBER = 16;
|
|
858
|
-
XPathParser.ASTERISKNAMETEST = 17;
|
|
859
|
-
XPathParser.QNAME = 18;
|
|
860
|
-
XPathParser.NCNAMECOLONASTERISK = 19;
|
|
861
|
-
XPathParser.NODETYPE = 20;
|
|
862
|
-
XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL = 21;
|
|
863
|
-
XPathParser.EQUALS = 22;
|
|
864
|
-
XPathParser.LESSTHAN = 23;
|
|
865
|
-
XPathParser.GREATERTHAN = 24;
|
|
866
|
-
XPathParser.PLUS = 25;
|
|
867
|
-
XPathParser.MINUS = 26;
|
|
868
|
-
XPathParser.BAR = 27;
|
|
869
|
-
XPathParser.SLASH = 28;
|
|
870
|
-
XPathParser.LEFTPARENTHESIS = 29;
|
|
871
|
-
XPathParser.RIGHTPARENTHESIS = 30;
|
|
872
|
-
XPathParser.COMMA = 31;
|
|
873
|
-
XPathParser.AT = 32;
|
|
874
|
-
XPathParser.LEFTBRACKET = 33;
|
|
875
|
-
XPathParser.RIGHTBRACKET = 34;
|
|
876
|
-
XPathParser.DOT = 35;
|
|
877
|
-
XPathParser.DOLLAR = 36;
|
|
878
|
-
|
|
879
|
-
XPathParser.prototype.tokenize = function (s1) {
|
|
880
|
-
var types = [];
|
|
881
|
-
var values = [];
|
|
882
|
-
var s = s1 + '\0';
|
|
883
|
-
|
|
884
|
-
var pos = 0;
|
|
885
|
-
var c = s.charAt(pos++);
|
|
886
|
-
while (1) {
|
|
887
|
-
while (c == ' ' || c == '\t' || c == '\r' || c == '\n') {
|
|
888
|
-
c = s.charAt(pos++);
|
|
889
|
-
}
|
|
890
|
-
if (c == '\0' || pos >= s.length) {
|
|
891
|
-
break;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
if (c == '(') {
|
|
895
|
-
types.push(XPathParser.LEFTPARENTHESIS);
|
|
896
|
-
values.push(c);
|
|
897
|
-
c = s.charAt(pos++);
|
|
898
|
-
continue;
|
|
899
|
-
}
|
|
900
|
-
if (c == ')') {
|
|
901
|
-
types.push(XPathParser.RIGHTPARENTHESIS);
|
|
902
|
-
values.push(c);
|
|
903
|
-
c = s.charAt(pos++);
|
|
904
|
-
continue;
|
|
905
|
-
}
|
|
906
|
-
if (c == '[') {
|
|
907
|
-
types.push(XPathParser.LEFTBRACKET);
|
|
908
|
-
values.push(c);
|
|
909
|
-
c = s.charAt(pos++);
|
|
910
|
-
continue;
|
|
911
|
-
}
|
|
912
|
-
if (c == ']') {
|
|
913
|
-
types.push(XPathParser.RIGHTBRACKET);
|
|
914
|
-
values.push(c);
|
|
915
|
-
c = s.charAt(pos++);
|
|
916
|
-
continue;
|
|
917
|
-
}
|
|
918
|
-
if (c == '@') {
|
|
919
|
-
types.push(XPathParser.AT);
|
|
920
|
-
values.push(c);
|
|
921
|
-
c = s.charAt(pos++);
|
|
922
|
-
continue;
|
|
923
|
-
}
|
|
924
|
-
if (c == ',') {
|
|
925
|
-
types.push(XPathParser.COMMA);
|
|
926
|
-
values.push(c);
|
|
927
|
-
c = s.charAt(pos++);
|
|
928
|
-
continue;
|
|
929
|
-
}
|
|
930
|
-
if (c == '|') {
|
|
931
|
-
types.push(XPathParser.BAR);
|
|
932
|
-
values.push(c);
|
|
933
|
-
c = s.charAt(pos++);
|
|
934
|
-
continue;
|
|
935
|
-
}
|
|
936
|
-
if (c == '+') {
|
|
937
|
-
types.push(XPathParser.PLUS);
|
|
938
|
-
values.push(c);
|
|
939
|
-
c = s.charAt(pos++);
|
|
940
|
-
continue;
|
|
941
|
-
}
|
|
942
|
-
if (c == '-') {
|
|
943
|
-
types.push(XPathParser.MINUS);
|
|
944
|
-
values.push(c);
|
|
945
|
-
c = s.charAt(pos++);
|
|
946
|
-
continue;
|
|
947
|
-
}
|
|
948
|
-
if (c == '=') {
|
|
949
|
-
types.push(XPathParser.EQUALS);
|
|
950
|
-
values.push(c);
|
|
951
|
-
c = s.charAt(pos++);
|
|
952
|
-
continue;
|
|
953
|
-
}
|
|
954
|
-
if (c == '$') {
|
|
955
|
-
types.push(XPathParser.DOLLAR);
|
|
956
|
-
values.push(c);
|
|
957
|
-
c = s.charAt(pos++);
|
|
958
|
-
continue;
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
if (c == '.') {
|
|
962
|
-
c = s.charAt(pos++);
|
|
963
|
-
if (c == '.') {
|
|
964
|
-
types.push(XPathParser.DOUBLEDOT);
|
|
965
|
-
values.push("..");
|
|
966
|
-
c = s.charAt(pos++);
|
|
967
|
-
continue;
|
|
968
|
-
}
|
|
969
|
-
if (c >= '0' && c <= '9') {
|
|
970
|
-
var number = "." + c;
|
|
971
|
-
c = s.charAt(pos++);
|
|
972
|
-
while (c >= '0' && c <= '9') {
|
|
973
|
-
number += c;
|
|
974
|
-
c = s.charAt(pos++);
|
|
975
|
-
}
|
|
976
|
-
types.push(XPathParser.NUMBER);
|
|
977
|
-
values.push(number);
|
|
978
|
-
continue;
|
|
979
|
-
}
|
|
980
|
-
types.push(XPathParser.DOT);
|
|
981
|
-
values.push('.');
|
|
982
|
-
continue;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
if (c == '\'' || c == '"') {
|
|
986
|
-
var delimiter = c;
|
|
987
|
-
var literal = "";
|
|
988
|
-
while (pos < s.length && (c = s.charAt(pos)) !== delimiter) {
|
|
989
|
-
literal += c;
|
|
990
|
-
pos += 1;
|
|
991
|
-
}
|
|
992
|
-
if (c !== delimiter) {
|
|
993
|
-
throw XPathException.fromMessage("Unterminated string literal: " + delimiter + literal);
|
|
994
|
-
}
|
|
995
|
-
pos += 1;
|
|
996
|
-
types.push(XPathParser.LITERAL);
|
|
997
|
-
values.push(literal);
|
|
998
|
-
c = s.charAt(pos++);
|
|
999
|
-
continue;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
if (c >= '0' && c <= '9') {
|
|
1003
|
-
var number = c;
|
|
1004
|
-
c = s.charAt(pos++);
|
|
1005
|
-
while (c >= '0' && c <= '9') {
|
|
1006
|
-
number += c;
|
|
1007
|
-
c = s.charAt(pos++);
|
|
1008
|
-
}
|
|
1009
|
-
if (c == '.') {
|
|
1010
|
-
if (s.charAt(pos) >= '0' && s.charAt(pos) <= '9') {
|
|
1011
|
-
number += c;
|
|
1012
|
-
number += s.charAt(pos++);
|
|
1013
|
-
c = s.charAt(pos++);
|
|
1014
|
-
while (c >= '0' && c <= '9') {
|
|
1015
|
-
number += c;
|
|
1016
|
-
c = s.charAt(pos++);
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
types.push(XPathParser.NUMBER);
|
|
1021
|
-
values.push(number);
|
|
1022
|
-
continue;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
if (c == '*') {
|
|
1026
|
-
if (types.length > 0) {
|
|
1027
|
-
var last = types[types.length - 1];
|
|
1028
|
-
if (last != XPathParser.AT
|
|
1029
|
-
&& last != XPathParser.DOUBLECOLON
|
|
1030
|
-
&& last != XPathParser.LEFTPARENTHESIS
|
|
1031
|
-
&& last != XPathParser.LEFTBRACKET
|
|
1032
|
-
&& last != XPathParser.AND
|
|
1033
|
-
&& last != XPathParser.OR
|
|
1034
|
-
&& last != XPathParser.MOD
|
|
1035
|
-
&& last != XPathParser.DIV
|
|
1036
|
-
&& last != XPathParser.MULTIPLYOPERATOR
|
|
1037
|
-
&& last != XPathParser.SLASH
|
|
1038
|
-
&& last != XPathParser.DOUBLESLASH
|
|
1039
|
-
&& last != XPathParser.BAR
|
|
1040
|
-
&& last != XPathParser.PLUS
|
|
1041
|
-
&& last != XPathParser.MINUS
|
|
1042
|
-
&& last != XPathParser.EQUALS
|
|
1043
|
-
&& last != XPathParser.NOTEQUAL
|
|
1044
|
-
&& last != XPathParser.LESSTHAN
|
|
1045
|
-
&& last != XPathParser.LESSTHANOREQUAL
|
|
1046
|
-
&& last != XPathParser.GREATERTHAN
|
|
1047
|
-
&& last != XPathParser.GREATERTHANOREQUAL) {
|
|
1048
|
-
types.push(XPathParser.MULTIPLYOPERATOR);
|
|
1049
|
-
values.push(c);
|
|
1050
|
-
c = s.charAt(pos++);
|
|
1051
|
-
continue;
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
types.push(XPathParser.ASTERISKNAMETEST);
|
|
1055
|
-
values.push(c);
|
|
1056
|
-
c = s.charAt(pos++);
|
|
1057
|
-
continue;
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
if (c == ':') {
|
|
1061
|
-
if (s.charAt(pos) == ':') {
|
|
1062
|
-
types.push(XPathParser.DOUBLECOLON);
|
|
1063
|
-
values.push("::");
|
|
1064
|
-
pos++;
|
|
1065
|
-
c = s.charAt(pos++);
|
|
1066
|
-
continue;
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
if (c == '/') {
|
|
1071
|
-
c = s.charAt(pos++);
|
|
1072
|
-
if (c == '/') {
|
|
1073
|
-
types.push(XPathParser.DOUBLESLASH);
|
|
1074
|
-
values.push("//");
|
|
1075
|
-
c = s.charAt(pos++);
|
|
1076
|
-
continue;
|
|
1077
|
-
}
|
|
1078
|
-
types.push(XPathParser.SLASH);
|
|
1079
|
-
values.push('/');
|
|
1080
|
-
continue;
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
if (c == '!') {
|
|
1084
|
-
if (s.charAt(pos) == '=') {
|
|
1085
|
-
types.push(XPathParser.NOTEQUAL);
|
|
1086
|
-
values.push("!=");
|
|
1087
|
-
pos++;
|
|
1088
|
-
c = s.charAt(pos++);
|
|
1089
|
-
continue;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
if (c == '<') {
|
|
1094
|
-
if (s.charAt(pos) == '=') {
|
|
1095
|
-
types.push(XPathParser.LESSTHANOREQUAL);
|
|
1096
|
-
values.push("<=");
|
|
1097
|
-
pos++;
|
|
1098
|
-
c = s.charAt(pos++);
|
|
1099
|
-
continue;
|
|
1100
|
-
}
|
|
1101
|
-
types.push(XPathParser.LESSTHAN);
|
|
1102
|
-
values.push('<');
|
|
1103
|
-
c = s.charAt(pos++);
|
|
1104
|
-
continue;
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
if (c == '>') {
|
|
1108
|
-
if (s.charAt(pos) == '=') {
|
|
1109
|
-
types.push(XPathParser.GREATERTHANOREQUAL);
|
|
1110
|
-
values.push(">=");
|
|
1111
|
-
pos++;
|
|
1112
|
-
c = s.charAt(pos++);
|
|
1113
|
-
continue;
|
|
1114
|
-
}
|
|
1115
|
-
types.push(XPathParser.GREATERTHAN);
|
|
1116
|
-
values.push('>');
|
|
1117
|
-
c = s.charAt(pos++);
|
|
1118
|
-
continue;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
if (c == '_' || Utilities.isLetter(c.charCodeAt(0))) {
|
|
1122
|
-
var name = c;
|
|
1123
|
-
c = s.charAt(pos++);
|
|
1124
|
-
while (Utilities.isNCNameChar(c.charCodeAt(0))) {
|
|
1125
|
-
name += c;
|
|
1126
|
-
c = s.charAt(pos++);
|
|
1127
|
-
}
|
|
1128
|
-
if (types.length > 0) {
|
|
1129
|
-
var last = types[types.length - 1];
|
|
1130
|
-
if (last != XPathParser.AT
|
|
1131
|
-
&& last != XPathParser.DOUBLECOLON
|
|
1132
|
-
&& last != XPathParser.LEFTPARENTHESIS
|
|
1133
|
-
&& last != XPathParser.LEFTBRACKET
|
|
1134
|
-
&& last != XPathParser.AND
|
|
1135
|
-
&& last != XPathParser.OR
|
|
1136
|
-
&& last != XPathParser.MOD
|
|
1137
|
-
&& last != XPathParser.DIV
|
|
1138
|
-
&& last != XPathParser.MULTIPLYOPERATOR
|
|
1139
|
-
&& last != XPathParser.SLASH
|
|
1140
|
-
&& last != XPathParser.DOUBLESLASH
|
|
1141
|
-
&& last != XPathParser.BAR
|
|
1142
|
-
&& last != XPathParser.PLUS
|
|
1143
|
-
&& last != XPathParser.MINUS
|
|
1144
|
-
&& last != XPathParser.EQUALS
|
|
1145
|
-
&& last != XPathParser.NOTEQUAL
|
|
1146
|
-
&& last != XPathParser.LESSTHAN
|
|
1147
|
-
&& last != XPathParser.LESSTHANOREQUAL
|
|
1148
|
-
&& last != XPathParser.GREATERTHAN
|
|
1149
|
-
&& last != XPathParser.GREATERTHANOREQUAL) {
|
|
1150
|
-
if (name == "and") {
|
|
1151
|
-
types.push(XPathParser.AND);
|
|
1152
|
-
values.push(name);
|
|
1153
|
-
continue;
|
|
1154
|
-
}
|
|
1155
|
-
if (name == "or") {
|
|
1156
|
-
types.push(XPathParser.OR);
|
|
1157
|
-
values.push(name);
|
|
1158
|
-
continue;
|
|
1159
|
-
}
|
|
1160
|
-
if (name == "mod") {
|
|
1161
|
-
types.push(XPathParser.MOD);
|
|
1162
|
-
values.push(name);
|
|
1163
|
-
continue;
|
|
1164
|
-
}
|
|
1165
|
-
if (name == "div") {
|
|
1166
|
-
types.push(XPathParser.DIV);
|
|
1167
|
-
values.push(name);
|
|
1168
|
-
continue;
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
if (c == ':') {
|
|
1173
|
-
if (s.charAt(pos) == '*') {
|
|
1174
|
-
types.push(XPathParser.NCNAMECOLONASTERISK);
|
|
1175
|
-
values.push(name + ":*");
|
|
1176
|
-
pos++;
|
|
1177
|
-
c = s.charAt(pos++);
|
|
1178
|
-
continue;
|
|
1179
|
-
}
|
|
1180
|
-
if (s.charAt(pos) == '_' || Utilities.isLetter(s.charCodeAt(pos))) {
|
|
1181
|
-
name += ':';
|
|
1182
|
-
c = s.charAt(pos++);
|
|
1183
|
-
while (Utilities.isNCNameChar(c.charCodeAt(0))) {
|
|
1184
|
-
name += c;
|
|
1185
|
-
c = s.charAt(pos++);
|
|
1186
|
-
}
|
|
1187
|
-
if (c == '(') {
|
|
1188
|
-
types.push(XPathParser.FUNCTIONNAME);
|
|
1189
|
-
values.push(name);
|
|
1190
|
-
continue;
|
|
1191
|
-
}
|
|
1192
|
-
types.push(XPathParser.QNAME);
|
|
1193
|
-
values.push(name);
|
|
1194
|
-
continue;
|
|
1195
|
-
}
|
|
1196
|
-
if (s.charAt(pos) == ':') {
|
|
1197
|
-
types.push(XPathParser.AXISNAME);
|
|
1198
|
-
values.push(name);
|
|
1199
|
-
continue;
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
if (c == '(') {
|
|
1203
|
-
if (name == "comment" || name == "text" || name == "node") {
|
|
1204
|
-
types.push(XPathParser.NODETYPE);
|
|
1205
|
-
values.push(name);
|
|
1206
|
-
continue;
|
|
1207
|
-
}
|
|
1208
|
-
if (name == "processing-instruction") {
|
|
1209
|
-
if (s.charAt(pos) == ')') {
|
|
1210
|
-
types.push(XPathParser.NODETYPE);
|
|
1211
|
-
} else {
|
|
1212
|
-
types.push(XPathParser.PROCESSINGINSTRUCTIONWITHLITERAL);
|
|
1213
|
-
}
|
|
1214
|
-
values.push(name);
|
|
1215
|
-
continue;
|
|
1216
|
-
}
|
|
1217
|
-
types.push(XPathParser.FUNCTIONNAME);
|
|
1218
|
-
values.push(name);
|
|
1219
|
-
continue;
|
|
1220
|
-
}
|
|
1221
|
-
types.push(XPathParser.QNAME);
|
|
1222
|
-
values.push(name);
|
|
1223
|
-
continue;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
throw new Error("Unexpected character " + c);
|
|
1227
|
-
}
|
|
1228
|
-
types.push(1);
|
|
1229
|
-
values.push("[EOF]");
|
|
1230
|
-
return [types, values];
|
|
1231
|
-
};
|
|
1232
|
-
|
|
1233
|
-
XPathParser.SHIFT = 's';
|
|
1234
|
-
XPathParser.REDUCE = 'r';
|
|
1235
|
-
XPathParser.ACCEPT = 'a';
|
|
1236
|
-
|
|
1237
|
-
XPathParser.prototype.parse = function (s) {
|
|
1238
|
-
var types;
|
|
1239
|
-
var values;
|
|
1240
|
-
var res = this.tokenize(s);
|
|
1241
|
-
if (res == undefined) {
|
|
1242
|
-
return undefined;
|
|
1243
|
-
}
|
|
1244
|
-
types = res[0];
|
|
1245
|
-
values = res[1];
|
|
1246
|
-
var tokenPos = 0;
|
|
1247
|
-
var state = [];
|
|
1248
|
-
var tokenType = [];
|
|
1249
|
-
var tokenValue = [];
|
|
1250
|
-
var s;
|
|
1251
|
-
var a;
|
|
1252
|
-
var t;
|
|
1253
|
-
|
|
1254
|
-
state.push(0);
|
|
1255
|
-
tokenType.push(1);
|
|
1256
|
-
tokenValue.push("_S");
|
|
1257
|
-
|
|
1258
|
-
a = types[tokenPos];
|
|
1259
|
-
t = values[tokenPos++];
|
|
1260
|
-
while (1) {
|
|
1261
|
-
s = state[state.length - 1];
|
|
1262
|
-
switch (XPathParser.actionTable[s].charAt(a - 1)) {
|
|
1263
|
-
case XPathParser.SHIFT:
|
|
1264
|
-
tokenType.push(-a);
|
|
1265
|
-
tokenValue.push(t);
|
|
1266
|
-
state.push(XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32);
|
|
1267
|
-
a = types[tokenPos];
|
|
1268
|
-
t = values[tokenPos++];
|
|
1269
|
-
break;
|
|
1270
|
-
case XPathParser.REDUCE:
|
|
1271
|
-
var num = XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][1];
|
|
1272
|
-
var rhs = [];
|
|
1273
|
-
for (var i = 0; i < num; i++) {
|
|
1274
|
-
tokenType.pop();
|
|
1275
|
-
rhs.unshift(tokenValue.pop());
|
|
1276
|
-
state.pop();
|
|
1277
|
-
}
|
|
1278
|
-
var s_ = state[state.length - 1];
|
|
1279
|
-
tokenType.push(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0]);
|
|
1280
|
-
if (this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32] == undefined) {
|
|
1281
|
-
tokenValue.push(rhs[0]);
|
|
1282
|
-
} else {
|
|
1283
|
-
tokenValue.push(this.reduceActions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32](rhs));
|
|
1284
|
-
}
|
|
1285
|
-
state.push(XPathParser.gotoTable[s_].charCodeAt(XPathParser.productions[XPathParser.actionTableNumber[s].charCodeAt(a - 1) - 32][0] - 2) - 33);
|
|
1286
|
-
break;
|
|
1287
|
-
case XPathParser.ACCEPT:
|
|
1288
|
-
return new XPath(tokenValue.pop());
|
|
1289
|
-
default:
|
|
1290
|
-
throw new Error("XPath parse error");
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
};
|
|
1294
|
-
|
|
1295
|
-
// XPath /////////////////////////////////////////////////////////////////////
|
|
1296
|
-
|
|
1297
|
-
XPath.prototype = new Object();
|
|
1298
|
-
XPath.prototype.constructor = XPath;
|
|
1299
|
-
XPath.superclass = Object.prototype;
|
|
1300
|
-
|
|
1301
|
-
function XPath(e) {
|
|
1302
|
-
this.expression = e;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
XPath.prototype.toString = function () {
|
|
1306
|
-
return this.expression.toString();
|
|
1307
|
-
};
|
|
1308
|
-
|
|
1309
|
-
function setIfUnset(obj, prop, value) {
|
|
1310
|
-
if (!(prop in obj)) {
|
|
1311
|
-
obj[prop] = value;
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
XPath.prototype.evaluate = function (c) {
|
|
1316
|
-
c.contextNode = c.expressionContextNode;
|
|
1317
|
-
c.contextSize = 1;
|
|
1318
|
-
c.contextPosition = 1;
|
|
1319
|
-
|
|
1320
|
-
// [2017-11-25] Removed usage of .implementation.hasFeature() since it does
|
|
1321
|
-
// not reliably detect HTML DOMs (always returns false in xmldom and true in browsers)
|
|
1322
|
-
if (c.isHtml) {
|
|
1323
|
-
setIfUnset(c, 'caseInsensitive', true);
|
|
1324
|
-
setIfUnset(c, 'allowAnyNamespaceForNoPrefix', true);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
setIfUnset(c, 'caseInsensitive', false);
|
|
1328
|
-
|
|
1329
|
-
return this.expression.evaluate(c);
|
|
1330
|
-
};
|
|
1331
|
-
|
|
1332
|
-
XPath.XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
|
|
1333
|
-
XPath.XMLNS_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/";
|
|
1334
|
-
|
|
1335
|
-
// Expression ////////////////////////////////////////////////////////////////
|
|
1336
|
-
|
|
1337
|
-
Expression.prototype = new Object();
|
|
1338
|
-
Expression.prototype.constructor = Expression;
|
|
1339
|
-
Expression.superclass = Object.prototype;
|
|
1340
|
-
|
|
1341
|
-
function Expression() {
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
Expression.prototype.init = function () {
|
|
1345
|
-
};
|
|
1346
|
-
|
|
1347
|
-
Expression.prototype.toString = function () {
|
|
1348
|
-
return "<Expression>";
|
|
1349
|
-
};
|
|
1350
|
-
|
|
1351
|
-
Expression.prototype.evaluate = function (c) {
|
|
1352
|
-
throw new Error("Could not evaluate expression.");
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
// UnaryOperation ////////////////////////////////////////////////////////////
|
|
1356
|
-
|
|
1357
|
-
UnaryOperation.prototype = new Expression();
|
|
1358
|
-
UnaryOperation.prototype.constructor = UnaryOperation;
|
|
1359
|
-
UnaryOperation.superclass = Expression.prototype;
|
|
1360
|
-
|
|
1361
|
-
function UnaryOperation(rhs) {
|
|
1362
|
-
if (arguments.length > 0) {
|
|
1363
|
-
this.init(rhs);
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
UnaryOperation.prototype.init = function (rhs) {
|
|
1368
|
-
this.rhs = rhs;
|
|
1369
|
-
};
|
|
1370
|
-
|
|
1371
|
-
// UnaryMinusOperation ///////////////////////////////////////////////////////
|
|
1372
|
-
|
|
1373
|
-
UnaryMinusOperation.prototype = new UnaryOperation();
|
|
1374
|
-
UnaryMinusOperation.prototype.constructor = UnaryMinusOperation;
|
|
1375
|
-
UnaryMinusOperation.superclass = UnaryOperation.prototype;
|
|
1376
|
-
|
|
1377
|
-
function UnaryMinusOperation(rhs) {
|
|
1378
|
-
if (arguments.length > 0) {
|
|
1379
|
-
this.init(rhs);
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
|
-
UnaryMinusOperation.prototype.init = function (rhs) {
|
|
1384
|
-
UnaryMinusOperation.superclass.init.call(this, rhs);
|
|
1385
|
-
};
|
|
1386
|
-
|
|
1387
|
-
UnaryMinusOperation.prototype.evaluate = function (c) {
|
|
1388
|
-
return this.rhs.evaluate(c).number().negate();
|
|
1389
|
-
};
|
|
1390
|
-
|
|
1391
|
-
UnaryMinusOperation.prototype.toString = function () {
|
|
1392
|
-
return "-" + this.rhs.toString();
|
|
1393
|
-
};
|
|
1394
|
-
|
|
1395
|
-
// BinaryOperation ///////////////////////////////////////////////////////////
|
|
1396
|
-
|
|
1397
|
-
BinaryOperation.prototype = new Expression();
|
|
1398
|
-
BinaryOperation.prototype.constructor = BinaryOperation;
|
|
1399
|
-
BinaryOperation.superclass = Expression.prototype;
|
|
1400
|
-
|
|
1401
|
-
function BinaryOperation(lhs, rhs) {
|
|
1402
|
-
if (arguments.length > 0) {
|
|
1403
|
-
this.init(lhs, rhs);
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
BinaryOperation.prototype.init = function (lhs, rhs) {
|
|
1408
|
-
this.lhs = lhs;
|
|
1409
|
-
this.rhs = rhs;
|
|
1410
|
-
};
|
|
1411
|
-
|
|
1412
|
-
// OrOperation ///////////////////////////////////////////////////////////////
|
|
1413
|
-
|
|
1414
|
-
OrOperation.prototype = new BinaryOperation();
|
|
1415
|
-
OrOperation.prototype.constructor = OrOperation;
|
|
1416
|
-
OrOperation.superclass = BinaryOperation.prototype;
|
|
1417
|
-
|
|
1418
|
-
function OrOperation(lhs, rhs) {
|
|
1419
|
-
if (arguments.length > 0) {
|
|
1420
|
-
this.init(lhs, rhs);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
OrOperation.prototype.init = function (lhs, rhs) {
|
|
1425
|
-
OrOperation.superclass.init.call(this, lhs, rhs);
|
|
1426
|
-
};
|
|
1427
|
-
|
|
1428
|
-
OrOperation.prototype.toString = function () {
|
|
1429
|
-
return "(" + this.lhs.toString() + " or " + this.rhs.toString() + ")";
|
|
1430
|
-
};
|
|
1431
|
-
|
|
1432
|
-
OrOperation.prototype.evaluate = function (c) {
|
|
1433
|
-
var b = this.lhs.evaluate(c).bool();
|
|
1434
|
-
if (b.booleanValue()) {
|
|
1435
|
-
return b;
|
|
1436
|
-
}
|
|
1437
|
-
return this.rhs.evaluate(c).bool();
|
|
1438
|
-
};
|
|
1439
|
-
|
|
1440
|
-
// AndOperation //////////////////////////////////////////////////////////////
|
|
1441
|
-
|
|
1442
|
-
AndOperation.prototype = new BinaryOperation();
|
|
1443
|
-
AndOperation.prototype.constructor = AndOperation;
|
|
1444
|
-
AndOperation.superclass = BinaryOperation.prototype;
|
|
1445
|
-
|
|
1446
|
-
function AndOperation(lhs, rhs) {
|
|
1447
|
-
if (arguments.length > 0) {
|
|
1448
|
-
this.init(lhs, rhs);
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
AndOperation.prototype.init = function (lhs, rhs) {
|
|
1453
|
-
AndOperation.superclass.init.call(this, lhs, rhs);
|
|
1454
|
-
};
|
|
1455
|
-
|
|
1456
|
-
AndOperation.prototype.toString = function () {
|
|
1457
|
-
return "(" + this.lhs.toString() + " and " + this.rhs.toString() + ")";
|
|
1458
|
-
};
|
|
1459
|
-
|
|
1460
|
-
AndOperation.prototype.evaluate = function (c) {
|
|
1461
|
-
var b = this.lhs.evaluate(c).bool();
|
|
1462
|
-
if (!b.booleanValue()) {
|
|
1463
|
-
return b;
|
|
1464
|
-
}
|
|
1465
|
-
return this.rhs.evaluate(c).bool();
|
|
1466
|
-
};
|
|
1467
|
-
|
|
1468
|
-
// EqualsOperation ///////////////////////////////////////////////////////////
|
|
1469
|
-
|
|
1470
|
-
EqualsOperation.prototype = new BinaryOperation();
|
|
1471
|
-
EqualsOperation.prototype.constructor = EqualsOperation;
|
|
1472
|
-
EqualsOperation.superclass = BinaryOperation.prototype;
|
|
1473
|
-
|
|
1474
|
-
function EqualsOperation(lhs, rhs) {
|
|
1475
|
-
if (arguments.length > 0) {
|
|
1476
|
-
this.init(lhs, rhs);
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
EqualsOperation.prototype.init = function (lhs, rhs) {
|
|
1481
|
-
EqualsOperation.superclass.init.call(this, lhs, rhs);
|
|
1482
|
-
};
|
|
1483
|
-
|
|
1484
|
-
EqualsOperation.prototype.toString = function () {
|
|
1485
|
-
return "(" + this.lhs.toString() + " = " + this.rhs.toString() + ")";
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
EqualsOperation.prototype.evaluate = function (c) {
|
|
1489
|
-
return this.lhs.evaluate(c).equals(this.rhs.evaluate(c));
|
|
1490
|
-
};
|
|
1491
|
-
|
|
1492
|
-
// NotEqualOperation /////////////////////////////////////////////////////////
|
|
1493
|
-
|
|
1494
|
-
NotEqualOperation.prototype = new BinaryOperation();
|
|
1495
|
-
NotEqualOperation.prototype.constructor = NotEqualOperation;
|
|
1496
|
-
NotEqualOperation.superclass = BinaryOperation.prototype;
|
|
1497
|
-
|
|
1498
|
-
function NotEqualOperation(lhs, rhs) {
|
|
1499
|
-
if (arguments.length > 0) {
|
|
1500
|
-
this.init(lhs, rhs);
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
NotEqualOperation.prototype.init = function (lhs, rhs) {
|
|
1505
|
-
NotEqualOperation.superclass.init.call(this, lhs, rhs);
|
|
1506
|
-
};
|
|
1507
|
-
|
|
1508
|
-
NotEqualOperation.prototype.toString = function () {
|
|
1509
|
-
return "(" + this.lhs.toString() + " != " + this.rhs.toString() + ")";
|
|
1510
|
-
};
|
|
1511
|
-
|
|
1512
|
-
NotEqualOperation.prototype.evaluate = function (c) {
|
|
1513
|
-
return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c));
|
|
1514
|
-
};
|
|
1515
|
-
|
|
1516
|
-
// LessThanOperation /////////////////////////////////////////////////////////
|
|
1517
|
-
|
|
1518
|
-
LessThanOperation.prototype = new BinaryOperation();
|
|
1519
|
-
LessThanOperation.prototype.constructor = LessThanOperation;
|
|
1520
|
-
LessThanOperation.superclass = BinaryOperation.prototype;
|
|
1521
|
-
|
|
1522
|
-
function LessThanOperation(lhs, rhs) {
|
|
1523
|
-
if (arguments.length > 0) {
|
|
1524
|
-
this.init(lhs, rhs);
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
LessThanOperation.prototype.init = function (lhs, rhs) {
|
|
1529
|
-
LessThanOperation.superclass.init.call(this, lhs, rhs);
|
|
1530
|
-
};
|
|
1531
|
-
|
|
1532
|
-
LessThanOperation.prototype.evaluate = function (c) {
|
|
1533
|
-
return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c));
|
|
1534
|
-
};
|
|
1535
|
-
|
|
1536
|
-
LessThanOperation.prototype.toString = function () {
|
|
1537
|
-
return "(" + this.lhs.toString() + " < " + this.rhs.toString() + ")";
|
|
1538
|
-
};
|
|
1539
|
-
|
|
1540
|
-
// GreaterThanOperation //////////////////////////////////////////////////////
|
|
1541
|
-
|
|
1542
|
-
GreaterThanOperation.prototype = new BinaryOperation();
|
|
1543
|
-
GreaterThanOperation.prototype.constructor = GreaterThanOperation;
|
|
1544
|
-
GreaterThanOperation.superclass = BinaryOperation.prototype;
|
|
1545
|
-
|
|
1546
|
-
function GreaterThanOperation(lhs, rhs) {
|
|
1547
|
-
if (arguments.length > 0) {
|
|
1548
|
-
this.init(lhs, rhs);
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
GreaterThanOperation.prototype.init = function (lhs, rhs) {
|
|
1553
|
-
GreaterThanOperation.superclass.init.call(this, lhs, rhs);
|
|
1554
|
-
};
|
|
1555
|
-
|
|
1556
|
-
GreaterThanOperation.prototype.evaluate = function (c) {
|
|
1557
|
-
return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c));
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
|
-
GreaterThanOperation.prototype.toString = function () {
|
|
1561
|
-
return "(" + this.lhs.toString() + " > " + this.rhs.toString() + ")";
|
|
1562
|
-
};
|
|
1563
|
-
|
|
1564
|
-
// LessThanOrEqualOperation //////////////////////////////////////////////////
|
|
1565
|
-
|
|
1566
|
-
LessThanOrEqualOperation.prototype = new BinaryOperation();
|
|
1567
|
-
LessThanOrEqualOperation.prototype.constructor = LessThanOrEqualOperation;
|
|
1568
|
-
LessThanOrEqualOperation.superclass = BinaryOperation.prototype;
|
|
1569
|
-
|
|
1570
|
-
function LessThanOrEqualOperation(lhs, rhs) {
|
|
1571
|
-
if (arguments.length > 0) {
|
|
1572
|
-
this.init(lhs, rhs);
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
LessThanOrEqualOperation.prototype.init = function (lhs, rhs) {
|
|
1577
|
-
LessThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
LessThanOrEqualOperation.prototype.evaluate = function (c) {
|
|
1581
|
-
return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c));
|
|
1582
|
-
};
|
|
1583
|
-
|
|
1584
|
-
LessThanOrEqualOperation.prototype.toString = function () {
|
|
1585
|
-
return "(" + this.lhs.toString() + " <= " + this.rhs.toString() + ")";
|
|
1586
|
-
};
|
|
1587
|
-
|
|
1588
|
-
// GreaterThanOrEqualOperation ///////////////////////////////////////////////
|
|
1589
|
-
|
|
1590
|
-
GreaterThanOrEqualOperation.prototype = new BinaryOperation();
|
|
1591
|
-
GreaterThanOrEqualOperation.prototype.constructor = GreaterThanOrEqualOperation;
|
|
1592
|
-
GreaterThanOrEqualOperation.superclass = BinaryOperation.prototype;
|
|
1593
|
-
|
|
1594
|
-
function GreaterThanOrEqualOperation(lhs, rhs) {
|
|
1595
|
-
if (arguments.length > 0) {
|
|
1596
|
-
this.init(lhs, rhs);
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
GreaterThanOrEqualOperation.prototype.init = function (lhs, rhs) {
|
|
1601
|
-
GreaterThanOrEqualOperation.superclass.init.call(this, lhs, rhs);
|
|
1602
|
-
};
|
|
1603
|
-
|
|
1604
|
-
GreaterThanOrEqualOperation.prototype.evaluate = function (c) {
|
|
1605
|
-
return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c));
|
|
1606
|
-
};
|
|
1607
|
-
|
|
1608
|
-
GreaterThanOrEqualOperation.prototype.toString = function () {
|
|
1609
|
-
return "(" + this.lhs.toString() + " >= " + this.rhs.toString() + ")";
|
|
1610
|
-
};
|
|
1611
|
-
|
|
1612
|
-
// PlusOperation /////////////////////////////////////////////////////////////
|
|
1613
|
-
|
|
1614
|
-
PlusOperation.prototype = new BinaryOperation();
|
|
1615
|
-
PlusOperation.prototype.constructor = PlusOperation;
|
|
1616
|
-
PlusOperation.superclass = BinaryOperation.prototype;
|
|
1617
|
-
|
|
1618
|
-
function PlusOperation(lhs, rhs) {
|
|
1619
|
-
if (arguments.length > 0) {
|
|
1620
|
-
this.init(lhs, rhs);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
PlusOperation.prototype.init = function (lhs, rhs) {
|
|
1625
|
-
PlusOperation.superclass.init.call(this, lhs, rhs);
|
|
1626
|
-
};
|
|
1627
|
-
|
|
1628
|
-
PlusOperation.prototype.evaluate = function (c) {
|
|
1629
|
-
return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number());
|
|
1630
|
-
};
|
|
1631
|
-
|
|
1632
|
-
PlusOperation.prototype.toString = function () {
|
|
1633
|
-
return "(" + this.lhs.toString() + " + " + this.rhs.toString() + ")";
|
|
1634
|
-
};
|
|
1635
|
-
|
|
1636
|
-
// MinusOperation ////////////////////////////////////////////////////////////
|
|
1637
|
-
|
|
1638
|
-
MinusOperation.prototype = new BinaryOperation();
|
|
1639
|
-
MinusOperation.prototype.constructor = MinusOperation;
|
|
1640
|
-
MinusOperation.superclass = BinaryOperation.prototype;
|
|
1641
|
-
|
|
1642
|
-
function MinusOperation(lhs, rhs) {
|
|
1643
|
-
if (arguments.length > 0) {
|
|
1644
|
-
this.init(lhs, rhs);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
MinusOperation.prototype.init = function (lhs, rhs) {
|
|
1649
|
-
MinusOperation.superclass.init.call(this, lhs, rhs);
|
|
1650
|
-
};
|
|
1651
|
-
|
|
1652
|
-
MinusOperation.prototype.evaluate = function (c) {
|
|
1653
|
-
return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number());
|
|
1654
|
-
};
|
|
1655
|
-
|
|
1656
|
-
MinusOperation.prototype.toString = function () {
|
|
1657
|
-
return "(" + this.lhs.toString() + " - " + this.rhs.toString() + ")";
|
|
1658
|
-
};
|
|
1659
|
-
|
|
1660
|
-
// MultiplyOperation /////////////////////////////////////////////////////////
|
|
1661
|
-
|
|
1662
|
-
MultiplyOperation.prototype = new BinaryOperation();
|
|
1663
|
-
MultiplyOperation.prototype.constructor = MultiplyOperation;
|
|
1664
|
-
MultiplyOperation.superclass = BinaryOperation.prototype;
|
|
1665
|
-
|
|
1666
|
-
function MultiplyOperation(lhs, rhs) {
|
|
1667
|
-
if (arguments.length > 0) {
|
|
1668
|
-
this.init(lhs, rhs);
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
MultiplyOperation.prototype.init = function (lhs, rhs) {
|
|
1673
|
-
MultiplyOperation.superclass.init.call(this, lhs, rhs);
|
|
1674
|
-
};
|
|
1675
|
-
|
|
1676
|
-
MultiplyOperation.prototype.evaluate = function (c) {
|
|
1677
|
-
return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number());
|
|
1678
|
-
};
|
|
1679
|
-
|
|
1680
|
-
MultiplyOperation.prototype.toString = function () {
|
|
1681
|
-
return "(" + this.lhs.toString() + " * " + this.rhs.toString() + ")";
|
|
1682
|
-
};
|
|
1683
|
-
|
|
1684
|
-
// DivOperation //////////////////////////////////////////////////////////////
|
|
1685
|
-
|
|
1686
|
-
DivOperation.prototype = new BinaryOperation();
|
|
1687
|
-
DivOperation.prototype.constructor = DivOperation;
|
|
1688
|
-
DivOperation.superclass = BinaryOperation.prototype;
|
|
1689
|
-
|
|
1690
|
-
function DivOperation(lhs, rhs) {
|
|
1691
|
-
if (arguments.length > 0) {
|
|
1692
|
-
this.init(lhs, rhs);
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
DivOperation.prototype.init = function (lhs, rhs) {
|
|
1697
|
-
DivOperation.superclass.init.call(this, lhs, rhs);
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
|
-
DivOperation.prototype.evaluate = function (c) {
|
|
1701
|
-
return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number());
|
|
1702
|
-
};
|
|
1703
|
-
|
|
1704
|
-
DivOperation.prototype.toString = function () {
|
|
1705
|
-
return "(" + this.lhs.toString() + " div " + this.rhs.toString() + ")";
|
|
1706
|
-
};
|
|
1707
|
-
|
|
1708
|
-
// ModOperation //////////////////////////////////////////////////////////////
|
|
1709
|
-
|
|
1710
|
-
ModOperation.prototype = new BinaryOperation();
|
|
1711
|
-
ModOperation.prototype.constructor = ModOperation;
|
|
1712
|
-
ModOperation.superclass = BinaryOperation.prototype;
|
|
1713
|
-
|
|
1714
|
-
function ModOperation(lhs, rhs) {
|
|
1715
|
-
if (arguments.length > 0) {
|
|
1716
|
-
this.init(lhs, rhs);
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
ModOperation.prototype.init = function (lhs, rhs) {
|
|
1721
|
-
ModOperation.superclass.init.call(this, lhs, rhs);
|
|
1722
|
-
};
|
|
1723
|
-
|
|
1724
|
-
ModOperation.prototype.evaluate = function (c) {
|
|
1725
|
-
return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number());
|
|
1726
|
-
};
|
|
1727
|
-
|
|
1728
|
-
ModOperation.prototype.toString = function () {
|
|
1729
|
-
return "(" + this.lhs.toString() + " mod " + this.rhs.toString() + ")";
|
|
1730
|
-
};
|
|
1731
|
-
|
|
1732
|
-
// BarOperation //////////////////////////////////////////////////////////////
|
|
1733
|
-
|
|
1734
|
-
BarOperation.prototype = new BinaryOperation();
|
|
1735
|
-
BarOperation.prototype.constructor = BarOperation;
|
|
1736
|
-
BarOperation.superclass = BinaryOperation.prototype;
|
|
1737
|
-
|
|
1738
|
-
function BarOperation(lhs, rhs) {
|
|
1739
|
-
if (arguments.length > 0) {
|
|
1740
|
-
this.init(lhs, rhs);
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
BarOperation.prototype.init = function (lhs, rhs) {
|
|
1745
|
-
BarOperation.superclass.init.call(this, lhs, rhs);
|
|
1746
|
-
};
|
|
1747
|
-
|
|
1748
|
-
BarOperation.prototype.evaluate = function (c) {
|
|
1749
|
-
return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset());
|
|
1750
|
-
};
|
|
1751
|
-
|
|
1752
|
-
BarOperation.prototype.toString = function () {
|
|
1753
|
-
return map(toString, [this.lhs, this.rhs]).join(' | ');
|
|
1754
|
-
};
|
|
1755
|
-
|
|
1756
|
-
// PathExpr //////////////////////////////////////////////////////////////////
|
|
1757
|
-
|
|
1758
|
-
PathExpr.prototype = new Expression();
|
|
1759
|
-
PathExpr.prototype.constructor = PathExpr;
|
|
1760
|
-
PathExpr.superclass = Expression.prototype;
|
|
1761
|
-
|
|
1762
|
-
function PathExpr(filter, filterPreds, locpath) {
|
|
1763
|
-
if (arguments.length > 0) {
|
|
1764
|
-
this.init(filter, filterPreds, locpath);
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
PathExpr.prototype.init = function (filter, filterPreds, locpath) {
|
|
1769
|
-
PathExpr.superclass.init.call(this);
|
|
1770
|
-
this.filter = filter;
|
|
1771
|
-
this.filterPredicates = filterPreds;
|
|
1772
|
-
this.locationPath = locpath;
|
|
1773
|
-
};
|
|
1774
|
-
|
|
1775
|
-
/**
|
|
1776
|
-
* Returns the topmost node of the tree containing node
|
|
1777
|
-
*/
|
|
1778
|
-
function findRoot(node) {
|
|
1779
|
-
while (node && node.parentNode) {
|
|
1780
|
-
node = node.parentNode;
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
return node;
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
PathExpr.applyPredicates = function (predicates, c, nodes) {
|
|
1787
|
-
if (predicates.length === 0) {
|
|
1788
|
-
return nodes;
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
var ctx = c.extend({});
|
|
1792
|
-
|
|
1793
|
-
return reduce(
|
|
1794
|
-
function (inNodes, pred) {
|
|
1795
|
-
ctx.contextSize = inNodes.length;
|
|
1796
|
-
|
|
1797
|
-
return filter(
|
|
1798
|
-
function (node, i) {
|
|
1799
|
-
ctx.contextNode = node;
|
|
1800
|
-
ctx.contextPosition = i + 1;
|
|
1801
|
-
|
|
1802
|
-
return PathExpr.predicateMatches(pred, ctx);
|
|
1803
|
-
},
|
|
1804
|
-
inNodes
|
|
1805
|
-
);
|
|
1806
|
-
},
|
|
1807
|
-
nodes,
|
|
1808
|
-
predicates
|
|
1809
|
-
);
|
|
1810
|
-
};
|
|
1811
|
-
|
|
1812
|
-
PathExpr.getRoot = function (xpc, nodes) {
|
|
1813
|
-
var firstNode = nodes[0];
|
|
1814
|
-
|
|
1815
|
-
if (firstNode.nodeType === NodeTypes.DOCUMENT_NODE) {
|
|
1816
|
-
return firstNode;
|
|
1817
|
-
}
|
|
1818
|
-
|
|
1819
|
-
if (xpc.virtualRoot) {
|
|
1820
|
-
return xpc.virtualRoot;
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
var ownerDoc = firstNode.ownerDocument;
|
|
1824
|
-
|
|
1825
|
-
if (ownerDoc) {
|
|
1826
|
-
return ownerDoc;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
// IE 5.5 doesn't have ownerDocument?
|
|
1830
|
-
var n = firstNode;
|
|
1831
|
-
while (n.parentNode != null) {
|
|
1832
|
-
n = n.parentNode;
|
|
1833
|
-
}
|
|
1834
|
-
return n;
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
PathExpr.applyStep = function (step, xpc, node) {
|
|
1838
|
-
var self = this;
|
|
1839
|
-
var newNodes = [];
|
|
1840
|
-
xpc.contextNode = node;
|
|
1841
|
-
|
|
1842
|
-
switch (step.axis) {
|
|
1843
|
-
case Step.ANCESTOR:
|
|
1844
|
-
// look at all the ancestor nodes
|
|
1845
|
-
if (xpc.contextNode === xpc.virtualRoot) {
|
|
1846
|
-
break;
|
|
1847
|
-
}
|
|
1848
|
-
var m;
|
|
1849
|
-
if (xpc.contextNode.nodeType == NodeTypes.ATTRIBUTE_NODE) {
|
|
1850
|
-
m = PathExpr.getOwnerElement(xpc.contextNode);
|
|
1851
|
-
} else {
|
|
1852
|
-
m = xpc.contextNode.parentNode;
|
|
1853
|
-
}
|
|
1854
|
-
while (m != null) {
|
|
1855
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
1856
|
-
newNodes.push(m);
|
|
1857
|
-
}
|
|
1858
|
-
if (m === xpc.virtualRoot) {
|
|
1859
|
-
break;
|
|
1860
|
-
}
|
|
1861
|
-
m = m.parentNode;
|
|
1862
|
-
}
|
|
1863
|
-
break;
|
|
1864
|
-
|
|
1865
|
-
case Step.ANCESTORORSELF:
|
|
1866
|
-
// look at all the ancestor nodes and the current node
|
|
1867
|
-
for (var m = xpc.contextNode; m != null; m = m.nodeType == NodeTypes.ATTRIBUTE_NODE ? PathExpr.getOwnerElement(m) : m.parentNode) {
|
|
1868
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
1869
|
-
newNodes.push(m);
|
|
1870
|
-
}
|
|
1871
|
-
if (m === xpc.virtualRoot) {
|
|
1872
|
-
break;
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
break;
|
|
1876
|
-
|
|
1877
|
-
case Step.ATTRIBUTE:
|
|
1878
|
-
// look at the attributes
|
|
1879
|
-
var nnm = xpc.contextNode.attributes;
|
|
1880
|
-
if (nnm != null) {
|
|
1881
|
-
for (var k = 0; k < nnm.length; k++) {
|
|
1882
|
-
var m = nnm.item(k);
|
|
1883
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
1884
|
-
newNodes.push(m);
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
break;
|
|
1889
|
-
|
|
1890
|
-
case Step.CHILD:
|
|
1891
|
-
// look at all child elements
|
|
1892
|
-
for (var m = xpc.contextNode.firstChild; m != null; m = m.nextSibling) {
|
|
1893
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
1894
|
-
newNodes.push(m);
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
break;
|
|
1898
|
-
|
|
1899
|
-
case Step.DESCENDANT:
|
|
1900
|
-
// look at all descendant nodes
|
|
1901
|
-
var st = [xpc.contextNode.firstChild];
|
|
1902
|
-
while (st.length > 0) {
|
|
1903
|
-
for (var m = st.pop(); m != null;) {
|
|
1904
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
1905
|
-
newNodes.push(m);
|
|
1906
|
-
}
|
|
1907
|
-
if (m.firstChild != null) {
|
|
1908
|
-
st.push(m.nextSibling);
|
|
1909
|
-
m = m.firstChild;
|
|
1910
|
-
} else {
|
|
1911
|
-
m = m.nextSibling;
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
break;
|
|
1916
|
-
|
|
1917
|
-
case Step.DESCENDANTORSELF:
|
|
1918
|
-
// look at self
|
|
1919
|
-
if (step.nodeTest.matches(xpc.contextNode, xpc)) {
|
|
1920
|
-
newNodes.push(xpc.contextNode);
|
|
1921
|
-
}
|
|
1922
|
-
// look at all descendant nodes
|
|
1923
|
-
var st = [xpc.contextNode.firstChild];
|
|
1924
|
-
while (st.length > 0) {
|
|
1925
|
-
for (var m = st.pop(); m != null;) {
|
|
1926
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
1927
|
-
newNodes.push(m);
|
|
1928
|
-
}
|
|
1929
|
-
if (m.firstChild != null) {
|
|
1930
|
-
st.push(m.nextSibling);
|
|
1931
|
-
m = m.firstChild;
|
|
1932
|
-
} else {
|
|
1933
|
-
m = m.nextSibling;
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
break;
|
|
1938
|
-
|
|
1939
|
-
case Step.FOLLOWING:
|
|
1940
|
-
if (xpc.contextNode === xpc.virtualRoot) {
|
|
1941
|
-
break;
|
|
1942
|
-
}
|
|
1943
|
-
var st = [];
|
|
1944
|
-
if (xpc.contextNode.firstChild != null) {
|
|
1945
|
-
st.unshift(xpc.contextNode.firstChild);
|
|
1946
|
-
} else {
|
|
1947
|
-
st.unshift(xpc.contextNode.nextSibling);
|
|
1948
|
-
}
|
|
1949
|
-
for (var m = xpc.contextNode.parentNode; m != null && m.nodeType != NodeTypes.DOCUMENT_NODE && m !== xpc.virtualRoot; m = m.parentNode) {
|
|
1950
|
-
st.unshift(m.nextSibling);
|
|
1951
|
-
}
|
|
1952
|
-
do {
|
|
1953
|
-
for (var m = st.pop(); m != null;) {
|
|
1954
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
1955
|
-
newNodes.push(m);
|
|
1956
|
-
}
|
|
1957
|
-
if (m.firstChild != null) {
|
|
1958
|
-
st.push(m.nextSibling);
|
|
1959
|
-
m = m.firstChild;
|
|
1960
|
-
} else {
|
|
1961
|
-
m = m.nextSibling;
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
} while (st.length > 0);
|
|
1965
|
-
break;
|
|
1966
|
-
|
|
1967
|
-
case Step.FOLLOWINGSIBLING:
|
|
1968
|
-
if (xpc.contextNode === xpc.virtualRoot) {
|
|
1969
|
-
break;
|
|
1970
|
-
}
|
|
1971
|
-
for (var m = xpc.contextNode.nextSibling; m != null; m = m.nextSibling) {
|
|
1972
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
1973
|
-
newNodes.push(m);
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
break;
|
|
1977
|
-
|
|
1978
|
-
case Step.NAMESPACE:
|
|
1979
|
-
var n = {};
|
|
1980
|
-
if (xpc.contextNode.nodeType == NodeTypes.ELEMENT_NODE) {
|
|
1981
|
-
n["xml"] = XPath.XML_NAMESPACE_URI;
|
|
1982
|
-
n["xmlns"] = XPath.XMLNS_NAMESPACE_URI;
|
|
1983
|
-
for (var m = xpc.contextNode; m != null && m.nodeType == NodeTypes.ELEMENT_NODE; m = m.parentNode) {
|
|
1984
|
-
for (var k = 0; k < m.attributes.length; k++) {
|
|
1985
|
-
var attr = m.attributes.item(k);
|
|
1986
|
-
var nm = String(attr.name);
|
|
1987
|
-
if (nm == "xmlns") {
|
|
1988
|
-
if (n[""] == undefined) {
|
|
1989
|
-
n[""] = attr.value;
|
|
1990
|
-
}
|
|
1991
|
-
} else if (nm.length > 6 && nm.substring(0, 6) == "xmlns:") {
|
|
1992
|
-
var pre = nm.substring(6, nm.length);
|
|
1993
|
-
if (n[pre] == undefined) {
|
|
1994
|
-
n[pre] = attr.value;
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
|
-
for (var pre in n) {
|
|
2000
|
-
var nsn = new XPathNamespace(pre, n[pre], xpc.contextNode);
|
|
2001
|
-
if (step.nodeTest.matches(nsn, xpc)) {
|
|
2002
|
-
newNodes.push(nsn);
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
break;
|
|
2007
|
-
|
|
2008
|
-
case Step.PARENT:
|
|
2009
|
-
m = null;
|
|
2010
|
-
if (xpc.contextNode !== xpc.virtualRoot) {
|
|
2011
|
-
if (xpc.contextNode.nodeType == NodeTypes.ATTRIBUTE_NODE) {
|
|
2012
|
-
m = PathExpr.getOwnerElement(xpc.contextNode);
|
|
2013
|
-
} else {
|
|
2014
|
-
m = xpc.contextNode.parentNode;
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
if (m != null && step.nodeTest.matches(m, xpc)) {
|
|
2018
|
-
newNodes.push(m);
|
|
2019
|
-
}
|
|
2020
|
-
break;
|
|
2021
|
-
|
|
2022
|
-
case Step.PRECEDING:
|
|
2023
|
-
var st;
|
|
2024
|
-
if (xpc.virtualRoot != null) {
|
|
2025
|
-
st = [xpc.virtualRoot];
|
|
2026
|
-
} else {
|
|
2027
|
-
// cannot rely on .ownerDocument because the node may be in a document fragment
|
|
2028
|
-
st = [findRoot(xpc.contextNode)];
|
|
2029
|
-
}
|
|
2030
|
-
outer: while (st.length > 0) {
|
|
2031
|
-
for (var m = st.pop(); m != null;) {
|
|
2032
|
-
if (m == xpc.contextNode) {
|
|
2033
|
-
break outer;
|
|
2034
|
-
}
|
|
2035
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
2036
|
-
newNodes.unshift(m);
|
|
2037
|
-
}
|
|
2038
|
-
if (m.firstChild != null) {
|
|
2039
|
-
st.push(m.nextSibling);
|
|
2040
|
-
m = m.firstChild;
|
|
2041
|
-
} else {
|
|
2042
|
-
m = m.nextSibling;
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
break;
|
|
2047
|
-
|
|
2048
|
-
case Step.PRECEDINGSIBLING:
|
|
2049
|
-
if (xpc.contextNode === xpc.virtualRoot) {
|
|
2050
|
-
break;
|
|
2051
|
-
}
|
|
2052
|
-
for (var m = xpc.contextNode.previousSibling; m != null; m = m.previousSibling) {
|
|
2053
|
-
if (step.nodeTest.matches(m, xpc)) {
|
|
2054
|
-
newNodes.push(m);
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
break;
|
|
2058
|
-
|
|
2059
|
-
case Step.SELF:
|
|
2060
|
-
if (step.nodeTest.matches(xpc.contextNode, xpc)) {
|
|
2061
|
-
newNodes.push(xpc.contextNode);
|
|
2062
|
-
}
|
|
2063
|
-
break;
|
|
2064
|
-
|
|
2065
|
-
default:
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
return newNodes;
|
|
2069
|
-
};
|
|
2070
|
-
|
|
2071
|
-
function applyStepWithPredicates(step, xpc, node) {
|
|
2072
|
-
return PathExpr.applyPredicates(
|
|
2073
|
-
step.predicates,
|
|
2074
|
-
xpc,
|
|
2075
|
-
PathExpr.applyStep(step, xpc, node)
|
|
2076
|
-
);
|
|
2077
|
-
}
|
|
2078
|
-
|
|
2079
|
-
function applyStepToNodes(context, nodes, step) {
|
|
2080
|
-
return flatten(
|
|
2081
|
-
map(
|
|
2082
|
-
applyStepWithPredicates.bind(null, step, context),
|
|
2083
|
-
nodes
|
|
2084
|
-
)
|
|
2085
|
-
);
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
|
-
PathExpr.applySteps = function (steps, xpc, nodes) {
|
|
2089
|
-
return reduce(
|
|
2090
|
-
applyStepToNodes.bind(null, xpc),
|
|
2091
|
-
nodes,
|
|
2092
|
-
steps
|
|
2093
|
-
);
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
PathExpr.prototype.applyFilter = function (c, xpc) {
|
|
2097
|
-
if (!this.filter) {
|
|
2098
|
-
return { nodes: [c.contextNode] };
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
var ns = this.filter.evaluate(c);
|
|
2102
|
-
|
|
2103
|
-
if (!Utilities.instance_of(ns, XNodeSet)) {
|
|
2104
|
-
if (this.filterPredicates != null && this.filterPredicates.length > 0 || this.locationPath != null) {
|
|
2105
|
-
throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
return { nonNodes: ns };
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
return {
|
|
2112
|
-
nodes: PathExpr.applyPredicates(this.filterPredicates || [], xpc, ns.toUnsortedArray())
|
|
2113
|
-
};
|
|
2114
|
-
};
|
|
2115
|
-
|
|
2116
|
-
PathExpr.applyLocationPath = function (locationPath, xpc, nodes) {
|
|
2117
|
-
if (!locationPath) {
|
|
2118
|
-
return nodes;
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
var startNodes = locationPath.absolute ? [PathExpr.getRoot(xpc, nodes)] : nodes;
|
|
2122
|
-
|
|
2123
|
-
return PathExpr.applySteps(locationPath.steps, xpc, startNodes);
|
|
2124
|
-
};
|
|
2125
|
-
|
|
2126
|
-
PathExpr.prototype.evaluate = function (c) {
|
|
2127
|
-
var xpc = assign(new XPathContext(), c);
|
|
2128
|
-
|
|
2129
|
-
var filterResult = this.applyFilter(c, xpc);
|
|
2130
|
-
|
|
2131
|
-
if ('nonNodes' in filterResult) {
|
|
2132
|
-
return filterResult.nonNodes;
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
|
-
var ns = new XNodeSet();
|
|
2136
|
-
ns.addArray(PathExpr.applyLocationPath(this.locationPath, xpc, filterResult.nodes));
|
|
2137
|
-
return ns;
|
|
2138
|
-
};
|
|
2139
|
-
|
|
2140
|
-
PathExpr.predicateMatches = function (pred, c) {
|
|
2141
|
-
var res = pred.evaluate(c);
|
|
2142
|
-
|
|
2143
|
-
return Utilities.instance_of(res, XNumber)
|
|
2144
|
-
? c.contextPosition === res.numberValue()
|
|
2145
|
-
: res.booleanValue();
|
|
2146
|
-
};
|
|
2147
|
-
|
|
2148
|
-
PathExpr.predicateString = function (predicate) {
|
|
2149
|
-
return wrap('[', ']', predicate.toString());
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
PathExpr.predicatesString = function (predicates) {
|
|
2153
|
-
return join(
|
|
2154
|
-
'',
|
|
2155
|
-
map(PathExpr.predicateString, predicates)
|
|
2156
|
-
);
|
|
2157
|
-
}
|
|
2158
|
-
|
|
2159
|
-
PathExpr.prototype.toString = function () {
|
|
2160
|
-
if (this.filter != undefined) {
|
|
2161
|
-
var filterStr = toString(this.filter);
|
|
2162
|
-
|
|
2163
|
-
if (Utilities.instance_of(this.filter, XString)) {
|
|
2164
|
-
return wrap("'", "'", filterStr);
|
|
2165
|
-
}
|
|
2166
|
-
if (this.filterPredicates != undefined && this.filterPredicates.length) {
|
|
2167
|
-
return wrap('(', ')', filterStr) +
|
|
2168
|
-
PathExpr.predicatesString(this.filterPredicates);
|
|
2169
|
-
}
|
|
2170
|
-
if (this.locationPath != undefined) {
|
|
2171
|
-
return filterStr +
|
|
2172
|
-
(this.locationPath.absolute ? '' : '/') +
|
|
2173
|
-
toString(this.locationPath);
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
return filterStr;
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
return toString(this.locationPath);
|
|
2180
|
-
};
|
|
2181
|
-
|
|
2182
|
-
PathExpr.getOwnerElement = function (n) {
|
|
2183
|
-
// DOM 2 has ownerElement
|
|
2184
|
-
if (n.ownerElement) {
|
|
2185
|
-
return n.ownerElement;
|
|
2186
|
-
}
|
|
2187
|
-
// DOM 1 Internet Explorer can use selectSingleNode (ironically)
|
|
2188
|
-
try {
|
|
2189
|
-
if (n.selectSingleNode) {
|
|
2190
|
-
return n.selectSingleNode("..");
|
|
2191
|
-
}
|
|
2192
|
-
} catch (e) {
|
|
2193
|
-
}
|
|
2194
|
-
// Other DOM 1 implementations must use this egregious search
|
|
2195
|
-
var doc = n.nodeType == NodeTypes.DOCUMENT_NODE
|
|
2196
|
-
? n
|
|
2197
|
-
: n.ownerDocument;
|
|
2198
|
-
var elts = doc.getElementsByTagName("*");
|
|
2199
|
-
for (var i = 0; i < elts.length; i++) {
|
|
2200
|
-
var elt = elts.item(i);
|
|
2201
|
-
var nnm = elt.attributes;
|
|
2202
|
-
for (var j = 0; j < nnm.length; j++) {
|
|
2203
|
-
var an = nnm.item(j);
|
|
2204
|
-
if (an === n) {
|
|
2205
|
-
return elt;
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
return null;
|
|
2210
|
-
};
|
|
2211
|
-
|
|
2212
|
-
// LocationPath //////////////////////////////////////////////////////////////
|
|
2213
|
-
|
|
2214
|
-
LocationPath.prototype = new Object();
|
|
2215
|
-
LocationPath.prototype.constructor = LocationPath;
|
|
2216
|
-
LocationPath.superclass = Object.prototype;
|
|
2217
|
-
|
|
2218
|
-
function LocationPath(abs, steps) {
|
|
2219
|
-
if (arguments.length > 0) {
|
|
2220
|
-
this.init(abs, steps);
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
LocationPath.prototype.init = function (abs, steps) {
|
|
2225
|
-
this.absolute = abs;
|
|
2226
|
-
this.steps = steps;
|
|
2227
|
-
};
|
|
2228
|
-
|
|
2229
|
-
LocationPath.prototype.toString = function () {
|
|
2230
|
-
return (
|
|
2231
|
-
(this.absolute ? '/' : '') +
|
|
2232
|
-
map(toString, this.steps).join('/')
|
|
2233
|
-
);
|
|
2234
|
-
};
|
|
2235
|
-
|
|
2236
|
-
// Step //////////////////////////////////////////////////////////////////////
|
|
2237
|
-
|
|
2238
|
-
Step.prototype = new Object();
|
|
2239
|
-
Step.prototype.constructor = Step;
|
|
2240
|
-
Step.superclass = Object.prototype;
|
|
2241
|
-
|
|
2242
|
-
function Step(axis, nodetest, preds) {
|
|
2243
|
-
if (arguments.length > 0) {
|
|
2244
|
-
this.init(axis, nodetest, preds);
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
|
|
2248
|
-
Step.prototype.init = function (axis, nodetest, preds) {
|
|
2249
|
-
this.axis = axis;
|
|
2250
|
-
this.nodeTest = nodetest;
|
|
2251
|
-
this.predicates = preds;
|
|
2252
|
-
};
|
|
2253
|
-
|
|
2254
|
-
Step.prototype.toString = function () {
|
|
2255
|
-
return Step.STEPNAMES[this.axis] +
|
|
2256
|
-
"::" +
|
|
2257
|
-
this.nodeTest.toString() +
|
|
2258
|
-
PathExpr.predicatesString(this.predicates);
|
|
2259
|
-
};
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
Step.ANCESTOR = 0;
|
|
2263
|
-
Step.ANCESTORORSELF = 1;
|
|
2264
|
-
Step.ATTRIBUTE = 2;
|
|
2265
|
-
Step.CHILD = 3;
|
|
2266
|
-
Step.DESCENDANT = 4;
|
|
2267
|
-
Step.DESCENDANTORSELF = 5;
|
|
2268
|
-
Step.FOLLOWING = 6;
|
|
2269
|
-
Step.FOLLOWINGSIBLING = 7;
|
|
2270
|
-
Step.NAMESPACE = 8;
|
|
2271
|
-
Step.PARENT = 9;
|
|
2272
|
-
Step.PRECEDING = 10;
|
|
2273
|
-
Step.PRECEDINGSIBLING = 11;
|
|
2274
|
-
Step.SELF = 12;
|
|
2275
|
-
|
|
2276
|
-
Step.STEPNAMES = reduce(function (acc, x) { return acc[x[0]] = x[1], acc; }, {}, [
|
|
2277
|
-
[Step.ANCESTOR, 'ancestor'],
|
|
2278
|
-
[Step.ANCESTORORSELF, 'ancestor-or-self'],
|
|
2279
|
-
[Step.ATTRIBUTE, 'attribute'],
|
|
2280
|
-
[Step.CHILD, 'child'],
|
|
2281
|
-
[Step.DESCENDANT, 'descendant'],
|
|
2282
|
-
[Step.DESCENDANTORSELF, 'descendant-or-self'],
|
|
2283
|
-
[Step.FOLLOWING, 'following'],
|
|
2284
|
-
[Step.FOLLOWINGSIBLING, 'following-sibling'],
|
|
2285
|
-
[Step.NAMESPACE, 'namespace'],
|
|
2286
|
-
[Step.PARENT, 'parent'],
|
|
2287
|
-
[Step.PRECEDING, 'preceding'],
|
|
2288
|
-
[Step.PRECEDINGSIBLING, 'preceding-sibling'],
|
|
2289
|
-
[Step.SELF, 'self']
|
|
2290
|
-
]);
|
|
2291
|
-
|
|
2292
|
-
// NodeTest //////////////////////////////////////////////////////////////////
|
|
2293
|
-
|
|
2294
|
-
NodeTest.prototype = new Object();
|
|
2295
|
-
NodeTest.prototype.constructor = NodeTest;
|
|
2296
|
-
NodeTest.superclass = Object.prototype;
|
|
2297
|
-
|
|
2298
|
-
function NodeTest(type, value) {
|
|
2299
|
-
if (arguments.length > 0) {
|
|
2300
|
-
this.init(type, value);
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
NodeTest.prototype.init = function (type, value) {
|
|
2305
|
-
this.type = type;
|
|
2306
|
-
this.value = value;
|
|
2307
|
-
};
|
|
2308
|
-
|
|
2309
|
-
NodeTest.prototype.toString = function () {
|
|
2310
|
-
return "<unknown nodetest type>";
|
|
2311
|
-
};
|
|
2312
|
-
|
|
2313
|
-
NodeTest.prototype.matches = function (n, xpc) {
|
|
2314
|
-
console.warn('unknown node test type');
|
|
2315
|
-
};
|
|
2316
|
-
|
|
2317
|
-
NodeTest.NAMETESTANY = 0;
|
|
2318
|
-
NodeTest.NAMETESTPREFIXANY = 1;
|
|
2319
|
-
NodeTest.NAMETESTQNAME = 2;
|
|
2320
|
-
NodeTest.COMMENT = 3;
|
|
2321
|
-
NodeTest.TEXT = 4;
|
|
2322
|
-
NodeTest.PI = 5;
|
|
2323
|
-
NodeTest.NODE = 6;
|
|
2324
|
-
|
|
2325
|
-
NodeTest.isNodeType = function (types) {
|
|
2326
|
-
return function (node) {
|
|
2327
|
-
return includes(types, node.nodeType);
|
|
2328
|
-
};
|
|
2329
|
-
};
|
|
2330
|
-
|
|
2331
|
-
NodeTest.makeNodeTestType = function (type, members, ctor) {
|
|
2332
|
-
var newType = ctor || function () { };
|
|
2333
|
-
|
|
2334
|
-
newType.prototype = new NodeTest(type);
|
|
2335
|
-
newType.prototype.constructor = newType;
|
|
2336
|
-
|
|
2337
|
-
assign(newType.prototype, members);
|
|
2338
|
-
|
|
2339
|
-
return newType;
|
|
2340
|
-
};
|
|
2341
|
-
// create invariant node test for certain node types
|
|
2342
|
-
NodeTest.makeNodeTypeTest = function (type, nodeTypes, stringVal) {
|
|
2343
|
-
return new (NodeTest.makeNodeTestType(type, {
|
|
2344
|
-
matches: NodeTest.isNodeType(nodeTypes),
|
|
2345
|
-
toString: always(stringVal)
|
|
2346
|
-
}))();
|
|
2347
|
-
};
|
|
2348
|
-
|
|
2349
|
-
NodeTest.hasPrefix = function (node) {
|
|
2350
|
-
return node.prefix || (node.nodeName || node.tagName).indexOf(':') !== -1;
|
|
2351
|
-
};
|
|
2352
|
-
|
|
2353
|
-
NodeTest.isElementOrAttribute = NodeTest.isNodeType([1, 2]);
|
|
2354
|
-
NodeTest.nameSpaceMatches = function (prefix, xpc, n) {
|
|
2355
|
-
var nNamespace = (n.namespaceURI || '');
|
|
2356
|
-
|
|
2357
|
-
if (!prefix) {
|
|
2358
|
-
return !nNamespace || (xpc.allowAnyNamespaceForNoPrefix && !NodeTest.hasPrefix(n));
|
|
2359
|
-
}
|
|
2360
|
-
|
|
2361
|
-
var ns = xpc.namespaceResolver.getNamespace(prefix, xpc.expressionContextNode);
|
|
2362
|
-
|
|
2363
|
-
if (ns == null) {
|
|
2364
|
-
throw new Error("Cannot resolve QName " + prefix);
|
|
2365
|
-
}
|
|
2366
|
-
|
|
2367
|
-
return ns === nNamespace;
|
|
2368
|
-
};
|
|
2369
|
-
NodeTest.localNameMatches = function (localName, xpc, n) {
|
|
2370
|
-
var nLocalName = (n.localName || n.nodeName);
|
|
2371
|
-
|
|
2372
|
-
return xpc.caseInsensitive
|
|
2373
|
-
? localName.toLowerCase() === nLocalName.toLowerCase()
|
|
2374
|
-
: localName === nLocalName;
|
|
2375
|
-
};
|
|
2376
|
-
|
|
2377
|
-
NodeTest.NameTestPrefixAny = NodeTest.makeNodeTestType(
|
|
2378
|
-
NodeTest.NAMETESTPREFIXANY,
|
|
2379
|
-
{
|
|
2380
|
-
matches: function (n, xpc) {
|
|
2381
|
-
return NodeTest.isElementOrAttribute(n) &&
|
|
2382
|
-
NodeTest.nameSpaceMatches(this.prefix, xpc, n);
|
|
2383
|
-
},
|
|
2384
|
-
toString: function () {
|
|
2385
|
-
return this.prefix + ":*";
|
|
2386
|
-
}
|
|
2387
|
-
},
|
|
2388
|
-
function NameTestPrefixAny(prefix) { this.prefix = prefix; }
|
|
2389
|
-
);
|
|
2390
|
-
|
|
2391
|
-
NodeTest.NameTestQName = NodeTest.makeNodeTestType(
|
|
2392
|
-
NodeTest.NAMETESTQNAME,
|
|
2393
|
-
{
|
|
2394
|
-
matches: function (n, xpc) {
|
|
2395
|
-
return NodeTest.isNodeType(
|
|
2396
|
-
[
|
|
2397
|
-
NodeTypes.ELEMENT_NODE,
|
|
2398
|
-
NodeTypes.ATTRIBUTE_NODE,
|
|
2399
|
-
XPathNamespace.XPATH_NAMESPACE_NODE,
|
|
2400
|
-
]
|
|
2401
|
-
)(n) &&
|
|
2402
|
-
NodeTest.nameSpaceMatches(this.prefix, xpc, n) &&
|
|
2403
|
-
NodeTest.localNameMatches(this.localName, xpc, n);
|
|
2404
|
-
},
|
|
2405
|
-
toString: function () {
|
|
2406
|
-
return this.name;
|
|
2407
|
-
}
|
|
2408
|
-
},
|
|
2409
|
-
function NameTestQName(name) {
|
|
2410
|
-
var nameParts = name.split(':');
|
|
2411
|
-
|
|
2412
|
-
this.name = name;
|
|
2413
|
-
this.prefix = nameParts.length > 1 ? nameParts[0] : null;
|
|
2414
|
-
this.localName = nameParts[nameParts.length > 1 ? 1 : 0];
|
|
2415
|
-
}
|
|
2416
|
-
);
|
|
2417
|
-
|
|
2418
|
-
NodeTest.PITest = NodeTest.makeNodeTestType(NodeTest.PI, {
|
|
2419
|
-
matches: function (n, xpc) {
|
|
2420
|
-
return NodeTest.isNodeType(
|
|
2421
|
-
[NodeTypes.PROCESSING_INSTRUCTION_NODE]
|
|
2422
|
-
)(n) &&
|
|
2423
|
-
(n.target || n.nodeName) === this.name;
|
|
2424
|
-
},
|
|
2425
|
-
toString: function () {
|
|
2426
|
-
return wrap('processing-instruction("', '")', this.name);
|
|
2427
|
-
}
|
|
2428
|
-
}, function (name) { this.name = name; })
|
|
2429
|
-
|
|
2430
|
-
// singletons
|
|
2431
|
-
|
|
2432
|
-
// elements, attributes, namespaces
|
|
2433
|
-
NodeTest.nameTestAny = NodeTest.makeNodeTypeTest(
|
|
2434
|
-
NodeTest.NAMETESTANY,
|
|
2435
|
-
[
|
|
2436
|
-
NodeTypes.ELEMENT_NODE,
|
|
2437
|
-
NodeTypes.ATTRIBUTE_NODE,
|
|
2438
|
-
XPathNamespace.XPATH_NAMESPACE_NODE,
|
|
2439
|
-
],
|
|
2440
|
-
'*'
|
|
2441
|
-
);
|
|
2442
|
-
// text, cdata
|
|
2443
|
-
NodeTest.textTest = NodeTest.makeNodeTypeTest(
|
|
2444
|
-
NodeTest.TEXT,
|
|
2445
|
-
[
|
|
2446
|
-
NodeTypes.TEXT_NODE,
|
|
2447
|
-
NodeTypes.CDATA_SECTION_NODE,
|
|
2448
|
-
],
|
|
2449
|
-
'text()'
|
|
2450
|
-
);
|
|
2451
|
-
NodeTest.commentTest = NodeTest.makeNodeTypeTest(
|
|
2452
|
-
NodeTest.COMMENT,
|
|
2453
|
-
[NodeTypes.COMMENT_NODE],
|
|
2454
|
-
'comment()'
|
|
2455
|
-
);
|
|
2456
|
-
// elements, attributes, text, cdata, PIs, comments, document nodes
|
|
2457
|
-
NodeTest.nodeTest = NodeTest.makeNodeTypeTest(
|
|
2458
|
-
NodeTest.NODE,
|
|
2459
|
-
[
|
|
2460
|
-
NodeTypes.ELEMENT_NODE,
|
|
2461
|
-
NodeTypes.ATTRIBUTE_NODE,
|
|
2462
|
-
NodeTypes.TEXT_NODE,
|
|
2463
|
-
NodeTypes.CDATA_SECTION_NODE,
|
|
2464
|
-
NodeTypes.PROCESSING_INSTRUCTION_NODE,
|
|
2465
|
-
NodeTypes.COMMENT_NODE,
|
|
2466
|
-
NodeTypes.DOCUMENT_NODE,
|
|
2467
|
-
],
|
|
2468
|
-
'node()'
|
|
2469
|
-
);
|
|
2470
|
-
NodeTest.anyPiTest = NodeTest.makeNodeTypeTest(
|
|
2471
|
-
NodeTest.PI,
|
|
2472
|
-
[NodeTypes.PROCESSING_INSTRUCTION_NODE],
|
|
2473
|
-
'processing-instruction()'
|
|
2474
|
-
);
|
|
2475
|
-
|
|
2476
|
-
// VariableReference /////////////////////////////////////////////////////////
|
|
2477
|
-
|
|
2478
|
-
VariableReference.prototype = new Expression();
|
|
2479
|
-
VariableReference.prototype.constructor = VariableReference;
|
|
2480
|
-
VariableReference.superclass = Expression.prototype;
|
|
2481
|
-
|
|
2482
|
-
function VariableReference(v) {
|
|
2483
|
-
if (arguments.length > 0) {
|
|
2484
|
-
this.init(v);
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
|
|
2488
|
-
VariableReference.prototype.init = function (v) {
|
|
2489
|
-
this.variable = v;
|
|
2490
|
-
};
|
|
2491
|
-
|
|
2492
|
-
VariableReference.prototype.toString = function () {
|
|
2493
|
-
return "$" + this.variable;
|
|
2494
|
-
};
|
|
2495
|
-
|
|
2496
|
-
VariableReference.prototype.evaluate = function (c) {
|
|
2497
|
-
var parts = Utilities.resolveQName(this.variable, c.namespaceResolver, c.contextNode, false);
|
|
2498
|
-
|
|
2499
|
-
if (parts[0] == null) {
|
|
2500
|
-
throw new Error("Cannot resolve QName " + fn);
|
|
2501
|
-
}
|
|
2502
|
-
var result = c.variableResolver.getVariable(parts[1], parts[0]);
|
|
2503
|
-
if (!result) {
|
|
2504
|
-
throw XPathException.fromMessage("Undeclared variable: " + this.toString());
|
|
2505
|
-
}
|
|
2506
|
-
return result;
|
|
2507
|
-
};
|
|
2508
|
-
|
|
2509
|
-
// FunctionCall //////////////////////////////////////////////////////////////
|
|
2510
|
-
|
|
2511
|
-
FunctionCall.prototype = new Expression();
|
|
2512
|
-
FunctionCall.prototype.constructor = FunctionCall;
|
|
2513
|
-
FunctionCall.superclass = Expression.prototype;
|
|
2514
|
-
|
|
2515
|
-
function FunctionCall(fn, args) {
|
|
2516
|
-
if (arguments.length > 0) {
|
|
2517
|
-
this.init(fn, args);
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
|
|
2521
|
-
FunctionCall.prototype.init = function (fn, args) {
|
|
2522
|
-
this.functionName = fn;
|
|
2523
|
-
this.arguments = args;
|
|
2524
|
-
};
|
|
2525
|
-
|
|
2526
|
-
FunctionCall.prototype.toString = function () {
|
|
2527
|
-
var s = this.functionName + "(";
|
|
2528
|
-
for (var i = 0; i < this.arguments.length; i++) {
|
|
2529
|
-
if (i > 0) {
|
|
2530
|
-
s += ", ";
|
|
2531
|
-
}
|
|
2532
|
-
s += this.arguments[i].toString();
|
|
2533
|
-
}
|
|
2534
|
-
return s + ")";
|
|
2535
|
-
};
|
|
2536
|
-
|
|
2537
|
-
FunctionCall.prototype.evaluate = function (c) {
|
|
2538
|
-
var f = FunctionResolver.getFunctionFromContext(this.functionName, c);
|
|
2539
|
-
|
|
2540
|
-
if (!f) {
|
|
2541
|
-
throw new Error("Unknown function " + this.functionName);
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
|
-
var a = [c].concat(this.arguments);
|
|
2545
|
-
return f.apply(c.functionResolver.thisArg, a);
|
|
2546
|
-
};
|
|
2547
|
-
|
|
2548
|
-
// Operators /////////////////////////////////////////////////////////////////
|
|
2549
|
-
|
|
2550
|
-
var Operators = new Object();
|
|
2551
|
-
|
|
2552
|
-
Operators.equals = function (l, r) {
|
|
2553
|
-
return l.equals(r);
|
|
2554
|
-
};
|
|
2555
|
-
|
|
2556
|
-
Operators.notequal = function (l, r) {
|
|
2557
|
-
return l.notequal(r);
|
|
2558
|
-
};
|
|
2559
|
-
|
|
2560
|
-
Operators.lessthan = function (l, r) {
|
|
2561
|
-
return l.lessthan(r);
|
|
2562
|
-
};
|
|
2563
|
-
|
|
2564
|
-
Operators.greaterthan = function (l, r) {
|
|
2565
|
-
return l.greaterthan(r);
|
|
2566
|
-
};
|
|
2567
|
-
|
|
2568
|
-
Operators.lessthanorequal = function (l, r) {
|
|
2569
|
-
return l.lessthanorequal(r);
|
|
2570
|
-
};
|
|
2571
|
-
|
|
2572
|
-
Operators.greaterthanorequal = function (l, r) {
|
|
2573
|
-
return l.greaterthanorequal(r);
|
|
2574
|
-
};
|
|
2575
|
-
|
|
2576
|
-
// XString ///////////////////////////////////////////////////////////////////
|
|
2577
|
-
|
|
2578
|
-
XString.prototype = new Expression();
|
|
2579
|
-
XString.prototype.constructor = XString;
|
|
2580
|
-
XString.superclass = Expression.prototype;
|
|
2581
|
-
|
|
2582
|
-
function XString(s) {
|
|
2583
|
-
if (arguments.length > 0) {
|
|
2584
|
-
this.init(s);
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
XString.prototype.init = function (s) {
|
|
2589
|
-
this.str = String(s);
|
|
2590
|
-
};
|
|
2591
|
-
|
|
2592
|
-
XString.prototype.toString = function () {
|
|
2593
|
-
return this.str;
|
|
2594
|
-
};
|
|
2595
|
-
|
|
2596
|
-
XString.prototype.evaluate = function (c) {
|
|
2597
|
-
return this;
|
|
2598
|
-
};
|
|
2599
|
-
|
|
2600
|
-
XString.prototype.string = function () {
|
|
2601
|
-
return this;
|
|
2602
|
-
};
|
|
2603
|
-
|
|
2604
|
-
XString.prototype.number = function () {
|
|
2605
|
-
return new XNumber(this.str);
|
|
2606
|
-
};
|
|
2607
|
-
|
|
2608
|
-
XString.prototype.bool = function () {
|
|
2609
|
-
return new XBoolean(this.str);
|
|
2610
|
-
};
|
|
2611
|
-
|
|
2612
|
-
XString.prototype.nodeset = function () {
|
|
2613
|
-
throw new Error("Cannot convert string to nodeset");
|
|
2614
|
-
};
|
|
2615
|
-
|
|
2616
|
-
XString.prototype.stringValue = function () {
|
|
2617
|
-
return this.str;
|
|
2618
|
-
};
|
|
2619
|
-
|
|
2620
|
-
XString.prototype.numberValue = function () {
|
|
2621
|
-
return this.number().numberValue();
|
|
2622
|
-
};
|
|
2623
|
-
|
|
2624
|
-
XString.prototype.booleanValue = function () {
|
|
2625
|
-
return this.bool().booleanValue();
|
|
2626
|
-
};
|
|
2627
|
-
|
|
2628
|
-
XString.prototype.equals = function (r) {
|
|
2629
|
-
if (Utilities.instance_of(r, XBoolean)) {
|
|
2630
|
-
return this.bool().equals(r);
|
|
2631
|
-
}
|
|
2632
|
-
if (Utilities.instance_of(r, XNumber)) {
|
|
2633
|
-
return this.number().equals(r);
|
|
2634
|
-
}
|
|
2635
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2636
|
-
return r.compareWithString(this, Operators.equals);
|
|
2637
|
-
}
|
|
2638
|
-
return new XBoolean(this.str == r.str);
|
|
2639
|
-
};
|
|
2640
|
-
|
|
2641
|
-
XString.prototype.notequal = function (r) {
|
|
2642
|
-
if (Utilities.instance_of(r, XBoolean)) {
|
|
2643
|
-
return this.bool().notequal(r);
|
|
2644
|
-
}
|
|
2645
|
-
if (Utilities.instance_of(r, XNumber)) {
|
|
2646
|
-
return this.number().notequal(r);
|
|
2647
|
-
}
|
|
2648
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2649
|
-
return r.compareWithString(this, Operators.notequal);
|
|
2650
|
-
}
|
|
2651
|
-
return new XBoolean(this.str != r.str);
|
|
2652
|
-
};
|
|
2653
|
-
|
|
2654
|
-
XString.prototype.lessthan = function (r) {
|
|
2655
|
-
return this.number().lessthan(r);
|
|
2656
|
-
};
|
|
2657
|
-
|
|
2658
|
-
XString.prototype.greaterthan = function (r) {
|
|
2659
|
-
return this.number().greaterthan(r);
|
|
2660
|
-
};
|
|
2661
|
-
|
|
2662
|
-
XString.prototype.lessthanorequal = function (r) {
|
|
2663
|
-
return this.number().lessthanorequal(r);
|
|
2664
|
-
};
|
|
2665
|
-
|
|
2666
|
-
XString.prototype.greaterthanorequal = function (r) {
|
|
2667
|
-
return this.number().greaterthanorequal(r);
|
|
2668
|
-
};
|
|
2669
|
-
|
|
2670
|
-
// XNumber ///////////////////////////////////////////////////////////////////
|
|
2671
|
-
|
|
2672
|
-
XNumber.prototype = new Expression();
|
|
2673
|
-
XNumber.prototype.constructor = XNumber;
|
|
2674
|
-
XNumber.superclass = Expression.prototype;
|
|
2675
|
-
|
|
2676
|
-
function XNumber(n) {
|
|
2677
|
-
if (arguments.length > 0) {
|
|
2678
|
-
this.init(n);
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
|
|
2682
|
-
XNumber.prototype.init = function (n) {
|
|
2683
|
-
this.num = typeof n === "string" ? this.parse(n) : Number(n);
|
|
2684
|
-
};
|
|
2685
|
-
|
|
2686
|
-
XNumber.prototype.numberFormat = /^\s*-?[0-9]*\.?[0-9]+\s*$/;
|
|
2687
|
-
|
|
2688
|
-
XNumber.prototype.parse = function (s) {
|
|
2689
|
-
// XPath representation of numbers is more restrictive than what Number() or parseFloat() allow
|
|
2690
|
-
return this.numberFormat.test(s) ? parseFloat(s) : Number.NaN;
|
|
2691
|
-
};
|
|
2692
|
-
|
|
2693
|
-
function padSmallNumber(numberStr) {
|
|
2694
|
-
var parts = numberStr.split('e-');
|
|
2695
|
-
var base = parts[0].replace('.', '');
|
|
2696
|
-
var exponent = Number(parts[1]);
|
|
2697
|
-
|
|
2698
|
-
for (var i = 0; i < exponent - 1; i += 1) {
|
|
2699
|
-
base = '0' + base;
|
|
2700
|
-
}
|
|
2701
|
-
|
|
2702
|
-
return '0.' + base;
|
|
2703
|
-
}
|
|
2704
|
-
|
|
2705
|
-
function padLargeNumber(numberStr) {
|
|
2706
|
-
var parts = numberStr.split('e');
|
|
2707
|
-
var base = parts[0].replace('.', '');
|
|
2708
|
-
var exponent = Number(parts[1]);
|
|
2709
|
-
var zerosToAppend = exponent + 1 - base.length;
|
|
2710
|
-
|
|
2711
|
-
for (var i = 0; i < zerosToAppend; i += 1) {
|
|
2712
|
-
base += '0';
|
|
2713
|
-
}
|
|
2714
|
-
|
|
2715
|
-
return base;
|
|
2716
|
-
}
|
|
2717
|
-
|
|
2718
|
-
XNumber.prototype.toString = function () {
|
|
2719
|
-
var strValue = this.num.toString();
|
|
2720
|
-
|
|
2721
|
-
if (strValue.indexOf('e-') !== -1) {
|
|
2722
|
-
return padSmallNumber(strValue);
|
|
2723
|
-
}
|
|
2724
|
-
|
|
2725
|
-
if (strValue.indexOf('e') !== -1) {
|
|
2726
|
-
return padLargeNumber(strValue);
|
|
2727
|
-
}
|
|
2728
|
-
|
|
2729
|
-
return strValue;
|
|
2730
|
-
};
|
|
2731
|
-
|
|
2732
|
-
XNumber.prototype.evaluate = function (c) {
|
|
2733
|
-
return this;
|
|
2734
|
-
};
|
|
2735
|
-
|
|
2736
|
-
XNumber.prototype.string = function () {
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
return new XString(this.toString());
|
|
2740
|
-
};
|
|
2741
|
-
|
|
2742
|
-
XNumber.prototype.number = function () {
|
|
2743
|
-
return this;
|
|
2744
|
-
};
|
|
2745
|
-
|
|
2746
|
-
XNumber.prototype.bool = function () {
|
|
2747
|
-
return new XBoolean(this.num);
|
|
2748
|
-
};
|
|
2749
|
-
|
|
2750
|
-
XNumber.prototype.nodeset = function () {
|
|
2751
|
-
throw new Error("Cannot convert number to nodeset");
|
|
2752
|
-
};
|
|
2753
|
-
|
|
2754
|
-
XNumber.prototype.stringValue = function () {
|
|
2755
|
-
return this.string().stringValue();
|
|
2756
|
-
};
|
|
2757
|
-
|
|
2758
|
-
XNumber.prototype.numberValue = function () {
|
|
2759
|
-
return this.num;
|
|
2760
|
-
};
|
|
2761
|
-
|
|
2762
|
-
XNumber.prototype.booleanValue = function () {
|
|
2763
|
-
return this.bool().booleanValue();
|
|
2764
|
-
};
|
|
2765
|
-
|
|
2766
|
-
XNumber.prototype.negate = function () {
|
|
2767
|
-
return new XNumber(-this.num);
|
|
2768
|
-
};
|
|
2769
|
-
|
|
2770
|
-
XNumber.prototype.equals = function (r) {
|
|
2771
|
-
if (Utilities.instance_of(r, XBoolean)) {
|
|
2772
|
-
return this.bool().equals(r);
|
|
2773
|
-
}
|
|
2774
|
-
if (Utilities.instance_of(r, XString)) {
|
|
2775
|
-
return this.equals(r.number());
|
|
2776
|
-
}
|
|
2777
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2778
|
-
return r.compareWithNumber(this, Operators.equals);
|
|
2779
|
-
}
|
|
2780
|
-
return new XBoolean(this.num == r.num);
|
|
2781
|
-
};
|
|
2782
|
-
|
|
2783
|
-
XNumber.prototype.notequal = function (r) {
|
|
2784
|
-
if (Utilities.instance_of(r, XBoolean)) {
|
|
2785
|
-
return this.bool().notequal(r);
|
|
2786
|
-
}
|
|
2787
|
-
if (Utilities.instance_of(r, XString)) {
|
|
2788
|
-
return this.notequal(r.number());
|
|
2789
|
-
}
|
|
2790
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2791
|
-
return r.compareWithNumber(this, Operators.notequal);
|
|
2792
|
-
}
|
|
2793
|
-
return new XBoolean(this.num != r.num);
|
|
2794
|
-
};
|
|
2795
|
-
|
|
2796
|
-
XNumber.prototype.lessthan = function (r) {
|
|
2797
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2798
|
-
return r.compareWithNumber(this, Operators.greaterthan);
|
|
2799
|
-
}
|
|
2800
|
-
if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
|
|
2801
|
-
return this.lessthan(r.number());
|
|
2802
|
-
}
|
|
2803
|
-
return new XBoolean(this.num < r.num);
|
|
2804
|
-
};
|
|
2805
|
-
|
|
2806
|
-
XNumber.prototype.greaterthan = function (r) {
|
|
2807
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2808
|
-
return r.compareWithNumber(this, Operators.lessthan);
|
|
2809
|
-
}
|
|
2810
|
-
if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
|
|
2811
|
-
return this.greaterthan(r.number());
|
|
2812
|
-
}
|
|
2813
|
-
return new XBoolean(this.num > r.num);
|
|
2814
|
-
};
|
|
2815
|
-
|
|
2816
|
-
XNumber.prototype.lessthanorequal = function (r) {
|
|
2817
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2818
|
-
return r.compareWithNumber(this, Operators.greaterthanorequal);
|
|
2819
|
-
}
|
|
2820
|
-
if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
|
|
2821
|
-
return this.lessthanorequal(r.number());
|
|
2822
|
-
}
|
|
2823
|
-
return new XBoolean(this.num <= r.num);
|
|
2824
|
-
};
|
|
2825
|
-
|
|
2826
|
-
XNumber.prototype.greaterthanorequal = function (r) {
|
|
2827
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2828
|
-
return r.compareWithNumber(this, Operators.lessthanorequal);
|
|
2829
|
-
}
|
|
2830
|
-
if (Utilities.instance_of(r, XBoolean) || Utilities.instance_of(r, XString)) {
|
|
2831
|
-
return this.greaterthanorequal(r.number());
|
|
2832
|
-
}
|
|
2833
|
-
return new XBoolean(this.num >= r.num);
|
|
2834
|
-
};
|
|
2835
|
-
|
|
2836
|
-
XNumber.prototype.plus = function (r) {
|
|
2837
|
-
return new XNumber(this.num + r.num);
|
|
2838
|
-
};
|
|
2839
|
-
|
|
2840
|
-
XNumber.prototype.minus = function (r) {
|
|
2841
|
-
return new XNumber(this.num - r.num);
|
|
2842
|
-
};
|
|
2843
|
-
|
|
2844
|
-
XNumber.prototype.multiply = function (r) {
|
|
2845
|
-
return new XNumber(this.num * r.num);
|
|
2846
|
-
};
|
|
2847
|
-
|
|
2848
|
-
XNumber.prototype.div = function (r) {
|
|
2849
|
-
return new XNumber(this.num / r.num);
|
|
2850
|
-
};
|
|
2851
|
-
|
|
2852
|
-
XNumber.prototype.mod = function (r) {
|
|
2853
|
-
return new XNumber(this.num % r.num);
|
|
2854
|
-
};
|
|
2855
|
-
|
|
2856
|
-
// XBoolean //////////////////////////////////////////////////////////////////
|
|
2857
|
-
|
|
2858
|
-
XBoolean.prototype = new Expression();
|
|
2859
|
-
XBoolean.prototype.constructor = XBoolean;
|
|
2860
|
-
XBoolean.superclass = Expression.prototype;
|
|
2861
|
-
|
|
2862
|
-
function XBoolean(b) {
|
|
2863
|
-
if (arguments.length > 0) {
|
|
2864
|
-
this.init(b);
|
|
2865
|
-
}
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
XBoolean.prototype.init = function (b) {
|
|
2869
|
-
this.b = Boolean(b);
|
|
2870
|
-
};
|
|
2871
|
-
|
|
2872
|
-
XBoolean.prototype.toString = function () {
|
|
2873
|
-
return this.b.toString();
|
|
2874
|
-
};
|
|
2875
|
-
|
|
2876
|
-
XBoolean.prototype.evaluate = function (c) {
|
|
2877
|
-
return this;
|
|
2878
|
-
};
|
|
2879
|
-
|
|
2880
|
-
XBoolean.prototype.string = function () {
|
|
2881
|
-
return new XString(this.b);
|
|
2882
|
-
};
|
|
2883
|
-
|
|
2884
|
-
XBoolean.prototype.number = function () {
|
|
2885
|
-
return new XNumber(this.b);
|
|
2886
|
-
};
|
|
2887
|
-
|
|
2888
|
-
XBoolean.prototype.bool = function () {
|
|
2889
|
-
return this;
|
|
2890
|
-
};
|
|
2891
|
-
|
|
2892
|
-
XBoolean.prototype.nodeset = function () {
|
|
2893
|
-
throw new Error("Cannot convert boolean to nodeset");
|
|
2894
|
-
};
|
|
2895
|
-
|
|
2896
|
-
XBoolean.prototype.stringValue = function () {
|
|
2897
|
-
return this.string().stringValue();
|
|
2898
|
-
};
|
|
2899
|
-
|
|
2900
|
-
XBoolean.prototype.numberValue = function () {
|
|
2901
|
-
return this.number().numberValue();
|
|
2902
|
-
};
|
|
2903
|
-
|
|
2904
|
-
XBoolean.prototype.booleanValue = function () {
|
|
2905
|
-
return this.b;
|
|
2906
|
-
};
|
|
2907
|
-
|
|
2908
|
-
XBoolean.prototype.not = function () {
|
|
2909
|
-
return new XBoolean(!this.b);
|
|
2910
|
-
};
|
|
2911
|
-
|
|
2912
|
-
XBoolean.prototype.equals = function (r) {
|
|
2913
|
-
if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) {
|
|
2914
|
-
return this.equals(r.bool());
|
|
2915
|
-
}
|
|
2916
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2917
|
-
return r.compareWithBoolean(this, Operators.equals);
|
|
2918
|
-
}
|
|
2919
|
-
return new XBoolean(this.b == r.b);
|
|
2920
|
-
};
|
|
2921
|
-
|
|
2922
|
-
XBoolean.prototype.notequal = function (r) {
|
|
2923
|
-
if (Utilities.instance_of(r, XString) || Utilities.instance_of(r, XNumber)) {
|
|
2924
|
-
return this.notequal(r.bool());
|
|
2925
|
-
}
|
|
2926
|
-
if (Utilities.instance_of(r, XNodeSet)) {
|
|
2927
|
-
return r.compareWithBoolean(this, Operators.notequal);
|
|
2928
|
-
}
|
|
2929
|
-
return new XBoolean(this.b != r.b);
|
|
2930
|
-
};
|
|
2931
|
-
|
|
2932
|
-
XBoolean.prototype.lessthan = function (r) {
|
|
2933
|
-
return this.number().lessthan(r);
|
|
2934
|
-
};
|
|
2935
|
-
|
|
2936
|
-
XBoolean.prototype.greaterthan = function (r) {
|
|
2937
|
-
return this.number().greaterthan(r);
|
|
2938
|
-
};
|
|
2939
|
-
|
|
2940
|
-
XBoolean.prototype.lessthanorequal = function (r) {
|
|
2941
|
-
return this.number().lessthanorequal(r);
|
|
2942
|
-
};
|
|
2943
|
-
|
|
2944
|
-
XBoolean.prototype.greaterthanorequal = function (r) {
|
|
2945
|
-
return this.number().greaterthanorequal(r);
|
|
2946
|
-
};
|
|
2947
|
-
|
|
2948
|
-
XBoolean.true_ = new XBoolean(true);
|
|
2949
|
-
XBoolean.false_ = new XBoolean(false);
|
|
2950
|
-
|
|
2951
|
-
// AVLTree ///////////////////////////////////////////////////////////////////
|
|
2952
|
-
|
|
2953
|
-
AVLTree.prototype = new Object();
|
|
2954
|
-
AVLTree.prototype.constructor = AVLTree;
|
|
2955
|
-
AVLTree.superclass = Object.prototype;
|
|
2956
|
-
|
|
2957
|
-
function AVLTree(n) {
|
|
2958
|
-
this.init(n);
|
|
2959
|
-
}
|
|
2960
|
-
|
|
2961
|
-
AVLTree.prototype.init = function (n) {
|
|
2962
|
-
this.left = null;
|
|
2963
|
-
this.right = null;
|
|
2964
|
-
this.node = n;
|
|
2965
|
-
this.depth = 1;
|
|
2966
|
-
};
|
|
2967
|
-
|
|
2968
|
-
AVLTree.prototype.balance = function () {
|
|
2969
|
-
var ldepth = this.left == null ? 0 : this.left.depth;
|
|
2970
|
-
var rdepth = this.right == null ? 0 : this.right.depth;
|
|
2971
|
-
|
|
2972
|
-
if (ldepth > rdepth + 1) {
|
|
2973
|
-
// LR or LL rotation
|
|
2974
|
-
var lldepth = this.left.left == null ? 0 : this.left.left.depth;
|
|
2975
|
-
var lrdepth = this.left.right == null ? 0 : this.left.right.depth;
|
|
2976
|
-
|
|
2977
|
-
if (lldepth < lrdepth) {
|
|
2978
|
-
// LR rotation consists of a RR rotation of the left child
|
|
2979
|
-
this.left.rotateRR();
|
|
2980
|
-
// plus a LL rotation of this node, which happens anyway
|
|
2981
|
-
}
|
|
2982
|
-
this.rotateLL();
|
|
2983
|
-
} else if (ldepth + 1 < rdepth) {
|
|
2984
|
-
// RR or RL rorarion
|
|
2985
|
-
var rrdepth = this.right.right == null ? 0 : this.right.right.depth;
|
|
2986
|
-
var rldepth = this.right.left == null ? 0 : this.right.left.depth;
|
|
2987
|
-
|
|
2988
|
-
if (rldepth > rrdepth) {
|
|
2989
|
-
// RR rotation consists of a LL rotation of the right child
|
|
2990
|
-
this.right.rotateLL();
|
|
2991
|
-
// plus a RR rotation of this node, which happens anyway
|
|
2992
|
-
}
|
|
2993
|
-
this.rotateRR();
|
|
2994
|
-
}
|
|
2995
|
-
};
|
|
2996
|
-
|
|
2997
|
-
AVLTree.prototype.rotateLL = function () {
|
|
2998
|
-
// the left side is too long => rotate from the left (_not_ leftwards)
|
|
2999
|
-
var nodeBefore = this.node;
|
|
3000
|
-
var rightBefore = this.right;
|
|
3001
|
-
this.node = this.left.node;
|
|
3002
|
-
this.right = this.left;
|
|
3003
|
-
this.left = this.left.left;
|
|
3004
|
-
this.right.left = this.right.right;
|
|
3005
|
-
this.right.right = rightBefore;
|
|
3006
|
-
this.right.node = nodeBefore;
|
|
3007
|
-
this.right.updateInNewLocation();
|
|
3008
|
-
this.updateInNewLocation();
|
|
3009
|
-
};
|
|
3010
|
-
|
|
3011
|
-
AVLTree.prototype.rotateRR = function () {
|
|
3012
|
-
// the right side is too long => rotate from the right (_not_ rightwards)
|
|
3013
|
-
var nodeBefore = this.node;
|
|
3014
|
-
var leftBefore = this.left;
|
|
3015
|
-
this.node = this.right.node;
|
|
3016
|
-
this.left = this.right;
|
|
3017
|
-
this.right = this.right.right;
|
|
3018
|
-
this.left.right = this.left.left;
|
|
3019
|
-
this.left.left = leftBefore;
|
|
3020
|
-
this.left.node = nodeBefore;
|
|
3021
|
-
this.left.updateInNewLocation();
|
|
3022
|
-
this.updateInNewLocation();
|
|
3023
|
-
};
|
|
3024
|
-
|
|
3025
|
-
AVLTree.prototype.updateInNewLocation = function () {
|
|
3026
|
-
this.getDepthFromChildren();
|
|
3027
|
-
};
|
|
3028
|
-
|
|
3029
|
-
AVLTree.prototype.getDepthFromChildren = function () {
|
|
3030
|
-
this.depth = this.node == null ? 0 : 1;
|
|
3031
|
-
if (this.left != null) {
|
|
3032
|
-
this.depth = this.left.depth + 1;
|
|
3033
|
-
}
|
|
3034
|
-
if (this.right != null && this.depth <= this.right.depth) {
|
|
3035
|
-
this.depth = this.right.depth + 1;
|
|
3036
|
-
}
|
|
3037
|
-
};
|
|
3038
|
-
|
|
3039
|
-
function nodeOrder(n1, n2) {
|
|
3040
|
-
if (n1 === n2) {
|
|
3041
|
-
return 0;
|
|
3042
|
-
}
|
|
3043
|
-
|
|
3044
|
-
if (n1.compareDocumentPosition) {
|
|
3045
|
-
var cpos = n1.compareDocumentPosition(n2);
|
|
3046
|
-
|
|
3047
|
-
if (cpos & 0x01) {
|
|
3048
|
-
// not in the same document; return an arbitrary result (is there a better way to do this)
|
|
3049
|
-
return 1;
|
|
3050
|
-
}
|
|
3051
|
-
if (cpos & 0x0A) {
|
|
3052
|
-
// n2 precedes or contains n1
|
|
3053
|
-
return 1;
|
|
3054
|
-
}
|
|
3055
|
-
if (cpos & 0x14) {
|
|
3056
|
-
// n2 follows or is contained by n1
|
|
3057
|
-
return -1;
|
|
3058
|
-
}
|
|
3059
|
-
|
|
3060
|
-
return 0;
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
var d1 = 0,
|
|
3064
|
-
d2 = 0;
|
|
3065
|
-
for (var m1 = n1; m1 != null; m1 = m1.parentNode || m1.ownerElement) {
|
|
3066
|
-
d1++;
|
|
3067
|
-
}
|
|
3068
|
-
for (var m2 = n2; m2 != null; m2 = m2.parentNode || m2.ownerElement) {
|
|
3069
|
-
d2++;
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3072
|
-
// step up to same depth
|
|
3073
|
-
if (d1 > d2) {
|
|
3074
|
-
while (d1 > d2) {
|
|
3075
|
-
n1 = n1.parentNode || n1.ownerElement;
|
|
3076
|
-
d1--;
|
|
3077
|
-
}
|
|
3078
|
-
if (n1 === n2) {
|
|
3079
|
-
return 1;
|
|
3080
|
-
}
|
|
3081
|
-
} else if (d2 > d1) {
|
|
3082
|
-
while (d2 > d1) {
|
|
3083
|
-
n2 = n2.parentNode || n2.ownerElement;
|
|
3084
|
-
d2--;
|
|
3085
|
-
}
|
|
3086
|
-
if (n1 === n2) {
|
|
3087
|
-
return -1;
|
|
3088
|
-
}
|
|
3089
|
-
}
|
|
3090
|
-
|
|
3091
|
-
var n1Par = n1.parentNode || n1.ownerElement,
|
|
3092
|
-
n2Par = n2.parentNode || n2.ownerElement;
|
|
3093
|
-
|
|
3094
|
-
// find common parent
|
|
3095
|
-
while (n1Par !== n2Par) {
|
|
3096
|
-
n1 = n1Par;
|
|
3097
|
-
n2 = n2Par;
|
|
3098
|
-
n1Par = n1.parentNode || n1.ownerElement;
|
|
3099
|
-
n2Par = n2.parentNode || n2.ownerElement;
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
var n1isAttr = Utilities.isAttribute(n1);
|
|
3103
|
-
var n2isAttr = Utilities.isAttribute(n2);
|
|
3104
|
-
|
|
3105
|
-
if (n1isAttr && !n2isAttr) {
|
|
3106
|
-
return -1;
|
|
3107
|
-
}
|
|
3108
|
-
if (!n1isAttr && n2isAttr) {
|
|
3109
|
-
return 1;
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
if (n1Par) {
|
|
3113
|
-
var cn = n1isAttr ? n1Par.attributes : n1Par.childNodes,
|
|
3114
|
-
len = cn.length;
|
|
3115
|
-
for (var i = 0; i < len; i += 1) {
|
|
3116
|
-
var n = cn[i];
|
|
3117
|
-
if (n === n1) {
|
|
3118
|
-
return -1;
|
|
3119
|
-
}
|
|
3120
|
-
if (n === n2) {
|
|
3121
|
-
return 1;
|
|
3122
|
-
}
|
|
3123
|
-
}
|
|
3124
|
-
}
|
|
3125
|
-
|
|
3126
|
-
throw new Error('Unexpected: could not determine node order');
|
|
3127
|
-
}
|
|
3128
|
-
|
|
3129
|
-
AVLTree.prototype.add = function (n) {
|
|
3130
|
-
if (n === this.node) {
|
|
3131
|
-
return false;
|
|
3132
|
-
}
|
|
3133
|
-
|
|
3134
|
-
var o = nodeOrder(n, this.node);
|
|
3135
|
-
|
|
3136
|
-
var ret = false;
|
|
3137
|
-
if (o == -1) {
|
|
3138
|
-
if (this.left == null) {
|
|
3139
|
-
this.left = new AVLTree(n);
|
|
3140
|
-
ret = true;
|
|
3141
|
-
} else {
|
|
3142
|
-
ret = this.left.add(n);
|
|
3143
|
-
if (ret) {
|
|
3144
|
-
this.balance();
|
|
3145
|
-
}
|
|
3146
|
-
}
|
|
3147
|
-
} else if (o == 1) {
|
|
3148
|
-
if (this.right == null) {
|
|
3149
|
-
this.right = new AVLTree(n);
|
|
3150
|
-
ret = true;
|
|
3151
|
-
} else {
|
|
3152
|
-
ret = this.right.add(n);
|
|
3153
|
-
if (ret) {
|
|
3154
|
-
this.balance();
|
|
3155
|
-
}
|
|
3156
|
-
}
|
|
3157
|
-
}
|
|
3158
|
-
|
|
3159
|
-
if (ret) {
|
|
3160
|
-
this.getDepthFromChildren();
|
|
3161
|
-
}
|
|
3162
|
-
return ret;
|
|
3163
|
-
};
|
|
3164
|
-
|
|
3165
|
-
// XNodeSet //////////////////////////////////////////////////////////////////
|
|
3166
|
-
|
|
3167
|
-
XNodeSet.prototype = new Expression();
|
|
3168
|
-
XNodeSet.prototype.constructor = XNodeSet;
|
|
3169
|
-
XNodeSet.superclass = Expression.prototype;
|
|
3170
|
-
|
|
3171
|
-
function XNodeSet() {
|
|
3172
|
-
this.init();
|
|
3173
|
-
}
|
|
3174
|
-
|
|
3175
|
-
XNodeSet.prototype.init = function () {
|
|
3176
|
-
this.tree = null;
|
|
3177
|
-
this.nodes = [];
|
|
3178
|
-
this.size = 0;
|
|
3179
|
-
};
|
|
3180
|
-
|
|
3181
|
-
XNodeSet.prototype.toString = function () {
|
|
3182
|
-
var p = this.first();
|
|
3183
|
-
if (p == null) {
|
|
3184
|
-
return "";
|
|
3185
|
-
}
|
|
3186
|
-
return this.stringForNode(p);
|
|
3187
|
-
};
|
|
3188
|
-
|
|
3189
|
-
XNodeSet.prototype.evaluate = function (c) {
|
|
3190
|
-
return this;
|
|
3191
|
-
};
|
|
3192
|
-
|
|
3193
|
-
XNodeSet.prototype.string = function () {
|
|
3194
|
-
return new XString(this.toString());
|
|
3195
|
-
};
|
|
3196
|
-
|
|
3197
|
-
XNodeSet.prototype.stringValue = function () {
|
|
3198
|
-
return this.toString();
|
|
3199
|
-
};
|
|
3200
|
-
|
|
3201
|
-
XNodeSet.prototype.number = function () {
|
|
3202
|
-
return new XNumber(this.string());
|
|
3203
|
-
};
|
|
3204
|
-
|
|
3205
|
-
XNodeSet.prototype.numberValue = function () {
|
|
3206
|
-
return Number(this.string());
|
|
3207
|
-
};
|
|
3208
|
-
|
|
3209
|
-
XNodeSet.prototype.bool = function () {
|
|
3210
|
-
return new XBoolean(this.booleanValue());
|
|
3211
|
-
};
|
|
3212
|
-
|
|
3213
|
-
XNodeSet.prototype.booleanValue = function () {
|
|
3214
|
-
return !!this.size;
|
|
3215
|
-
};
|
|
3216
|
-
|
|
3217
|
-
XNodeSet.prototype.nodeset = function () {
|
|
3218
|
-
return this;
|
|
3219
|
-
};
|
|
3220
|
-
|
|
3221
|
-
XNodeSet.prototype.stringForNode = function (n) {
|
|
3222
|
-
if (n.nodeType == NodeTypes.DOCUMENT_NODE ||
|
|
3223
|
-
n.nodeType == NodeTypes.ELEMENT_NODE ||
|
|
3224
|
-
n.nodeType === NodeTypes.DOCUMENT_FRAGMENT_NODE) {
|
|
3225
|
-
return this.stringForContainerNode(n);
|
|
3226
|
-
}
|
|
3227
|
-
if (n.nodeType === NodeTypes.ATTRIBUTE_NODE) {
|
|
3228
|
-
return n.value || n.nodeValue;
|
|
3229
|
-
}
|
|
3230
|
-
if (n.isNamespaceNode) {
|
|
3231
|
-
return n.namespace;
|
|
3232
|
-
}
|
|
3233
|
-
return n.nodeValue;
|
|
3234
|
-
};
|
|
3235
|
-
|
|
3236
|
-
XNodeSet.prototype.stringForContainerNode = function (n) {
|
|
3237
|
-
var s = "";
|
|
3238
|
-
for (var n2 = n.firstChild; n2 != null; n2 = n2.nextSibling) {
|
|
3239
|
-
var nt = n2.nodeType;
|
|
3240
|
-
// Element, Text, CDATA, Document, Document Fragment
|
|
3241
|
-
if (nt === 1 || nt === 3 || nt === 4 || nt === 9 || nt === 11) {
|
|
3242
|
-
s += this.stringForNode(n2);
|
|
3243
|
-
}
|
|
3244
|
-
}
|
|
3245
|
-
return s;
|
|
3246
|
-
};
|
|
3247
|
-
|
|
3248
|
-
XNodeSet.prototype.buildTree = function () {
|
|
3249
|
-
if (!this.tree && this.nodes.length) {
|
|
3250
|
-
this.tree = new AVLTree(this.nodes[0]);
|
|
3251
|
-
for (var i = 1; i < this.nodes.length; i += 1) {
|
|
3252
|
-
this.tree.add(this.nodes[i]);
|
|
3253
|
-
}
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
|
-
return this.tree;
|
|
3257
|
-
};
|
|
3258
|
-
|
|
3259
|
-
XNodeSet.prototype.first = function () {
|
|
3260
|
-
var p = this.buildTree();
|
|
3261
|
-
if (p == null) {
|
|
3262
|
-
return null;
|
|
3263
|
-
}
|
|
3264
|
-
while (p.left != null) {
|
|
3265
|
-
p = p.left;
|
|
3266
|
-
}
|
|
3267
|
-
return p.node;
|
|
3268
|
-
};
|
|
3269
|
-
|
|
3270
|
-
XNodeSet.prototype.add = function (n) {
|
|
3271
|
-
for (var i = 0; i < this.nodes.length; i += 1) {
|
|
3272
|
-
if (n === this.nodes[i]) {
|
|
3273
|
-
return;
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
|
-
|
|
3277
|
-
this.tree = null;
|
|
3278
|
-
this.nodes.push(n);
|
|
3279
|
-
this.size += 1;
|
|
3280
|
-
};
|
|
3281
|
-
|
|
3282
|
-
XNodeSet.prototype.addArray = function (ns) {
|
|
3283
|
-
var self = this;
|
|
3284
|
-
|
|
3285
|
-
forEach(function (x) { self.add(x); }, ns);
|
|
3286
|
-
};
|
|
3287
|
-
|
|
3288
|
-
/**
|
|
3289
|
-
* Returns an array of the node set's contents in document order
|
|
3290
|
-
*/
|
|
3291
|
-
XNodeSet.prototype.toArray = function () {
|
|
3292
|
-
var a = [];
|
|
3293
|
-
this.toArrayRec(this.buildTree(), a);
|
|
3294
|
-
return a;
|
|
3295
|
-
};
|
|
3296
|
-
|
|
3297
|
-
XNodeSet.prototype.toArrayRec = function (t, a) {
|
|
3298
|
-
if (t != null) {
|
|
3299
|
-
this.toArrayRec(t.left, a);
|
|
3300
|
-
a.push(t.node);
|
|
3301
|
-
this.toArrayRec(t.right, a);
|
|
3302
|
-
}
|
|
3303
|
-
};
|
|
3304
|
-
|
|
3305
|
-
/**
|
|
3306
|
-
* Returns an array of the node set's contents in arbitrary order
|
|
3307
|
-
*/
|
|
3308
|
-
XNodeSet.prototype.toUnsortedArray = function () {
|
|
3309
|
-
return this.nodes.slice();
|
|
3310
|
-
};
|
|
3311
|
-
|
|
3312
|
-
XNodeSet.prototype.compareWithString = function (r, o) {
|
|
3313
|
-
var a = this.toUnsortedArray();
|
|
3314
|
-
for (var i = 0; i < a.length; i++) {
|
|
3315
|
-
var n = a[i];
|
|
3316
|
-
var l = new XString(this.stringForNode(n));
|
|
3317
|
-
var res = o(l, r);
|
|
3318
|
-
if (res.booleanValue()) {
|
|
3319
|
-
return res;
|
|
3320
|
-
}
|
|
3321
|
-
}
|
|
3322
|
-
return new XBoolean(false);
|
|
3323
|
-
};
|
|
3324
|
-
|
|
3325
|
-
XNodeSet.prototype.compareWithNumber = function (r, o) {
|
|
3326
|
-
var a = this.toUnsortedArray();
|
|
3327
|
-
for (var i = 0; i < a.length; i++) {
|
|
3328
|
-
var n = a[i];
|
|
3329
|
-
var l = new XNumber(this.stringForNode(n));
|
|
3330
|
-
var res = o(l, r);
|
|
3331
|
-
if (res.booleanValue()) {
|
|
3332
|
-
return res;
|
|
3333
|
-
}
|
|
3334
|
-
}
|
|
3335
|
-
return new XBoolean(false);
|
|
3336
|
-
};
|
|
3337
|
-
|
|
3338
|
-
XNodeSet.prototype.compareWithBoolean = function (r, o) {
|
|
3339
|
-
return o(this.bool(), r);
|
|
3340
|
-
};
|
|
3341
|
-
|
|
3342
|
-
XNodeSet.prototype.compareWithNodeSet = function (r, o) {
|
|
3343
|
-
var arr = this.toUnsortedArray();
|
|
3344
|
-
var oInvert = function (lop, rop) { return o(rop, lop); };
|
|
3345
|
-
|
|
3346
|
-
for (var i = 0; i < arr.length; i++) {
|
|
3347
|
-
var l = new XString(this.stringForNode(arr[i]));
|
|
3348
|
-
|
|
3349
|
-
var res = r.compareWithString(l, oInvert);
|
|
3350
|
-
if (res.booleanValue()) {
|
|
3351
|
-
return res;
|
|
3352
|
-
}
|
|
3353
|
-
}
|
|
3354
|
-
|
|
3355
|
-
return new XBoolean(false);
|
|
3356
|
-
};
|
|
3357
|
-
|
|
3358
|
-
XNodeSet.compareWith = curry(function (o, r) {
|
|
3359
|
-
if (Utilities.instance_of(r, XString)) {
|
|
3360
|
-
return this.compareWithString(r, o);
|
|
3361
|
-
}
|
|
3362
|
-
if (Utilities.instance_of(r, XNumber)) {
|
|
3363
|
-
return this.compareWithNumber(r, o);
|
|
3364
|
-
}
|
|
3365
|
-
if (Utilities.instance_of(r, XBoolean)) {
|
|
3366
|
-
return this.compareWithBoolean(r, o);
|
|
3367
|
-
}
|
|
3368
|
-
return this.compareWithNodeSet(r, o);
|
|
3369
|
-
});
|
|
3370
|
-
|
|
3371
|
-
XNodeSet.prototype.equals = XNodeSet.compareWith(Operators.equals);
|
|
3372
|
-
XNodeSet.prototype.notequal = XNodeSet.compareWith(Operators.notequal);
|
|
3373
|
-
XNodeSet.prototype.lessthan = XNodeSet.compareWith(Operators.lessthan);
|
|
3374
|
-
XNodeSet.prototype.greaterthan = XNodeSet.compareWith(Operators.greaterthan);
|
|
3375
|
-
XNodeSet.prototype.lessthanorequal = XNodeSet.compareWith(Operators.lessthanorequal);
|
|
3376
|
-
XNodeSet.prototype.greaterthanorequal = XNodeSet.compareWith(Operators.greaterthanorequal);
|
|
3377
|
-
|
|
3378
|
-
XNodeSet.prototype.union = function (r) {
|
|
3379
|
-
var ns = new XNodeSet();
|
|
3380
|
-
ns.addArray(this.toUnsortedArray());
|
|
3381
|
-
ns.addArray(r.toUnsortedArray());
|
|
3382
|
-
return ns;
|
|
3383
|
-
};
|
|
3384
|
-
|
|
3385
|
-
// XPathNamespace ////////////////////////////////////////////////////////////
|
|
3386
|
-
|
|
3387
|
-
XPathNamespace.prototype = new Object();
|
|
3388
|
-
XPathNamespace.prototype.constructor = XPathNamespace;
|
|
3389
|
-
XPathNamespace.superclass = Object.prototype;
|
|
3390
|
-
|
|
3391
|
-
function XPathNamespace(pre, ns, p) {
|
|
3392
|
-
this.isXPathNamespace = true;
|
|
3393
|
-
this.ownerDocument = p.ownerDocument;
|
|
3394
|
-
this.nodeName = "#namespace";
|
|
3395
|
-
this.prefix = pre;
|
|
3396
|
-
this.localName = pre;
|
|
3397
|
-
this.namespaceURI = ns;
|
|
3398
|
-
this.nodeValue = ns;
|
|
3399
|
-
this.ownerElement = p;
|
|
3400
|
-
this.nodeType = XPathNamespace.XPATH_NAMESPACE_NODE;
|
|
3401
|
-
}
|
|
3402
|
-
|
|
3403
|
-
XPathNamespace.prototype.toString = function () {
|
|
3404
|
-
return "{ \"" + this.prefix + "\", \"" + this.namespaceURI + "\" }";
|
|
3405
|
-
};
|
|
3406
|
-
|
|
3407
|
-
// XPathContext //////////////////////////////////////////////////////////////
|
|
3408
|
-
|
|
3409
|
-
XPathContext.prototype = new Object();
|
|
3410
|
-
XPathContext.prototype.constructor = XPathContext;
|
|
3411
|
-
XPathContext.superclass = Object.prototype;
|
|
3412
|
-
|
|
3413
|
-
function XPathContext(vr, nr, fr) {
|
|
3414
|
-
this.variableResolver = vr != null ? vr : new VariableResolver();
|
|
3415
|
-
this.namespaceResolver = nr != null ? nr : new NamespaceResolver();
|
|
3416
|
-
this.functionResolver = fr != null ? fr : new FunctionResolver();
|
|
3417
|
-
}
|
|
3418
|
-
|
|
3419
|
-
XPathContext.prototype.extend = function (newProps) {
|
|
3420
|
-
return assign(new XPathContext(), this, newProps);
|
|
3421
|
-
};
|
|
3422
|
-
|
|
3423
|
-
// VariableResolver //////////////////////////////////////////////////////////
|
|
3424
|
-
|
|
3425
|
-
VariableResolver.prototype = new Object();
|
|
3426
|
-
VariableResolver.prototype.constructor = VariableResolver;
|
|
3427
|
-
VariableResolver.superclass = Object.prototype;
|
|
3428
|
-
|
|
3429
|
-
function VariableResolver() {
|
|
3430
|
-
}
|
|
3431
|
-
|
|
3432
|
-
VariableResolver.prototype.getVariable = function (ln, ns) {
|
|
3433
|
-
return null;
|
|
3434
|
-
};
|
|
3435
|
-
|
|
3436
|
-
// FunctionResolver //////////////////////////////////////////////////////////
|
|
3437
|
-
|
|
3438
|
-
FunctionResolver.prototype = new Object();
|
|
3439
|
-
FunctionResolver.prototype.constructor = FunctionResolver;
|
|
3440
|
-
FunctionResolver.superclass = Object.prototype;
|
|
3441
|
-
|
|
3442
|
-
function FunctionResolver(thisArg) {
|
|
3443
|
-
this.thisArg = thisArg != null ? thisArg : Functions;
|
|
3444
|
-
this.functions = new Object();
|
|
3445
|
-
this.addStandardFunctions();
|
|
3446
|
-
}
|
|
3447
|
-
|
|
3448
|
-
FunctionResolver.prototype.addStandardFunctions = function () {
|
|
3449
|
-
this.functions["{}last"] = Functions.last;
|
|
3450
|
-
this.functions["{}position"] = Functions.position;
|
|
3451
|
-
this.functions["{}count"] = Functions.count;
|
|
3452
|
-
this.functions["{}id"] = Functions.id;
|
|
3453
|
-
this.functions["{}local-name"] = Functions.localName;
|
|
3454
|
-
this.functions["{}namespace-uri"] = Functions.namespaceURI;
|
|
3455
|
-
this.functions["{}name"] = Functions.name;
|
|
3456
|
-
this.functions["{}string"] = Functions.string;
|
|
3457
|
-
this.functions["{}concat"] = Functions.concat;
|
|
3458
|
-
this.functions["{}starts-with"] = Functions.startsWith;
|
|
3459
|
-
this.functions["{}contains"] = Functions.contains;
|
|
3460
|
-
this.functions["{}substring-before"] = Functions.substringBefore;
|
|
3461
|
-
this.functions["{}substring-after"] = Functions.substringAfter;
|
|
3462
|
-
this.functions["{}substring"] = Functions.substring;
|
|
3463
|
-
this.functions["{}string-length"] = Functions.stringLength;
|
|
3464
|
-
this.functions["{}normalize-space"] = Functions.normalizeSpace;
|
|
3465
|
-
this.functions["{}translate"] = Functions.translate;
|
|
3466
|
-
this.functions["{}boolean"] = Functions.boolean_;
|
|
3467
|
-
this.functions["{}not"] = Functions.not;
|
|
3468
|
-
this.functions["{}true"] = Functions.true_;
|
|
3469
|
-
this.functions["{}false"] = Functions.false_;
|
|
3470
|
-
this.functions["{}lang"] = Functions.lang;
|
|
3471
|
-
this.functions["{}number"] = Functions.number;
|
|
3472
|
-
this.functions["{}sum"] = Functions.sum;
|
|
3473
|
-
this.functions["{}floor"] = Functions.floor;
|
|
3474
|
-
this.functions["{}ceiling"] = Functions.ceiling;
|
|
3475
|
-
this.functions["{}round"] = Functions.round;
|
|
3476
|
-
};
|
|
3477
|
-
|
|
3478
|
-
FunctionResolver.prototype.addFunction = function (ns, ln, f) {
|
|
3479
|
-
this.functions["{" + ns + "}" + ln] = f;
|
|
3480
|
-
};
|
|
3481
|
-
|
|
3482
|
-
FunctionResolver.getFunctionFromContext = function (qName, context) {
|
|
3483
|
-
var parts = Utilities.resolveQName(qName, context.namespaceResolver, context.contextNode, false);
|
|
3484
|
-
|
|
3485
|
-
if (parts[0] === null) {
|
|
3486
|
-
throw new Error("Cannot resolve QName " + name);
|
|
3487
|
-
}
|
|
3488
|
-
|
|
3489
|
-
return context.functionResolver.getFunction(parts[1], parts[0]);
|
|
3490
|
-
};
|
|
3491
|
-
|
|
3492
|
-
FunctionResolver.prototype.getFunction = function (localName, namespace) {
|
|
3493
|
-
return this.functions["{" + namespace + "}" + localName];
|
|
3494
|
-
};
|
|
3495
|
-
|
|
3496
|
-
// NamespaceResolver /////////////////////////////////////////////////////////
|
|
3497
|
-
|
|
3498
|
-
NamespaceResolver.prototype = new Object();
|
|
3499
|
-
NamespaceResolver.prototype.constructor = NamespaceResolver;
|
|
3500
|
-
NamespaceResolver.superclass = Object.prototype;
|
|
3501
|
-
|
|
3502
|
-
function NamespaceResolver() {
|
|
3503
|
-
}
|
|
3504
|
-
|
|
3505
|
-
NamespaceResolver.prototype.getNamespace = function (prefix, n) {
|
|
3506
|
-
if (prefix == "xml") {
|
|
3507
|
-
return XPath.XML_NAMESPACE_URI;
|
|
3508
|
-
} else if (prefix == "xmlns") {
|
|
3509
|
-
return XPath.XMLNS_NAMESPACE_URI;
|
|
3510
|
-
}
|
|
3511
|
-
if (n.nodeType == NodeTypes.DOCUMENT_NODE) {
|
|
3512
|
-
n = n.documentElement;
|
|
3513
|
-
} else if (n.nodeType == NodeTypes.ATTRIBUTE_NODE) {
|
|
3514
|
-
n = PathExpr.getOwnerElement(n);
|
|
3515
|
-
} else if (n.nodeType != NodeTypes.ELEMENT_NODE) {
|
|
3516
|
-
n = n.parentNode;
|
|
3517
|
-
}
|
|
3518
|
-
while (n != null && n.nodeType == NodeTypes.ELEMENT_NODE) {
|
|
3519
|
-
var nnm = n.attributes;
|
|
3520
|
-
for (var i = 0; i < nnm.length; i++) {
|
|
3521
|
-
var a = nnm.item(i);
|
|
3522
|
-
var aname = a.name || a.nodeName;
|
|
3523
|
-
if ((aname === "xmlns" && prefix === "")
|
|
3524
|
-
|| aname === "xmlns:" + prefix) {
|
|
3525
|
-
return String(a.value || a.nodeValue);
|
|
3526
|
-
}
|
|
3527
|
-
}
|
|
3528
|
-
n = n.parentNode;
|
|
3529
|
-
}
|
|
3530
|
-
return null;
|
|
3531
|
-
};
|
|
3532
|
-
|
|
3533
|
-
// Functions /////////////////////////////////////////////////////////////////
|
|
3534
|
-
|
|
3535
|
-
var Functions = new Object();
|
|
3536
|
-
|
|
3537
|
-
Functions.last = function (c) {
|
|
3538
|
-
if (arguments.length != 1) {
|
|
3539
|
-
throw new Error("Function last expects ()");
|
|
3540
|
-
}
|
|
3541
|
-
|
|
3542
|
-
return new XNumber(c.contextSize);
|
|
3543
|
-
};
|
|
3544
|
-
|
|
3545
|
-
Functions.position = function (c) {
|
|
3546
|
-
if (arguments.length != 1) {
|
|
3547
|
-
throw new Error("Function position expects ()");
|
|
3548
|
-
}
|
|
3549
|
-
|
|
3550
|
-
return new XNumber(c.contextPosition);
|
|
3551
|
-
};
|
|
3552
|
-
|
|
3553
|
-
Functions.count = function () {
|
|
3554
|
-
var c = arguments[0];
|
|
3555
|
-
var ns;
|
|
3556
|
-
if (arguments.length != 2 || !Utilities.instance_of(ns = arguments[1].evaluate(c), XNodeSet)) {
|
|
3557
|
-
throw new Error("Function count expects (node-set)");
|
|
3558
|
-
}
|
|
3559
|
-
return new XNumber(ns.size);
|
|
3560
|
-
};
|
|
3561
|
-
|
|
3562
|
-
Functions.id = function () {
|
|
3563
|
-
var c = arguments[0];
|
|
3564
|
-
var id;
|
|
3565
|
-
if (arguments.length != 2) {
|
|
3566
|
-
throw new Error("Function id expects (object)");
|
|
3567
|
-
}
|
|
3568
|
-
id = arguments[1].evaluate(c);
|
|
3569
|
-
if (Utilities.instance_of(id, XNodeSet)) {
|
|
3570
|
-
id = id.toArray().join(" ");
|
|
3571
|
-
} else {
|
|
3572
|
-
id = id.stringValue();
|
|
3573
|
-
}
|
|
3574
|
-
var ids = id.split(/[\x0d\x0a\x09\x20]+/);
|
|
3575
|
-
var count = 0;
|
|
3576
|
-
var ns = new XNodeSet();
|
|
3577
|
-
var doc = c.contextNode.nodeType == NodeTypes.DOCUMENT_NODE
|
|
3578
|
-
? c.contextNode
|
|
3579
|
-
: c.contextNode.ownerDocument;
|
|
3580
|
-
for (var i = 0; i < ids.length; i++) {
|
|
3581
|
-
var n;
|
|
3582
|
-
if (doc.getElementById) {
|
|
3583
|
-
n = doc.getElementById(ids[i]);
|
|
3584
|
-
} else {
|
|
3585
|
-
n = Utilities.getElementById(doc, ids[i]);
|
|
3586
|
-
}
|
|
3587
|
-
if (n != null) {
|
|
3588
|
-
ns.add(n);
|
|
3589
|
-
count++;
|
|
3590
|
-
}
|
|
3591
|
-
}
|
|
3592
|
-
return ns;
|
|
3593
|
-
};
|
|
3594
|
-
|
|
3595
|
-
Functions.localName = function (c, eNode) {
|
|
3596
|
-
var n;
|
|
3597
|
-
|
|
3598
|
-
if (arguments.length == 1) {
|
|
3599
|
-
n = c.contextNode;
|
|
3600
|
-
} else if (arguments.length == 2) {
|
|
3601
|
-
n = eNode.evaluate(c).first();
|
|
3602
|
-
} else {
|
|
3603
|
-
throw new Error("Function local-name expects (node-set?)");
|
|
3604
|
-
}
|
|
3605
|
-
|
|
3606
|
-
if (n == null) {
|
|
3607
|
-
return new XString("");
|
|
3608
|
-
}
|
|
3609
|
-
|
|
3610
|
-
return new XString(
|
|
3611
|
-
n.localName || // standard elements and attributes
|
|
3612
|
-
n.baseName || // IE
|
|
3613
|
-
n.target || // processing instructions
|
|
3614
|
-
n.nodeName || // DOM1 elements
|
|
3615
|
-
"" // fallback
|
|
3616
|
-
);
|
|
3617
|
-
};
|
|
3618
|
-
|
|
3619
|
-
Functions.namespaceURI = function () {
|
|
3620
|
-
var c = arguments[0];
|
|
3621
|
-
var n;
|
|
3622
|
-
if (arguments.length == 1) {
|
|
3623
|
-
n = c.contextNode;
|
|
3624
|
-
} else if (arguments.length == 2) {
|
|
3625
|
-
n = arguments[1].evaluate(c).first();
|
|
3626
|
-
} else {
|
|
3627
|
-
throw new Error("Function namespace-uri expects (node-set?)");
|
|
3628
|
-
}
|
|
3629
|
-
if (n == null) {
|
|
3630
|
-
return new XString("");
|
|
3631
|
-
}
|
|
3632
|
-
return new XString(n.namespaceURI);
|
|
3633
|
-
};
|
|
3634
|
-
|
|
3635
|
-
Functions.name = function () {
|
|
3636
|
-
var c = arguments[0];
|
|
3637
|
-
var n;
|
|
3638
|
-
if (arguments.length == 1) {
|
|
3639
|
-
n = c.contextNode;
|
|
3640
|
-
} else if (arguments.length == 2) {
|
|
3641
|
-
n = arguments[1].evaluate(c).first();
|
|
3642
|
-
} else {
|
|
3643
|
-
throw new Error("Function name expects (node-set?)");
|
|
3644
|
-
}
|
|
3645
|
-
if (n == null) {
|
|
3646
|
-
return new XString("");
|
|
3647
|
-
}
|
|
3648
|
-
if (n.nodeType == NodeTypes.ELEMENT_NODE) {
|
|
3649
|
-
return new XString(n.nodeName);
|
|
3650
|
-
} else if (n.nodeType == NodeTypes.ATTRIBUTE_NODE) {
|
|
3651
|
-
return new XString(n.name || n.nodeName);
|
|
3652
|
-
} else if (n.nodeType === NodeTypes.PROCESSING_INSTRUCTION_NODE) {
|
|
3653
|
-
return new XString(n.target || n.nodeName);
|
|
3654
|
-
} else if (n.localName == null) {
|
|
3655
|
-
return new XString("");
|
|
3656
|
-
} else {
|
|
3657
|
-
return new XString(n.localName);
|
|
3658
|
-
}
|
|
3659
|
-
};
|
|
3660
|
-
|
|
3661
|
-
Functions.string = function () {
|
|
3662
|
-
var c = arguments[0];
|
|
3663
|
-
if (arguments.length == 1) {
|
|
3664
|
-
return new XString(XNodeSet.prototype.stringForNode(c.contextNode));
|
|
3665
|
-
} else if (arguments.length == 2) {
|
|
3666
|
-
return arguments[1].evaluate(c).string();
|
|
3667
|
-
}
|
|
3668
|
-
throw new Error("Function string expects (object?)");
|
|
3669
|
-
};
|
|
3670
|
-
|
|
3671
|
-
Functions.concat = function (c) {
|
|
3672
|
-
if (arguments.length < 3) {
|
|
3673
|
-
throw new Error("Function concat expects (string, string[, string]*)");
|
|
3674
|
-
}
|
|
3675
|
-
var s = "";
|
|
3676
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
3677
|
-
s += arguments[i].evaluate(c).stringValue();
|
|
3678
|
-
}
|
|
3679
|
-
return new XString(s);
|
|
3680
|
-
};
|
|
3681
|
-
|
|
3682
|
-
Functions.startsWith = function () {
|
|
3683
|
-
var c = arguments[0];
|
|
3684
|
-
if (arguments.length != 3) {
|
|
3685
|
-
throw new Error("Function startsWith expects (string, string)");
|
|
3686
|
-
}
|
|
3687
|
-
var s1 = arguments[1].evaluate(c).stringValue();
|
|
3688
|
-
var s2 = arguments[2].evaluate(c).stringValue();
|
|
3689
|
-
return new XBoolean(s1.substring(0, s2.length) == s2);
|
|
3690
|
-
};
|
|
3691
|
-
|
|
3692
|
-
Functions.contains = function () {
|
|
3693
|
-
var c = arguments[0];
|
|
3694
|
-
if (arguments.length != 3) {
|
|
3695
|
-
throw new Error("Function contains expects (string, string)");
|
|
3696
|
-
}
|
|
3697
|
-
var s1 = arguments[1].evaluate(c).stringValue();
|
|
3698
|
-
var s2 = arguments[2].evaluate(c).stringValue();
|
|
3699
|
-
return new XBoolean(s1.indexOf(s2) !== -1);
|
|
3700
|
-
};
|
|
3701
|
-
|
|
3702
|
-
Functions.substringBefore = function () {
|
|
3703
|
-
var c = arguments[0];
|
|
3704
|
-
if (arguments.length != 3) {
|
|
3705
|
-
throw new Error("Function substring-before expects (string, string)");
|
|
3706
|
-
}
|
|
3707
|
-
var s1 = arguments[1].evaluate(c).stringValue();
|
|
3708
|
-
var s2 = arguments[2].evaluate(c).stringValue();
|
|
3709
|
-
return new XString(s1.substring(0, s1.indexOf(s2)));
|
|
3710
|
-
};
|
|
3711
|
-
|
|
3712
|
-
Functions.substringAfter = function () {
|
|
3713
|
-
var c = arguments[0];
|
|
3714
|
-
if (arguments.length != 3) {
|
|
3715
|
-
throw new Error("Function substring-after expects (string, string)");
|
|
3716
|
-
}
|
|
3717
|
-
var s1 = arguments[1].evaluate(c).stringValue();
|
|
3718
|
-
var s2 = arguments[2].evaluate(c).stringValue();
|
|
3719
|
-
if (s2.length == 0) {
|
|
3720
|
-
return new XString(s1);
|
|
3721
|
-
}
|
|
3722
|
-
var i = s1.indexOf(s2);
|
|
3723
|
-
if (i == -1) {
|
|
3724
|
-
return new XString("");
|
|
3725
|
-
}
|
|
3726
|
-
return new XString(s1.substring(i + s2.length));
|
|
3727
|
-
};
|
|
3728
|
-
|
|
3729
|
-
Functions.substring = function () {
|
|
3730
|
-
var c = arguments[0];
|
|
3731
|
-
if (!(arguments.length == 3 || arguments.length == 4)) {
|
|
3732
|
-
throw new Error("Function substring expects (string, number, number?)");
|
|
3733
|
-
}
|
|
3734
|
-
var s = arguments[1].evaluate(c).stringValue();
|
|
3735
|
-
var n1 = Math.round(arguments[2].evaluate(c).numberValue()) - 1;
|
|
3736
|
-
var n2 = arguments.length == 4 ? n1 + Math.round(arguments[3].evaluate(c).numberValue()) : undefined;
|
|
3737
|
-
return new XString(s.substring(n1, n2));
|
|
3738
|
-
};
|
|
3739
|
-
|
|
3740
|
-
Functions.stringLength = function () {
|
|
3741
|
-
var c = arguments[0];
|
|
3742
|
-
var s;
|
|
3743
|
-
if (arguments.length == 1) {
|
|
3744
|
-
s = XNodeSet.prototype.stringForNode(c.contextNode);
|
|
3745
|
-
} else if (arguments.length == 2) {
|
|
3746
|
-
s = arguments[1].evaluate(c).stringValue();
|
|
3747
|
-
} else {
|
|
3748
|
-
throw new Error("Function string-length expects (string?)");
|
|
3749
|
-
}
|
|
3750
|
-
return new XNumber(s.length);
|
|
3751
|
-
};
|
|
3752
|
-
|
|
3753
|
-
Functions.normalizeSpace = function () {
|
|
3754
|
-
var c = arguments[0];
|
|
3755
|
-
var s;
|
|
3756
|
-
if (arguments.length == 1) {
|
|
3757
|
-
s = XNodeSet.prototype.stringForNode(c.contextNode);
|
|
3758
|
-
} else if (arguments.length == 2) {
|
|
3759
|
-
s = arguments[1].evaluate(c).stringValue();
|
|
3760
|
-
} else {
|
|
3761
|
-
throw new Error("Function normalize-space expects (string?)");
|
|
3762
|
-
}
|
|
3763
|
-
var i = 0;
|
|
3764
|
-
var j = s.length - 1;
|
|
3765
|
-
while (Utilities.isSpace(s.charCodeAt(j))) {
|
|
3766
|
-
j--;
|
|
3767
|
-
}
|
|
3768
|
-
var t = "";
|
|
3769
|
-
while (i <= j && Utilities.isSpace(s.charCodeAt(i))) {
|
|
3770
|
-
i++;
|
|
3771
|
-
}
|
|
3772
|
-
while (i <= j) {
|
|
3773
|
-
if (Utilities.isSpace(s.charCodeAt(i))) {
|
|
3774
|
-
t += " ";
|
|
3775
|
-
while (i <= j && Utilities.isSpace(s.charCodeAt(i))) {
|
|
3776
|
-
i++;
|
|
3777
|
-
}
|
|
3778
|
-
} else {
|
|
3779
|
-
t += s.charAt(i);
|
|
3780
|
-
i++;
|
|
3781
|
-
}
|
|
3782
|
-
}
|
|
3783
|
-
return new XString(t);
|
|
3784
|
-
};
|
|
3785
|
-
|
|
3786
|
-
Functions.translate = function (c, eValue, eFrom, eTo) {
|
|
3787
|
-
if (arguments.length != 4) {
|
|
3788
|
-
throw new Error("Function translate expects (string, string, string)");
|
|
3789
|
-
}
|
|
3790
|
-
|
|
3791
|
-
var value = eValue.evaluate(c).stringValue();
|
|
3792
|
-
var from = eFrom.evaluate(c).stringValue();
|
|
3793
|
-
var to = eTo.evaluate(c).stringValue();
|
|
3794
|
-
|
|
3795
|
-
var cMap = reduce(function (acc, ch, i) {
|
|
3796
|
-
if (!(ch in acc)) {
|
|
3797
|
-
acc[ch] = i > to.length ? '' : to[i];
|
|
3798
|
-
}
|
|
3799
|
-
return acc;
|
|
3800
|
-
}, {}, from);
|
|
3801
|
-
|
|
3802
|
-
var t = join(
|
|
3803
|
-
'',
|
|
3804
|
-
map(function (ch) {
|
|
3805
|
-
return ch in cMap ? cMap[ch] : ch;
|
|
3806
|
-
}, value)
|
|
3807
|
-
);
|
|
3808
|
-
|
|
3809
|
-
return new XString(t);
|
|
3810
|
-
};
|
|
3811
|
-
|
|
3812
|
-
Functions.boolean_ = function () {
|
|
3813
|
-
var c = arguments[0];
|
|
3814
|
-
if (arguments.length != 2) {
|
|
3815
|
-
throw new Error("Function boolean expects (object)");
|
|
3816
|
-
}
|
|
3817
|
-
return arguments[1].evaluate(c).bool();
|
|
3818
|
-
};
|
|
3819
|
-
|
|
3820
|
-
Functions.not = function (c, eValue) {
|
|
3821
|
-
if (arguments.length != 2) {
|
|
3822
|
-
throw new Error("Function not expects (object)");
|
|
3823
|
-
}
|
|
3824
|
-
return eValue.evaluate(c).bool().not();
|
|
3825
|
-
};
|
|
3826
|
-
|
|
3827
|
-
Functions.true_ = function () {
|
|
3828
|
-
if (arguments.length != 1) {
|
|
3829
|
-
throw new Error("Function true expects ()");
|
|
3830
|
-
}
|
|
3831
|
-
return XBoolean.true_;
|
|
3832
|
-
};
|
|
3833
|
-
|
|
3834
|
-
Functions.false_ = function () {
|
|
3835
|
-
if (arguments.length != 1) {
|
|
3836
|
-
throw new Error("Function false expects ()");
|
|
3837
|
-
}
|
|
3838
|
-
return XBoolean.false_;
|
|
3839
|
-
};
|
|
3840
|
-
|
|
3841
|
-
Functions.lang = function () {
|
|
3842
|
-
var c = arguments[0];
|
|
3843
|
-
if (arguments.length != 2) {
|
|
3844
|
-
throw new Error("Function lang expects (string)");
|
|
3845
|
-
}
|
|
3846
|
-
var lang;
|
|
3847
|
-
for (var n = c.contextNode; n != null && n.nodeType != NodeTypes.DOCUMENT_NODE; n = n.parentNode) {
|
|
3848
|
-
var a = n.getAttributeNS(XPath.XML_NAMESPACE_URI, "lang");
|
|
3849
|
-
if (a != null) {
|
|
3850
|
-
lang = String(a);
|
|
3851
|
-
break;
|
|
3852
|
-
}
|
|
3853
|
-
}
|
|
3854
|
-
if (lang == null) {
|
|
3855
|
-
return XBoolean.false_;
|
|
3856
|
-
}
|
|
3857
|
-
var s = arguments[1].evaluate(c).stringValue();
|
|
3858
|
-
return new XBoolean(lang.substring(0, s.length) == s
|
|
3859
|
-
&& (lang.length == s.length || lang.charAt(s.length) == '-'));
|
|
3860
|
-
};
|
|
3861
|
-
|
|
3862
|
-
Functions.number = function () {
|
|
3863
|
-
var c = arguments[0];
|
|
3864
|
-
if (!(arguments.length == 1 || arguments.length == 2)) {
|
|
3865
|
-
throw new Error("Function number expects (object?)");
|
|
3866
|
-
}
|
|
3867
|
-
if (arguments.length == 1) {
|
|
3868
|
-
return new XNumber(XNodeSet.prototype.stringForNode(c.contextNode));
|
|
3869
|
-
}
|
|
3870
|
-
return arguments[1].evaluate(c).number();
|
|
3871
|
-
};
|
|
3872
|
-
|
|
3873
|
-
Functions.sum = function () {
|
|
3874
|
-
var c = arguments[0];
|
|
3875
|
-
var ns;
|
|
3876
|
-
if (arguments.length != 2 || !Utilities.instance_of((ns = arguments[1].evaluate(c)), XNodeSet)) {
|
|
3877
|
-
throw new Error("Function sum expects (node-set)");
|
|
3878
|
-
}
|
|
3879
|
-
ns = ns.toUnsortedArray();
|
|
3880
|
-
var n = 0;
|
|
3881
|
-
for (var i = 0; i < ns.length; i++) {
|
|
3882
|
-
n += new XNumber(XNodeSet.prototype.stringForNode(ns[i])).numberValue();
|
|
3883
|
-
}
|
|
3884
|
-
return new XNumber(n);
|
|
3885
|
-
};
|
|
3886
|
-
|
|
3887
|
-
Functions.floor = function () {
|
|
3888
|
-
var c = arguments[0];
|
|
3889
|
-
if (arguments.length != 2) {
|
|
3890
|
-
throw new Error("Function floor expects (number)");
|
|
3891
|
-
}
|
|
3892
|
-
return new XNumber(Math.floor(arguments[1].evaluate(c).numberValue()));
|
|
3893
|
-
};
|
|
3894
|
-
|
|
3895
|
-
Functions.ceiling = function () {
|
|
3896
|
-
var c = arguments[0];
|
|
3897
|
-
if (arguments.length != 2) {
|
|
3898
|
-
throw new Error("Function ceiling expects (number)");
|
|
3899
|
-
}
|
|
3900
|
-
return new XNumber(Math.ceil(arguments[1].evaluate(c).numberValue()));
|
|
3901
|
-
};
|
|
3902
|
-
|
|
3903
|
-
Functions.round = function () {
|
|
3904
|
-
var c = arguments[0];
|
|
3905
|
-
if (arguments.length != 2) {
|
|
3906
|
-
throw new Error("Function round expects (number)");
|
|
3907
|
-
}
|
|
3908
|
-
return new XNumber(Math.round(arguments[1].evaluate(c).numberValue()));
|
|
3909
|
-
};
|
|
3910
|
-
|
|
3911
|
-
// Utilities /////////////////////////////////////////////////////////////////
|
|
3912
|
-
|
|
3913
|
-
var Utilities = new Object();
|
|
3914
|
-
|
|
3915
|
-
Utilities.isAttribute = function (val) {
|
|
3916
|
-
return val && (val.nodeType === NodeTypes.ATTRIBUTE_NODE || val.ownerElement);
|
|
3917
|
-
}
|
|
3918
|
-
|
|
3919
|
-
Utilities.splitQName = function (qn) {
|
|
3920
|
-
var i = qn.indexOf(":");
|
|
3921
|
-
if (i == -1) {
|
|
3922
|
-
return [null, qn];
|
|
3923
|
-
}
|
|
3924
|
-
return [qn.substring(0, i), qn.substring(i + 1)];
|
|
3925
|
-
};
|
|
3926
|
-
|
|
3927
|
-
Utilities.resolveQName = function (qn, nr, n, useDefault) {
|
|
3928
|
-
var parts = Utilities.splitQName(qn);
|
|
3929
|
-
if (parts[0] != null) {
|
|
3930
|
-
parts[0] = nr.getNamespace(parts[0], n);
|
|
3931
|
-
} else {
|
|
3932
|
-
if (useDefault) {
|
|
3933
|
-
parts[0] = nr.getNamespace("", n);
|
|
3934
|
-
if (parts[0] == null) {
|
|
3935
|
-
parts[0] = "";
|
|
3936
|
-
}
|
|
3937
|
-
} else {
|
|
3938
|
-
parts[0] = "";
|
|
3939
|
-
}
|
|
3940
|
-
}
|
|
3941
|
-
return parts;
|
|
3942
|
-
};
|
|
3943
|
-
|
|
3944
|
-
Utilities.isSpace = function (c) {
|
|
3945
|
-
return c == 0x9 || c == 0xd || c == 0xa || c == 0x20;
|
|
3946
|
-
};
|
|
3947
|
-
|
|
3948
|
-
Utilities.isLetter = function (c) {
|
|
3949
|
-
return c >= 0x0041 && c <= 0x005A ||
|
|
3950
|
-
c >= 0x0061 && c <= 0x007A ||
|
|
3951
|
-
c >= 0x00C0 && c <= 0x00D6 ||
|
|
3952
|
-
c >= 0x00D8 && c <= 0x00F6 ||
|
|
3953
|
-
c >= 0x00F8 && c <= 0x00FF ||
|
|
3954
|
-
c >= 0x0100 && c <= 0x0131 ||
|
|
3955
|
-
c >= 0x0134 && c <= 0x013E ||
|
|
3956
|
-
c >= 0x0141 && c <= 0x0148 ||
|
|
3957
|
-
c >= 0x014A && c <= 0x017E ||
|
|
3958
|
-
c >= 0x0180 && c <= 0x01C3 ||
|
|
3959
|
-
c >= 0x01CD && c <= 0x01F0 ||
|
|
3960
|
-
c >= 0x01F4 && c <= 0x01F5 ||
|
|
3961
|
-
c >= 0x01FA && c <= 0x0217 ||
|
|
3962
|
-
c >= 0x0250 && c <= 0x02A8 ||
|
|
3963
|
-
c >= 0x02BB && c <= 0x02C1 ||
|
|
3964
|
-
c == 0x0386 ||
|
|
3965
|
-
c >= 0x0388 && c <= 0x038A ||
|
|
3966
|
-
c == 0x038C ||
|
|
3967
|
-
c >= 0x038E && c <= 0x03A1 ||
|
|
3968
|
-
c >= 0x03A3 && c <= 0x03CE ||
|
|
3969
|
-
c >= 0x03D0 && c <= 0x03D6 ||
|
|
3970
|
-
c == 0x03DA ||
|
|
3971
|
-
c == 0x03DC ||
|
|
3972
|
-
c == 0x03DE ||
|
|
3973
|
-
c == 0x03E0 ||
|
|
3974
|
-
c >= 0x03E2 && c <= 0x03F3 ||
|
|
3975
|
-
c >= 0x0401 && c <= 0x040C ||
|
|
3976
|
-
c >= 0x040E && c <= 0x044F ||
|
|
3977
|
-
c >= 0x0451 && c <= 0x045C ||
|
|
3978
|
-
c >= 0x045E && c <= 0x0481 ||
|
|
3979
|
-
c >= 0x0490 && c <= 0x04C4 ||
|
|
3980
|
-
c >= 0x04C7 && c <= 0x04C8 ||
|
|
3981
|
-
c >= 0x04CB && c <= 0x04CC ||
|
|
3982
|
-
c >= 0x04D0 && c <= 0x04EB ||
|
|
3983
|
-
c >= 0x04EE && c <= 0x04F5 ||
|
|
3984
|
-
c >= 0x04F8 && c <= 0x04F9 ||
|
|
3985
|
-
c >= 0x0531 && c <= 0x0556 ||
|
|
3986
|
-
c == 0x0559 ||
|
|
3987
|
-
c >= 0x0561 && c <= 0x0586 ||
|
|
3988
|
-
c >= 0x05D0 && c <= 0x05EA ||
|
|
3989
|
-
c >= 0x05F0 && c <= 0x05F2 ||
|
|
3990
|
-
c >= 0x0621 && c <= 0x063A ||
|
|
3991
|
-
c >= 0x0641 && c <= 0x064A ||
|
|
3992
|
-
c >= 0x0671 && c <= 0x06B7 ||
|
|
3993
|
-
c >= 0x06BA && c <= 0x06BE ||
|
|
3994
|
-
c >= 0x06C0 && c <= 0x06CE ||
|
|
3995
|
-
c >= 0x06D0 && c <= 0x06D3 ||
|
|
3996
|
-
c == 0x06D5 ||
|
|
3997
|
-
c >= 0x06E5 && c <= 0x06E6 ||
|
|
3998
|
-
c >= 0x0905 && c <= 0x0939 ||
|
|
3999
|
-
c == 0x093D ||
|
|
4000
|
-
c >= 0x0958 && c <= 0x0961 ||
|
|
4001
|
-
c >= 0x0985 && c <= 0x098C ||
|
|
4002
|
-
c >= 0x098F && c <= 0x0990 ||
|
|
4003
|
-
c >= 0x0993 && c <= 0x09A8 ||
|
|
4004
|
-
c >= 0x09AA && c <= 0x09B0 ||
|
|
4005
|
-
c == 0x09B2 ||
|
|
4006
|
-
c >= 0x09B6 && c <= 0x09B9 ||
|
|
4007
|
-
c >= 0x09DC && c <= 0x09DD ||
|
|
4008
|
-
c >= 0x09DF && c <= 0x09E1 ||
|
|
4009
|
-
c >= 0x09F0 && c <= 0x09F1 ||
|
|
4010
|
-
c >= 0x0A05 && c <= 0x0A0A ||
|
|
4011
|
-
c >= 0x0A0F && c <= 0x0A10 ||
|
|
4012
|
-
c >= 0x0A13 && c <= 0x0A28 ||
|
|
4013
|
-
c >= 0x0A2A && c <= 0x0A30 ||
|
|
4014
|
-
c >= 0x0A32 && c <= 0x0A33 ||
|
|
4015
|
-
c >= 0x0A35 && c <= 0x0A36 ||
|
|
4016
|
-
c >= 0x0A38 && c <= 0x0A39 ||
|
|
4017
|
-
c >= 0x0A59 && c <= 0x0A5C ||
|
|
4018
|
-
c == 0x0A5E ||
|
|
4019
|
-
c >= 0x0A72 && c <= 0x0A74 ||
|
|
4020
|
-
c >= 0x0A85 && c <= 0x0A8B ||
|
|
4021
|
-
c == 0x0A8D ||
|
|
4022
|
-
c >= 0x0A8F && c <= 0x0A91 ||
|
|
4023
|
-
c >= 0x0A93 && c <= 0x0AA8 ||
|
|
4024
|
-
c >= 0x0AAA && c <= 0x0AB0 ||
|
|
4025
|
-
c >= 0x0AB2 && c <= 0x0AB3 ||
|
|
4026
|
-
c >= 0x0AB5 && c <= 0x0AB9 ||
|
|
4027
|
-
c == 0x0ABD ||
|
|
4028
|
-
c == 0x0AE0 ||
|
|
4029
|
-
c >= 0x0B05 && c <= 0x0B0C ||
|
|
4030
|
-
c >= 0x0B0F && c <= 0x0B10 ||
|
|
4031
|
-
c >= 0x0B13 && c <= 0x0B28 ||
|
|
4032
|
-
c >= 0x0B2A && c <= 0x0B30 ||
|
|
4033
|
-
c >= 0x0B32 && c <= 0x0B33 ||
|
|
4034
|
-
c >= 0x0B36 && c <= 0x0B39 ||
|
|
4035
|
-
c == 0x0B3D ||
|
|
4036
|
-
c >= 0x0B5C && c <= 0x0B5D ||
|
|
4037
|
-
c >= 0x0B5F && c <= 0x0B61 ||
|
|
4038
|
-
c >= 0x0B85 && c <= 0x0B8A ||
|
|
4039
|
-
c >= 0x0B8E && c <= 0x0B90 ||
|
|
4040
|
-
c >= 0x0B92 && c <= 0x0B95 ||
|
|
4041
|
-
c >= 0x0B99 && c <= 0x0B9A ||
|
|
4042
|
-
c == 0x0B9C ||
|
|
4043
|
-
c >= 0x0B9E && c <= 0x0B9F ||
|
|
4044
|
-
c >= 0x0BA3 && c <= 0x0BA4 ||
|
|
4045
|
-
c >= 0x0BA8 && c <= 0x0BAA ||
|
|
4046
|
-
c >= 0x0BAE && c <= 0x0BB5 ||
|
|
4047
|
-
c >= 0x0BB7 && c <= 0x0BB9 ||
|
|
4048
|
-
c >= 0x0C05 && c <= 0x0C0C ||
|
|
4049
|
-
c >= 0x0C0E && c <= 0x0C10 ||
|
|
4050
|
-
c >= 0x0C12 && c <= 0x0C28 ||
|
|
4051
|
-
c >= 0x0C2A && c <= 0x0C33 ||
|
|
4052
|
-
c >= 0x0C35 && c <= 0x0C39 ||
|
|
4053
|
-
c >= 0x0C60 && c <= 0x0C61 ||
|
|
4054
|
-
c >= 0x0C85 && c <= 0x0C8C ||
|
|
4055
|
-
c >= 0x0C8E && c <= 0x0C90 ||
|
|
4056
|
-
c >= 0x0C92 && c <= 0x0CA8 ||
|
|
4057
|
-
c >= 0x0CAA && c <= 0x0CB3 ||
|
|
4058
|
-
c >= 0x0CB5 && c <= 0x0CB9 ||
|
|
4059
|
-
c == 0x0CDE ||
|
|
4060
|
-
c >= 0x0CE0 && c <= 0x0CE1 ||
|
|
4061
|
-
c >= 0x0D05 && c <= 0x0D0C ||
|
|
4062
|
-
c >= 0x0D0E && c <= 0x0D10 ||
|
|
4063
|
-
c >= 0x0D12 && c <= 0x0D28 ||
|
|
4064
|
-
c >= 0x0D2A && c <= 0x0D39 ||
|
|
4065
|
-
c >= 0x0D60 && c <= 0x0D61 ||
|
|
4066
|
-
c >= 0x0E01 && c <= 0x0E2E ||
|
|
4067
|
-
c == 0x0E30 ||
|
|
4068
|
-
c >= 0x0E32 && c <= 0x0E33 ||
|
|
4069
|
-
c >= 0x0E40 && c <= 0x0E45 ||
|
|
4070
|
-
c >= 0x0E81 && c <= 0x0E82 ||
|
|
4071
|
-
c == 0x0E84 ||
|
|
4072
|
-
c >= 0x0E87 && c <= 0x0E88 ||
|
|
4073
|
-
c == 0x0E8A ||
|
|
4074
|
-
c == 0x0E8D ||
|
|
4075
|
-
c >= 0x0E94 && c <= 0x0E97 ||
|
|
4076
|
-
c >= 0x0E99 && c <= 0x0E9F ||
|
|
4077
|
-
c >= 0x0EA1 && c <= 0x0EA3 ||
|
|
4078
|
-
c == 0x0EA5 ||
|
|
4079
|
-
c == 0x0EA7 ||
|
|
4080
|
-
c >= 0x0EAA && c <= 0x0EAB ||
|
|
4081
|
-
c >= 0x0EAD && c <= 0x0EAE ||
|
|
4082
|
-
c == 0x0EB0 ||
|
|
4083
|
-
c >= 0x0EB2 && c <= 0x0EB3 ||
|
|
4084
|
-
c == 0x0EBD ||
|
|
4085
|
-
c >= 0x0EC0 && c <= 0x0EC4 ||
|
|
4086
|
-
c >= 0x0F40 && c <= 0x0F47 ||
|
|
4087
|
-
c >= 0x0F49 && c <= 0x0F69 ||
|
|
4088
|
-
c >= 0x10A0 && c <= 0x10C5 ||
|
|
4089
|
-
c >= 0x10D0 && c <= 0x10F6 ||
|
|
4090
|
-
c == 0x1100 ||
|
|
4091
|
-
c >= 0x1102 && c <= 0x1103 ||
|
|
4092
|
-
c >= 0x1105 && c <= 0x1107 ||
|
|
4093
|
-
c == 0x1109 ||
|
|
4094
|
-
c >= 0x110B && c <= 0x110C ||
|
|
4095
|
-
c >= 0x110E && c <= 0x1112 ||
|
|
4096
|
-
c == 0x113C ||
|
|
4097
|
-
c == 0x113E ||
|
|
4098
|
-
c == 0x1140 ||
|
|
4099
|
-
c == 0x114C ||
|
|
4100
|
-
c == 0x114E ||
|
|
4101
|
-
c == 0x1150 ||
|
|
4102
|
-
c >= 0x1154 && c <= 0x1155 ||
|
|
4103
|
-
c == 0x1159 ||
|
|
4104
|
-
c >= 0x115F && c <= 0x1161 ||
|
|
4105
|
-
c == 0x1163 ||
|
|
4106
|
-
c == 0x1165 ||
|
|
4107
|
-
c == 0x1167 ||
|
|
4108
|
-
c == 0x1169 ||
|
|
4109
|
-
c >= 0x116D && c <= 0x116E ||
|
|
4110
|
-
c >= 0x1172 && c <= 0x1173 ||
|
|
4111
|
-
c == 0x1175 ||
|
|
4112
|
-
c == 0x119E ||
|
|
4113
|
-
c == 0x11A8 ||
|
|
4114
|
-
c == 0x11AB ||
|
|
4115
|
-
c >= 0x11AE && c <= 0x11AF ||
|
|
4116
|
-
c >= 0x11B7 && c <= 0x11B8 ||
|
|
4117
|
-
c == 0x11BA ||
|
|
4118
|
-
c >= 0x11BC && c <= 0x11C2 ||
|
|
4119
|
-
c == 0x11EB ||
|
|
4120
|
-
c == 0x11F0 ||
|
|
4121
|
-
c == 0x11F9 ||
|
|
4122
|
-
c >= 0x1E00 && c <= 0x1E9B ||
|
|
4123
|
-
c >= 0x1EA0 && c <= 0x1EF9 ||
|
|
4124
|
-
c >= 0x1F00 && c <= 0x1F15 ||
|
|
4125
|
-
c >= 0x1F18 && c <= 0x1F1D ||
|
|
4126
|
-
c >= 0x1F20 && c <= 0x1F45 ||
|
|
4127
|
-
c >= 0x1F48 && c <= 0x1F4D ||
|
|
4128
|
-
c >= 0x1F50 && c <= 0x1F57 ||
|
|
4129
|
-
c == 0x1F59 ||
|
|
4130
|
-
c == 0x1F5B ||
|
|
4131
|
-
c == 0x1F5D ||
|
|
4132
|
-
c >= 0x1F5F && c <= 0x1F7D ||
|
|
4133
|
-
c >= 0x1F80 && c <= 0x1FB4 ||
|
|
4134
|
-
c >= 0x1FB6 && c <= 0x1FBC ||
|
|
4135
|
-
c == 0x1FBE ||
|
|
4136
|
-
c >= 0x1FC2 && c <= 0x1FC4 ||
|
|
4137
|
-
c >= 0x1FC6 && c <= 0x1FCC ||
|
|
4138
|
-
c >= 0x1FD0 && c <= 0x1FD3 ||
|
|
4139
|
-
c >= 0x1FD6 && c <= 0x1FDB ||
|
|
4140
|
-
c >= 0x1FE0 && c <= 0x1FEC ||
|
|
4141
|
-
c >= 0x1FF2 && c <= 0x1FF4 ||
|
|
4142
|
-
c >= 0x1FF6 && c <= 0x1FFC ||
|
|
4143
|
-
c == 0x2126 ||
|
|
4144
|
-
c >= 0x212A && c <= 0x212B ||
|
|
4145
|
-
c == 0x212E ||
|
|
4146
|
-
c >= 0x2180 && c <= 0x2182 ||
|
|
4147
|
-
c >= 0x3041 && c <= 0x3094 ||
|
|
4148
|
-
c >= 0x30A1 && c <= 0x30FA ||
|
|
4149
|
-
c >= 0x3105 && c <= 0x312C ||
|
|
4150
|
-
c >= 0xAC00 && c <= 0xD7A3 ||
|
|
4151
|
-
c >= 0x4E00 && c <= 0x9FA5 ||
|
|
4152
|
-
c == 0x3007 ||
|
|
4153
|
-
c >= 0x3021 && c <= 0x3029;
|
|
4154
|
-
};
|
|
4155
|
-
|
|
4156
|
-
Utilities.isNCNameChar = function (c) {
|
|
4157
|
-
return c >= 0x0030 && c <= 0x0039
|
|
4158
|
-
|| c >= 0x0660 && c <= 0x0669
|
|
4159
|
-
|| c >= 0x06F0 && c <= 0x06F9
|
|
4160
|
-
|| c >= 0x0966 && c <= 0x096F
|
|
4161
|
-
|| c >= 0x09E6 && c <= 0x09EF
|
|
4162
|
-
|| c >= 0x0A66 && c <= 0x0A6F
|
|
4163
|
-
|| c >= 0x0AE6 && c <= 0x0AEF
|
|
4164
|
-
|| c >= 0x0B66 && c <= 0x0B6F
|
|
4165
|
-
|| c >= 0x0BE7 && c <= 0x0BEF
|
|
4166
|
-
|| c >= 0x0C66 && c <= 0x0C6F
|
|
4167
|
-
|| c >= 0x0CE6 && c <= 0x0CEF
|
|
4168
|
-
|| c >= 0x0D66 && c <= 0x0D6F
|
|
4169
|
-
|| c >= 0x0E50 && c <= 0x0E59
|
|
4170
|
-
|| c >= 0x0ED0 && c <= 0x0ED9
|
|
4171
|
-
|| c >= 0x0F20 && c <= 0x0F29
|
|
4172
|
-
|| c == 0x002E
|
|
4173
|
-
|| c == 0x002D
|
|
4174
|
-
|| c == 0x005F
|
|
4175
|
-
|| Utilities.isLetter(c)
|
|
4176
|
-
|| c >= 0x0300 && c <= 0x0345
|
|
4177
|
-
|| c >= 0x0360 && c <= 0x0361
|
|
4178
|
-
|| c >= 0x0483 && c <= 0x0486
|
|
4179
|
-
|| c >= 0x0591 && c <= 0x05A1
|
|
4180
|
-
|| c >= 0x05A3 && c <= 0x05B9
|
|
4181
|
-
|| c >= 0x05BB && c <= 0x05BD
|
|
4182
|
-
|| c == 0x05BF
|
|
4183
|
-
|| c >= 0x05C1 && c <= 0x05C2
|
|
4184
|
-
|| c == 0x05C4
|
|
4185
|
-
|| c >= 0x064B && c <= 0x0652
|
|
4186
|
-
|| c == 0x0670
|
|
4187
|
-
|| c >= 0x06D6 && c <= 0x06DC
|
|
4188
|
-
|| c >= 0x06DD && c <= 0x06DF
|
|
4189
|
-
|| c >= 0x06E0 && c <= 0x06E4
|
|
4190
|
-
|| c >= 0x06E7 && c <= 0x06E8
|
|
4191
|
-
|| c >= 0x06EA && c <= 0x06ED
|
|
4192
|
-
|| c >= 0x0901 && c <= 0x0903
|
|
4193
|
-
|| c == 0x093C
|
|
4194
|
-
|| c >= 0x093E && c <= 0x094C
|
|
4195
|
-
|| c == 0x094D
|
|
4196
|
-
|| c >= 0x0951 && c <= 0x0954
|
|
4197
|
-
|| c >= 0x0962 && c <= 0x0963
|
|
4198
|
-
|| c >= 0x0981 && c <= 0x0983
|
|
4199
|
-
|| c == 0x09BC
|
|
4200
|
-
|| c == 0x09BE
|
|
4201
|
-
|| c == 0x09BF
|
|
4202
|
-
|| c >= 0x09C0 && c <= 0x09C4
|
|
4203
|
-
|| c >= 0x09C7 && c <= 0x09C8
|
|
4204
|
-
|| c >= 0x09CB && c <= 0x09CD
|
|
4205
|
-
|| c == 0x09D7
|
|
4206
|
-
|| c >= 0x09E2 && c <= 0x09E3
|
|
4207
|
-
|| c == 0x0A02
|
|
4208
|
-
|| c == 0x0A3C
|
|
4209
|
-
|| c == 0x0A3E
|
|
4210
|
-
|| c == 0x0A3F
|
|
4211
|
-
|| c >= 0x0A40 && c <= 0x0A42
|
|
4212
|
-
|| c >= 0x0A47 && c <= 0x0A48
|
|
4213
|
-
|| c >= 0x0A4B && c <= 0x0A4D
|
|
4214
|
-
|| c >= 0x0A70 && c <= 0x0A71
|
|
4215
|
-
|| c >= 0x0A81 && c <= 0x0A83
|
|
4216
|
-
|| c == 0x0ABC
|
|
4217
|
-
|| c >= 0x0ABE && c <= 0x0AC5
|
|
4218
|
-
|| c >= 0x0AC7 && c <= 0x0AC9
|
|
4219
|
-
|| c >= 0x0ACB && c <= 0x0ACD
|
|
4220
|
-
|| c >= 0x0B01 && c <= 0x0B03
|
|
4221
|
-
|| c == 0x0B3C
|
|
4222
|
-
|| c >= 0x0B3E && c <= 0x0B43
|
|
4223
|
-
|| c >= 0x0B47 && c <= 0x0B48
|
|
4224
|
-
|| c >= 0x0B4B && c <= 0x0B4D
|
|
4225
|
-
|| c >= 0x0B56 && c <= 0x0B57
|
|
4226
|
-
|| c >= 0x0B82 && c <= 0x0B83
|
|
4227
|
-
|| c >= 0x0BBE && c <= 0x0BC2
|
|
4228
|
-
|| c >= 0x0BC6 && c <= 0x0BC8
|
|
4229
|
-
|| c >= 0x0BCA && c <= 0x0BCD
|
|
4230
|
-
|| c == 0x0BD7
|
|
4231
|
-
|| c >= 0x0C01 && c <= 0x0C03
|
|
4232
|
-
|| c >= 0x0C3E && c <= 0x0C44
|
|
4233
|
-
|| c >= 0x0C46 && c <= 0x0C48
|
|
4234
|
-
|| c >= 0x0C4A && c <= 0x0C4D
|
|
4235
|
-
|| c >= 0x0C55 && c <= 0x0C56
|
|
4236
|
-
|| c >= 0x0C82 && c <= 0x0C83
|
|
4237
|
-
|| c >= 0x0CBE && c <= 0x0CC4
|
|
4238
|
-
|| c >= 0x0CC6 && c <= 0x0CC8
|
|
4239
|
-
|| c >= 0x0CCA && c <= 0x0CCD
|
|
4240
|
-
|| c >= 0x0CD5 && c <= 0x0CD6
|
|
4241
|
-
|| c >= 0x0D02 && c <= 0x0D03
|
|
4242
|
-
|| c >= 0x0D3E && c <= 0x0D43
|
|
4243
|
-
|| c >= 0x0D46 && c <= 0x0D48
|
|
4244
|
-
|| c >= 0x0D4A && c <= 0x0D4D
|
|
4245
|
-
|| c == 0x0D57
|
|
4246
|
-
|| c == 0x0E31
|
|
4247
|
-
|| c >= 0x0E34 && c <= 0x0E3A
|
|
4248
|
-
|| c >= 0x0E47 && c <= 0x0E4E
|
|
4249
|
-
|| c == 0x0EB1
|
|
4250
|
-
|| c >= 0x0EB4 && c <= 0x0EB9
|
|
4251
|
-
|| c >= 0x0EBB && c <= 0x0EBC
|
|
4252
|
-
|| c >= 0x0EC8 && c <= 0x0ECD
|
|
4253
|
-
|| c >= 0x0F18 && c <= 0x0F19
|
|
4254
|
-
|| c == 0x0F35
|
|
4255
|
-
|| c == 0x0F37
|
|
4256
|
-
|| c == 0x0F39
|
|
4257
|
-
|| c == 0x0F3E
|
|
4258
|
-
|| c == 0x0F3F
|
|
4259
|
-
|| c >= 0x0F71 && c <= 0x0F84
|
|
4260
|
-
|| c >= 0x0F86 && c <= 0x0F8B
|
|
4261
|
-
|| c >= 0x0F90 && c <= 0x0F95
|
|
4262
|
-
|| c == 0x0F97
|
|
4263
|
-
|| c >= 0x0F99 && c <= 0x0FAD
|
|
4264
|
-
|| c >= 0x0FB1 && c <= 0x0FB7
|
|
4265
|
-
|| c == 0x0FB9
|
|
4266
|
-
|| c >= 0x20D0 && c <= 0x20DC
|
|
4267
|
-
|| c == 0x20E1
|
|
4268
|
-
|| c >= 0x302A && c <= 0x302F
|
|
4269
|
-
|| c == 0x3099
|
|
4270
|
-
|| c == 0x309A
|
|
4271
|
-
|| c == 0x00B7
|
|
4272
|
-
|| c == 0x02D0
|
|
4273
|
-
|| c == 0x02D1
|
|
4274
|
-
|| c == 0x0387
|
|
4275
|
-
|| c == 0x0640
|
|
4276
|
-
|| c == 0x0E46
|
|
4277
|
-
|| c == 0x0EC6
|
|
4278
|
-
|| c == 0x3005
|
|
4279
|
-
|| c >= 0x3031 && c <= 0x3035
|
|
4280
|
-
|| c >= 0x309D && c <= 0x309E
|
|
4281
|
-
|| c >= 0x30FC && c <= 0x30FE;
|
|
4282
|
-
};
|
|
4283
|
-
|
|
4284
|
-
Utilities.coalesceText = function (n) {
|
|
4285
|
-
for (var m = n.firstChild; m != null; m = m.nextSibling) {
|
|
4286
|
-
if (m.nodeType == NodeTypes.TEXT_NODE || m.nodeType == NodeTypes.CDATA_SECTION_NODE) {
|
|
4287
|
-
var s = m.nodeValue;
|
|
4288
|
-
var first = m;
|
|
4289
|
-
m = m.nextSibling;
|
|
4290
|
-
while (m != null && (m.nodeType == NodeTypes.TEXT_NODE || m.nodeType == NodeTypes.CDATA_SECTION_NODE)) {
|
|
4291
|
-
s += m.nodeValue;
|
|
4292
|
-
var del = m;
|
|
4293
|
-
m = m.nextSibling;
|
|
4294
|
-
del.parentNode.removeChild(del);
|
|
4295
|
-
}
|
|
4296
|
-
if (first.nodeType == NodeTypes.CDATA_SECTION_NODE) {
|
|
4297
|
-
var p = first.parentNode;
|
|
4298
|
-
if (first.nextSibling == null) {
|
|
4299
|
-
p.removeChild(first);
|
|
4300
|
-
p.appendChild(p.ownerDocument.createTextNode(s));
|
|
4301
|
-
} else {
|
|
4302
|
-
var next = first.nextSibling;
|
|
4303
|
-
p.removeChild(first);
|
|
4304
|
-
p.insertBefore(p.ownerDocument.createTextNode(s), next);
|
|
4305
|
-
}
|
|
4306
|
-
} else {
|
|
4307
|
-
first.nodeValue = s;
|
|
4308
|
-
}
|
|
4309
|
-
if (m == null) {
|
|
4310
|
-
break;
|
|
4311
|
-
}
|
|
4312
|
-
} else if (m.nodeType == NodeTypes.ELEMENT_NODE) {
|
|
4313
|
-
Utilities.coalesceText(m);
|
|
4314
|
-
}
|
|
4315
|
-
}
|
|
4316
|
-
};
|
|
4317
|
-
|
|
4318
|
-
Utilities.instance_of = function (o, c) {
|
|
4319
|
-
while (o != null) {
|
|
4320
|
-
if (o.constructor === c) {
|
|
4321
|
-
return true;
|
|
4322
|
-
}
|
|
4323
|
-
if (o === Object) {
|
|
4324
|
-
return false;
|
|
4325
|
-
}
|
|
4326
|
-
o = o.constructor.superclass;
|
|
4327
|
-
}
|
|
4328
|
-
return false;
|
|
4329
|
-
};
|
|
4330
|
-
|
|
4331
|
-
Utilities.getElementById = function (n, id) {
|
|
4332
|
-
// Note that this does not check the DTD to check for actual
|
|
4333
|
-
// attributes of type ID, so this may be a bit wrong.
|
|
4334
|
-
if (n.nodeType == NodeTypes.ELEMENT_NODE) {
|
|
4335
|
-
if (n.getAttribute("id") == id
|
|
4336
|
-
|| n.getAttributeNS(null, "id") == id) {
|
|
4337
|
-
return n;
|
|
4338
|
-
}
|
|
4339
|
-
}
|
|
4340
|
-
for (var m = n.firstChild; m != null; m = m.nextSibling) {
|
|
4341
|
-
var res = Utilities.getElementById(m, id);
|
|
4342
|
-
if (res != null) {
|
|
4343
|
-
return res;
|
|
4344
|
-
}
|
|
4345
|
-
}
|
|
4346
|
-
return null;
|
|
4347
|
-
};
|
|
4348
|
-
|
|
4349
|
-
// XPathException ////////////////////////////////////////////////////////////
|
|
4350
|
-
|
|
4351
|
-
var XPathException = (function () {
|
|
4352
|
-
function getMessage(code, exception) {
|
|
4353
|
-
var msg = exception ? ": " + exception.toString() : "";
|
|
4354
|
-
switch (code) {
|
|
4355
|
-
case XPathException.INVALID_EXPRESSION_ERR:
|
|
4356
|
-
return "Invalid expression" + msg;
|
|
4357
|
-
case XPathException.TYPE_ERR:
|
|
4358
|
-
return "Type error" + msg;
|
|
4359
|
-
}
|
|
4360
|
-
return null;
|
|
4361
|
-
}
|
|
4362
|
-
|
|
4363
|
-
function XPathException(code, error, message) {
|
|
4364
|
-
var err = Error.call(this, getMessage(code, error) || message);
|
|
4365
|
-
|
|
4366
|
-
err.code = code;
|
|
4367
|
-
err.exception = error;
|
|
4368
|
-
|
|
4369
|
-
return err;
|
|
4370
|
-
}
|
|
4371
|
-
|
|
4372
|
-
XPathException.prototype = Object.create(Error.prototype);
|
|
4373
|
-
XPathException.prototype.constructor = XPathException;
|
|
4374
|
-
XPathException.superclass = Error;
|
|
4375
|
-
|
|
4376
|
-
XPathException.prototype.toString = function () {
|
|
4377
|
-
return this.message;
|
|
4378
|
-
};
|
|
4379
|
-
|
|
4380
|
-
XPathException.fromMessage = function (message, error) {
|
|
4381
|
-
return new XPathException(null, error, message);
|
|
4382
|
-
};
|
|
4383
|
-
|
|
4384
|
-
XPathException.INVALID_EXPRESSION_ERR = 51;
|
|
4385
|
-
XPathException.TYPE_ERR = 52;
|
|
4386
|
-
|
|
4387
|
-
return XPathException;
|
|
4388
|
-
})();
|
|
4389
|
-
|
|
4390
|
-
// XPathExpression ///////////////////////////////////////////////////////////
|
|
4391
|
-
|
|
4392
|
-
XPathExpression.prototype = {};
|
|
4393
|
-
XPathExpression.prototype.constructor = XPathExpression;
|
|
4394
|
-
XPathExpression.superclass = Object.prototype;
|
|
4395
|
-
|
|
4396
|
-
function XPathExpression(e, r, p) {
|
|
4397
|
-
this.xpath = p.parse(e);
|
|
4398
|
-
this.context = new XPathContext();
|
|
4399
|
-
this.context.namespaceResolver = new XPathNSResolverWrapper(r);
|
|
4400
|
-
}
|
|
4401
|
-
|
|
4402
|
-
XPathExpression.getOwnerDocument = function (n) {
|
|
4403
|
-
return n.nodeType === NodeTypes.DOCUMENT_NODE ? n : n.ownerDocument;
|
|
4404
|
-
}
|
|
4405
|
-
|
|
4406
|
-
XPathExpression.detectHtmlDom = function (n) {
|
|
4407
|
-
if (!n) { return false; }
|
|
4408
|
-
|
|
4409
|
-
var doc = XPathExpression.getOwnerDocument(n);
|
|
4410
|
-
|
|
4411
|
-
try {
|
|
4412
|
-
return doc.implementation.hasFeature("HTML", "2.0");
|
|
4413
|
-
} catch (e) {
|
|
4414
|
-
return true;
|
|
4415
|
-
}
|
|
4416
|
-
}
|
|
4417
|
-
|
|
4418
|
-
XPathExpression.prototype.evaluate = function (n, t, res) {
|
|
4419
|
-
this.context.expressionContextNode = n;
|
|
4420
|
-
// backward compatibility - no reliable way to detect whether the DOM is HTML, but
|
|
4421
|
-
// this library has been using this method up until now, so we will continue to use it
|
|
4422
|
-
// ONLY when using an XPathExpression
|
|
4423
|
-
this.context.caseInsensitive = XPathExpression.detectHtmlDom(n);
|
|
4424
|
-
|
|
4425
|
-
var result = this.xpath.evaluate(this.context);
|
|
4426
|
-
return new XPathResult(result, t);
|
|
4427
|
-
}
|
|
4428
|
-
|
|
4429
|
-
// XPathNSResolverWrapper ////////////////////////////////////////////////////
|
|
4430
|
-
|
|
4431
|
-
XPathNSResolverWrapper.prototype = {};
|
|
4432
|
-
XPathNSResolverWrapper.prototype.constructor = XPathNSResolverWrapper;
|
|
4433
|
-
XPathNSResolverWrapper.superclass = Object.prototype;
|
|
4434
|
-
|
|
4435
|
-
function XPathNSResolverWrapper(r) {
|
|
4436
|
-
this.xpathNSResolver = r;
|
|
4437
|
-
}
|
|
4438
|
-
|
|
4439
|
-
XPathNSResolverWrapper.prototype.getNamespace = function (prefix, n) {
|
|
4440
|
-
if (this.xpathNSResolver == null) {
|
|
4441
|
-
return null;
|
|
4442
|
-
}
|
|
4443
|
-
return this.xpathNSResolver.lookupNamespaceURI(prefix);
|
|
4444
|
-
};
|
|
4445
|
-
|
|
4446
|
-
// NodeXPathNSResolver ///////////////////////////////////////////////////////
|
|
4447
|
-
|
|
4448
|
-
NodeXPathNSResolver.prototype = {};
|
|
4449
|
-
NodeXPathNSResolver.prototype.constructor = NodeXPathNSResolver;
|
|
4450
|
-
NodeXPathNSResolver.superclass = Object.prototype;
|
|
4451
|
-
|
|
4452
|
-
function NodeXPathNSResolver(n) {
|
|
4453
|
-
this.node = n;
|
|
4454
|
-
this.namespaceResolver = new NamespaceResolver();
|
|
4455
|
-
}
|
|
4456
|
-
|
|
4457
|
-
NodeXPathNSResolver.prototype.lookupNamespaceURI = function (prefix) {
|
|
4458
|
-
return this.namespaceResolver.getNamespace(prefix, this.node);
|
|
4459
|
-
};
|
|
4460
|
-
|
|
4461
|
-
// XPathResult ///////////////////////////////////////////////////////////////
|
|
4462
|
-
|
|
4463
|
-
XPathResult.prototype = {};
|
|
4464
|
-
XPathResult.prototype.constructor = XPathResult;
|
|
4465
|
-
XPathResult.superclass = Object.prototype;
|
|
4466
|
-
|
|
4467
|
-
function XPathResult(v, t) {
|
|
4468
|
-
if (t == XPathResult.ANY_TYPE) {
|
|
4469
|
-
if (v.constructor === XString) {
|
|
4470
|
-
t = XPathResult.STRING_TYPE;
|
|
4471
|
-
} else if (v.constructor === XNumber) {
|
|
4472
|
-
t = XPathResult.NUMBER_TYPE;
|
|
4473
|
-
} else if (v.constructor === XBoolean) {
|
|
4474
|
-
t = XPathResult.BOOLEAN_TYPE;
|
|
4475
|
-
} else if (v.constructor === XNodeSet) {
|
|
4476
|
-
t = XPathResult.UNORDERED_NODE_ITERATOR_TYPE;
|
|
4477
|
-
}
|
|
4478
|
-
}
|
|
4479
|
-
this.resultType = t;
|
|
4480
|
-
switch (t) {
|
|
4481
|
-
case XPathResult.NUMBER_TYPE:
|
|
4482
|
-
this.numberValue = v.numberValue();
|
|
4483
|
-
return;
|
|
4484
|
-
case XPathResult.STRING_TYPE:
|
|
4485
|
-
this.stringValue = v.stringValue();
|
|
4486
|
-
return;
|
|
4487
|
-
case XPathResult.BOOLEAN_TYPE:
|
|
4488
|
-
this.booleanValue = v.booleanValue();
|
|
4489
|
-
return;
|
|
4490
|
-
case XPathResult.ANY_UNORDERED_NODE_TYPE:
|
|
4491
|
-
case XPathResult.FIRST_ORDERED_NODE_TYPE:
|
|
4492
|
-
if (v.constructor === XNodeSet) {
|
|
4493
|
-
this.singleNodeValue = v.first();
|
|
4494
|
-
return;
|
|
4495
|
-
}
|
|
4496
|
-
break;
|
|
4497
|
-
case XPathResult.UNORDERED_NODE_ITERATOR_TYPE:
|
|
4498
|
-
case XPathResult.ORDERED_NODE_ITERATOR_TYPE:
|
|
4499
|
-
if (v.constructor === XNodeSet) {
|
|
4500
|
-
this.invalidIteratorState = false;
|
|
4501
|
-
this.nodes = v.toArray();
|
|
4502
|
-
this.iteratorIndex = 0;
|
|
4503
|
-
return;
|
|
4504
|
-
}
|
|
4505
|
-
break;
|
|
4506
|
-
case XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE:
|
|
4507
|
-
case XPathResult.ORDERED_NODE_SNAPSHOT_TYPE:
|
|
4508
|
-
if (v.constructor === XNodeSet) {
|
|
4509
|
-
this.nodes = v.toArray();
|
|
4510
|
-
this.snapshotLength = this.nodes.length;
|
|
4511
|
-
return;
|
|
4512
|
-
}
|
|
4513
|
-
break;
|
|
4514
|
-
}
|
|
4515
|
-
throw new XPathException(XPathException.TYPE_ERR);
|
|
4516
|
-
};
|
|
4517
|
-
|
|
4518
|
-
XPathResult.prototype.iterateNext = function () {
|
|
4519
|
-
if (this.resultType != XPathResult.UNORDERED_NODE_ITERATOR_TYPE
|
|
4520
|
-
&& this.resultType != XPathResult.ORDERED_NODE_ITERATOR_TYPE) {
|
|
4521
|
-
throw new XPathException(XPathException.TYPE_ERR);
|
|
4522
|
-
}
|
|
4523
|
-
return this.nodes[this.iteratorIndex++];
|
|
4524
|
-
};
|
|
4525
|
-
|
|
4526
|
-
XPathResult.prototype.snapshotItem = function (i) {
|
|
4527
|
-
if (this.resultType != XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE
|
|
4528
|
-
&& this.resultType != XPathResult.ORDERED_NODE_SNAPSHOT_TYPE) {
|
|
4529
|
-
throw new XPathException(XPathException.TYPE_ERR);
|
|
4530
|
-
}
|
|
4531
|
-
return this.nodes[i];
|
|
4532
|
-
};
|
|
4533
|
-
|
|
4534
|
-
XPathResult.ANY_TYPE = 0;
|
|
4535
|
-
XPathResult.NUMBER_TYPE = 1;
|
|
4536
|
-
XPathResult.STRING_TYPE = 2;
|
|
4537
|
-
XPathResult.BOOLEAN_TYPE = 3;
|
|
4538
|
-
XPathResult.UNORDERED_NODE_ITERATOR_TYPE = 4;
|
|
4539
|
-
XPathResult.ORDERED_NODE_ITERATOR_TYPE = 5;
|
|
4540
|
-
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE = 6;
|
|
4541
|
-
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE = 7;
|
|
4542
|
-
XPathResult.ANY_UNORDERED_NODE_TYPE = 8;
|
|
4543
|
-
XPathResult.FIRST_ORDERED_NODE_TYPE = 9;
|
|
4544
|
-
|
|
4545
|
-
// DOM 3 XPath support ///////////////////////////////////////////////////////
|
|
4546
|
-
|
|
4547
|
-
function installDOM3XPathSupport(doc, p) {
|
|
4548
|
-
doc.createExpression = function (e, r) {
|
|
4549
|
-
try {
|
|
4550
|
-
return new XPathExpression(e, r, p);
|
|
4551
|
-
} catch (e) {
|
|
4552
|
-
throw new XPathException(XPathException.INVALID_EXPRESSION_ERR, e);
|
|
4553
|
-
}
|
|
4554
|
-
};
|
|
4555
|
-
doc.createNSResolver = function (n) {
|
|
4556
|
-
return new NodeXPathNSResolver(n);
|
|
4557
|
-
};
|
|
4558
|
-
doc.evaluate = function (e, cn, r, t, res) {
|
|
4559
|
-
if (t < 0 || t > 9) {
|
|
4560
|
-
throw { code: 0, toString: function () { return "Request type not supported"; } };
|
|
4561
|
-
}
|
|
4562
|
-
return doc.createExpression(e, r, p).evaluate(cn, t, res);
|
|
4563
|
-
};
|
|
4564
|
-
};
|
|
4565
|
-
|
|
4566
|
-
// ---------------------------------------------------------------------------
|
|
4567
|
-
|
|
4568
|
-
// Install DOM 3 XPath support for the current document.
|
|
4569
|
-
try {
|
|
4570
|
-
var shouldInstall = true;
|
|
4571
|
-
try {
|
|
4572
|
-
if (document.implementation
|
|
4573
|
-
&& document.implementation.hasFeature
|
|
4574
|
-
&& document.implementation.hasFeature("XPath", null)) {
|
|
4575
|
-
shouldInstall = false;
|
|
4576
|
-
}
|
|
4577
|
-
} catch (e) {
|
|
4578
|
-
}
|
|
4579
|
-
if (shouldInstall) {
|
|
4580
|
-
installDOM3XPathSupport(document, new XPathParser());
|
|
4581
|
-
}
|
|
4582
|
-
} catch (e) {
|
|
4583
|
-
}
|
|
4584
|
-
|
|
4585
|
-
// ---------------------------------------------------------------------------
|
|
4586
|
-
// exports for node.js
|
|
4587
|
-
|
|
4588
|
-
installDOM3XPathSupport(exports, new XPathParser());
|
|
4589
|
-
|
|
4590
|
-
(function () {
|
|
4591
|
-
var parser = new XPathParser();
|
|
4592
|
-
|
|
4593
|
-
var defaultNSResolver = new NamespaceResolver();
|
|
4594
|
-
var defaultFunctionResolver = new FunctionResolver();
|
|
4595
|
-
var defaultVariableResolver = new VariableResolver();
|
|
4596
|
-
|
|
4597
|
-
function makeNSResolverFromFunction(func) {
|
|
4598
|
-
return {
|
|
4599
|
-
getNamespace: function (prefix, node) {
|
|
4600
|
-
var ns = func(prefix, node);
|
|
4601
|
-
|
|
4602
|
-
return ns || defaultNSResolver.getNamespace(prefix, node);
|
|
4603
|
-
}
|
|
4604
|
-
};
|
|
4605
|
-
}
|
|
4606
|
-
|
|
4607
|
-
function makeNSResolverFromObject(obj) {
|
|
4608
|
-
return makeNSResolverFromFunction(obj.getNamespace.bind(obj));
|
|
4609
|
-
}
|
|
4610
|
-
|
|
4611
|
-
function makeNSResolverFromMap(map) {
|
|
4612
|
-
return makeNSResolverFromFunction(function (prefix) {
|
|
4613
|
-
return map[prefix];
|
|
4614
|
-
});
|
|
4615
|
-
}
|
|
4616
|
-
|
|
4617
|
-
function makeNSResolver(resolver) {
|
|
4618
|
-
if (resolver && typeof resolver.getNamespace === "function") {
|
|
4619
|
-
return makeNSResolverFromObject(resolver);
|
|
4620
|
-
}
|
|
4621
|
-
|
|
4622
|
-
if (typeof resolver === "function") {
|
|
4623
|
-
return makeNSResolverFromFunction(resolver);
|
|
4624
|
-
}
|
|
4625
|
-
|
|
4626
|
-
// assume prefix -> uri mapping
|
|
4627
|
-
if (typeof resolver === "object") {
|
|
4628
|
-
return makeNSResolverFromMap(resolver);
|
|
4629
|
-
}
|
|
4630
|
-
|
|
4631
|
-
return defaultNSResolver;
|
|
4632
|
-
}
|
|
4633
|
-
|
|
4634
|
-
/** Converts native JavaScript types to their XPath library equivalent */
|
|
4635
|
-
function convertValue(value) {
|
|
4636
|
-
if (value === null ||
|
|
4637
|
-
typeof value === "undefined" ||
|
|
4638
|
-
value instanceof XString ||
|
|
4639
|
-
value instanceof XBoolean ||
|
|
4640
|
-
value instanceof XNumber ||
|
|
4641
|
-
value instanceof XNodeSet) {
|
|
4642
|
-
return value;
|
|
4643
|
-
}
|
|
4644
|
-
|
|
4645
|
-
switch (typeof value) {
|
|
4646
|
-
case "string": return new XString(value);
|
|
4647
|
-
case "boolean": return new XBoolean(value);
|
|
4648
|
-
case "number": return new XNumber(value);
|
|
4649
|
-
}
|
|
4650
|
-
|
|
4651
|
-
// assume node(s)
|
|
4652
|
-
var ns = new XNodeSet();
|
|
4653
|
-
ns.addArray([].concat(value));
|
|
4654
|
-
return ns;
|
|
4655
|
-
}
|
|
4656
|
-
|
|
4657
|
-
function makeEvaluator(func) {
|
|
4658
|
-
return function (context) {
|
|
4659
|
-
var args = Array.prototype.slice.call(arguments, 1).map(function (arg) {
|
|
4660
|
-
return arg.evaluate(context);
|
|
4661
|
-
});
|
|
4662
|
-
var result = func.apply(this, [].concat(context, args));
|
|
4663
|
-
return convertValue(result);
|
|
4664
|
-
};
|
|
4665
|
-
}
|
|
4666
|
-
|
|
4667
|
-
function makeFunctionResolverFromFunction(func) {
|
|
4668
|
-
return {
|
|
4669
|
-
getFunction: function (name, namespace) {
|
|
4670
|
-
var found = func(name, namespace);
|
|
4671
|
-
if (found) {
|
|
4672
|
-
return makeEvaluator(found);
|
|
4673
|
-
}
|
|
4674
|
-
return defaultFunctionResolver.getFunction(name, namespace);
|
|
4675
|
-
}
|
|
4676
|
-
};
|
|
4677
|
-
}
|
|
4678
|
-
|
|
4679
|
-
function makeFunctionResolverFromObject(obj) {
|
|
4680
|
-
return makeFunctionResolverFromFunction(obj.getFunction.bind(obj));
|
|
4681
|
-
}
|
|
4682
|
-
|
|
4683
|
-
function makeFunctionResolverFromMap(map) {
|
|
4684
|
-
return makeFunctionResolverFromFunction(function (name) {
|
|
4685
|
-
return map[name];
|
|
4686
|
-
});
|
|
4687
|
-
}
|
|
4688
|
-
|
|
4689
|
-
function makeFunctionResolver(resolver) {
|
|
4690
|
-
if (resolver && typeof resolver.getFunction === "function") {
|
|
4691
|
-
return makeFunctionResolverFromObject(resolver);
|
|
4692
|
-
}
|
|
4693
|
-
|
|
4694
|
-
if (typeof resolver === "function") {
|
|
4695
|
-
return makeFunctionResolverFromFunction(resolver);
|
|
4696
|
-
}
|
|
4697
|
-
|
|
4698
|
-
// assume map
|
|
4699
|
-
if (typeof resolver === "object") {
|
|
4700
|
-
return makeFunctionResolverFromMap(resolver);
|
|
4701
|
-
}
|
|
4702
|
-
|
|
4703
|
-
return defaultFunctionResolver;
|
|
4704
|
-
}
|
|
4705
|
-
|
|
4706
|
-
function makeVariableResolverFromFunction(func) {
|
|
4707
|
-
return {
|
|
4708
|
-
getVariable: function (name, namespace) {
|
|
4709
|
-
var value = func(name, namespace);
|
|
4710
|
-
return convertValue(value);
|
|
4711
|
-
}
|
|
4712
|
-
};
|
|
4713
|
-
}
|
|
4714
|
-
|
|
4715
|
-
function makeVariableResolver(resolver) {
|
|
4716
|
-
if (resolver) {
|
|
4717
|
-
if (typeof resolver.getVariable === "function") {
|
|
4718
|
-
return makeVariableResolverFromFunction(resolver.getVariable.bind(resolver));
|
|
4719
|
-
}
|
|
4720
|
-
|
|
4721
|
-
if (typeof resolver === "function") {
|
|
4722
|
-
return makeVariableResolverFromFunction(resolver);
|
|
4723
|
-
}
|
|
4724
|
-
|
|
4725
|
-
// assume map
|
|
4726
|
-
if (typeof resolver === "object") {
|
|
4727
|
-
return makeVariableResolverFromFunction(function (name) {
|
|
4728
|
-
return resolver[name];
|
|
4729
|
-
});
|
|
4730
|
-
}
|
|
4731
|
-
}
|
|
4732
|
-
|
|
4733
|
-
return defaultVariableResolver;
|
|
4734
|
-
}
|
|
4735
|
-
|
|
4736
|
-
function copyIfPresent(prop, dest, source) {
|
|
4737
|
-
if (prop in source) { dest[prop] = source[prop]; }
|
|
4738
|
-
}
|
|
4739
|
-
|
|
4740
|
-
function makeContext(options) {
|
|
4741
|
-
var context = new XPathContext();
|
|
4742
|
-
|
|
4743
|
-
if (options) {
|
|
4744
|
-
context.namespaceResolver = makeNSResolver(options.namespaces);
|
|
4745
|
-
context.functionResolver = makeFunctionResolver(options.functions);
|
|
4746
|
-
context.variableResolver = makeVariableResolver(options.variables);
|
|
4747
|
-
context.expressionContextNode = options.node;
|
|
4748
|
-
copyIfPresent('allowAnyNamespaceForNoPrefix', context, options);
|
|
4749
|
-
copyIfPresent('isHtml', context, options);
|
|
4750
|
-
} else {
|
|
4751
|
-
context.namespaceResolver = defaultNSResolver;
|
|
4752
|
-
}
|
|
4753
|
-
|
|
4754
|
-
return context;
|
|
4755
|
-
}
|
|
4756
|
-
|
|
4757
|
-
function evaluate(parsedExpression, options) {
|
|
4758
|
-
var context = makeContext(options);
|
|
4759
|
-
|
|
4760
|
-
return parsedExpression.evaluate(context);
|
|
4761
|
-
}
|
|
4762
|
-
|
|
4763
|
-
var evaluatorPrototype = {
|
|
4764
|
-
evaluate: function (options) {
|
|
4765
|
-
return evaluate(this.expression, options);
|
|
4766
|
-
}
|
|
4767
|
-
|
|
4768
|
-
, evaluateNumber: function (options) {
|
|
4769
|
-
return this.evaluate(options).numberValue();
|
|
4770
|
-
}
|
|
4771
|
-
|
|
4772
|
-
, evaluateString: function (options) {
|
|
4773
|
-
return this.evaluate(options).stringValue();
|
|
4774
|
-
}
|
|
4775
|
-
|
|
4776
|
-
, evaluateBoolean: function (options) {
|
|
4777
|
-
return this.evaluate(options).booleanValue();
|
|
4778
|
-
}
|
|
4779
|
-
|
|
4780
|
-
, evaluateNodeSet: function (options) {
|
|
4781
|
-
return this.evaluate(options).nodeset();
|
|
4782
|
-
}
|
|
4783
|
-
|
|
4784
|
-
, select: function (options) {
|
|
4785
|
-
return this.evaluateNodeSet(options).toArray()
|
|
4786
|
-
}
|
|
4787
|
-
|
|
4788
|
-
, select1: function (options) {
|
|
4789
|
-
return this.select(options)[0];
|
|
4790
|
-
}
|
|
4791
|
-
};
|
|
4792
|
-
|
|
4793
|
-
function parse(xpath) {
|
|
4794
|
-
var parsed = parser.parse(xpath);
|
|
4795
|
-
|
|
4796
|
-
return Object.create(evaluatorPrototype, {
|
|
4797
|
-
expression: {
|
|
4798
|
-
value: parsed
|
|
4799
|
-
}
|
|
4800
|
-
});
|
|
4801
|
-
}
|
|
4802
|
-
|
|
4803
|
-
exports.parse = parse;
|
|
4804
|
-
})();
|
|
4805
|
-
|
|
4806
|
-
assign(
|
|
4807
|
-
exports,
|
|
4808
|
-
{
|
|
4809
|
-
XPath: XPath,
|
|
4810
|
-
XPathParser: XPathParser,
|
|
4811
|
-
XPathResult: XPathResult,
|
|
4812
|
-
|
|
4813
|
-
Step: Step,
|
|
4814
|
-
PathExpr: PathExpr,
|
|
4815
|
-
NodeTest: NodeTest,
|
|
4816
|
-
LocationPath: LocationPath,
|
|
4817
|
-
|
|
4818
|
-
OrOperation: OrOperation,
|
|
4819
|
-
AndOperation: AndOperation,
|
|
4820
|
-
|
|
4821
|
-
BarOperation: BarOperation,
|
|
4822
|
-
|
|
4823
|
-
EqualsOperation: EqualsOperation,
|
|
4824
|
-
NotEqualOperation: NotEqualOperation,
|
|
4825
|
-
LessThanOperation: LessThanOperation,
|
|
4826
|
-
GreaterThanOperation: GreaterThanOperation,
|
|
4827
|
-
LessThanOrEqualOperation: LessThanOrEqualOperation,
|
|
4828
|
-
GreaterThanOrEqualOperation: GreaterThanOrEqualOperation,
|
|
4829
|
-
|
|
4830
|
-
PlusOperation: PlusOperation,
|
|
4831
|
-
MinusOperation: MinusOperation,
|
|
4832
|
-
MultiplyOperation: MultiplyOperation,
|
|
4833
|
-
DivOperation: DivOperation,
|
|
4834
|
-
ModOperation: ModOperation,
|
|
4835
|
-
UnaryMinusOperation: UnaryMinusOperation,
|
|
4836
|
-
|
|
4837
|
-
FunctionCall: FunctionCall,
|
|
4838
|
-
VariableReference: VariableReference,
|
|
4839
|
-
|
|
4840
|
-
XPathContext: XPathContext,
|
|
4841
|
-
|
|
4842
|
-
XNodeSet: XNodeSet,
|
|
4843
|
-
XBoolean: XBoolean,
|
|
4844
|
-
XString: XString,
|
|
4845
|
-
XNumber: XNumber,
|
|
4846
|
-
|
|
4847
|
-
NamespaceResolver: NamespaceResolver,
|
|
4848
|
-
FunctionResolver: FunctionResolver,
|
|
4849
|
-
VariableResolver: VariableResolver,
|
|
4850
|
-
|
|
4851
|
-
Utilities: Utilities,
|
|
4852
|
-
}
|
|
4853
|
-
);
|
|
4854
|
-
|
|
4855
|
-
// helper
|
|
4856
|
-
exports.select = function (e, doc, single) {
|
|
4857
|
-
return exports.selectWithResolver(e, doc, null, single);
|
|
4858
|
-
};
|
|
4859
|
-
|
|
4860
|
-
exports.useNamespaces = function (mappings) {
|
|
4861
|
-
var resolver = {
|
|
4862
|
-
mappings: mappings || {},
|
|
4863
|
-
lookupNamespaceURI: function (prefix) {
|
|
4864
|
-
return this.mappings[prefix];
|
|
4865
|
-
}
|
|
4866
|
-
};
|
|
4867
|
-
|
|
4868
|
-
return function (e, doc, single) {
|
|
4869
|
-
return exports.selectWithResolver(e, doc, resolver, single);
|
|
4870
|
-
};
|
|
4871
|
-
};
|
|
4872
|
-
|
|
4873
|
-
exports.selectWithResolver = function (e, doc, resolver, single) {
|
|
4874
|
-
var expression = new XPathExpression(e, resolver, new XPathParser());
|
|
4875
|
-
var type = XPathResult.ANY_TYPE;
|
|
4876
|
-
|
|
4877
|
-
var result = expression.evaluate(doc, type, null);
|
|
4878
|
-
|
|
4879
|
-
if (result.resultType == XPathResult.STRING_TYPE) {
|
|
4880
|
-
result = result.stringValue;
|
|
4881
|
-
}
|
|
4882
|
-
else if (result.resultType == XPathResult.NUMBER_TYPE) {
|
|
4883
|
-
result = result.numberValue;
|
|
4884
|
-
}
|
|
4885
|
-
else if (result.resultType == XPathResult.BOOLEAN_TYPE) {
|
|
4886
|
-
result = result.booleanValue;
|
|
4887
|
-
}
|
|
4888
|
-
else {
|
|
4889
|
-
result = result.nodes;
|
|
4890
|
-
if (single) {
|
|
4891
|
-
result = result[0];
|
|
4892
|
-
}
|
|
4893
|
-
}
|
|
4894
|
-
|
|
4895
|
-
return result;
|
|
4896
|
-
};
|
|
4897
|
-
|
|
4898
|
-
exports.select1 = function (e, doc) {
|
|
4899
|
-
return exports.select(e, doc, true);
|
|
4900
|
-
};
|
|
4901
|
-
|
|
4902
|
-
var isNodeLike = function (value) {
|
|
4903
|
-
return value
|
|
4904
|
-
&& typeof value.nodeType === "number"
|
|
4905
|
-
&& Number.isInteger(value.nodeType)
|
|
4906
|
-
&& value.nodeType >= 1
|
|
4907
|
-
&& value.nodeType <= 11
|
|
4908
|
-
&& typeof value.nodeName === "string";
|
|
4909
|
-
};
|
|
4910
|
-
|
|
4911
|
-
var isArrayOfNodes = function (value) {
|
|
4912
|
-
return Array.isArray(value) && value.every(isNodeLike);
|
|
4913
|
-
};
|
|
4914
|
-
|
|
4915
|
-
var isNodeOfType = function (type) {
|
|
4916
|
-
return function (value) {
|
|
4917
|
-
return isNodeLike(value) && value.nodeType === type;
|
|
4918
|
-
};
|
|
4919
|
-
};
|
|
4920
|
-
|
|
4921
|
-
assign(
|
|
4922
|
-
exports,
|
|
4923
|
-
{
|
|
4924
|
-
isNodeLike: isNodeLike,
|
|
4925
|
-
isArrayOfNodes: isArrayOfNodes,
|
|
4926
|
-
isElement: isNodeOfType(NodeTypes.ELEMENT_NODE),
|
|
4927
|
-
isAttribute: isNodeOfType(NodeTypes.ATTRIBUTE_NODE),
|
|
4928
|
-
isTextNode: isNodeOfType(NodeTypes.TEXT_NODE),
|
|
4929
|
-
isCDATASection: isNodeOfType(NodeTypes.CDATA_SECTION_NODE),
|
|
4930
|
-
isProcessingInstruction: isNodeOfType(NodeTypes.PROCESSING_INSTRUCTION_NODE),
|
|
4931
|
-
isComment: isNodeOfType(NodeTypes.COMMENT_NODE),
|
|
4932
|
-
isDocumentNode: isNodeOfType(NodeTypes.DOCUMENT_NODE),
|
|
4933
|
-
isDocumentTypeNode: isNodeOfType(NodeTypes.DOCUMENT_TYPE_NODE),
|
|
4934
|
-
isDocumentFragment: isNodeOfType(NodeTypes.DOCUMENT_FRAGMENT_NODE),
|
|
4935
|
-
}
|
|
4936
|
-
);
|
|
4937
|
-
// end non-node wrapper
|
|
4938
|
-
})(xpath);
|