vcdom 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vcdom.rb +29 -0
- data/lib/vcdom/element.rb +1 -1
- data/lib/vcdom/element_ns.rb +37 -34
- metadata +6 -6
- data/lib/vcdom/xpath/evaluative.rb.old +0 -73
data/lib/vcdom.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding : utf-8
|
2
|
+
|
3
|
+
require "vcdom/document"
|
4
|
+
|
5
|
+
# This Module object can be used as {the DOMImplementation object of W3C DOM Core}[http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490].
|
6
|
+
module VCDOM
|
7
|
+
|
8
|
+
# boolean hasFeature(in DOMString feature,
|
9
|
+
# in DOMString version);
|
10
|
+
|
11
|
+
# DocumentType createDocumentType(in DOMString qualifiedName,
|
12
|
+
# in DOMString publicId,
|
13
|
+
# in DOMString systemId)
|
14
|
+
# raises(DOMException);
|
15
|
+
|
16
|
+
# Creates a DOM Document object with its document element.
|
17
|
+
# Now, the vcdom library doesn't support a XML Doctype, so the third argument +doctype+ has no effect.
|
18
|
+
# @return [Document]
|
19
|
+
def self.create_document( namespace_uri, qualified_name, doctype = nil )
|
20
|
+
doc = Document._new()
|
21
|
+
doc << doc.create_element_ns( namespace_uri, qualified_name )
|
22
|
+
end
|
23
|
+
|
24
|
+
# // Introduced in DOM Level 3:
|
25
|
+
# DOMObject getFeature(in DOMString feature,
|
26
|
+
# in DOMString version);
|
27
|
+
# };
|
28
|
+
|
29
|
+
end
|
data/lib/vcdom/element.rb
CHANGED
@@ -36,7 +36,7 @@ module VCDOM
|
|
36
36
|
def append_child( new_child )
|
37
37
|
# ノードのタイプチェックなど
|
38
38
|
if not new_child.is_a? Node then
|
39
|
-
raise ArgumentError.new( "the argument [#{new_child
|
39
|
+
raise ArgumentError.new( "the argument [#{new_child}] is not an object of the expected class." )
|
40
40
|
end
|
41
41
|
# Element, Text, Comment, ProcessingInstruction, CDATASection, EntityReference
|
42
42
|
case new_child.node_type
|
data/lib/vcdom/element_ns.rb
CHANGED
@@ -4,41 +4,44 @@ require "vcdom/node"
|
|
4
4
|
require "vcdom/element"
|
5
5
|
|
6
6
|
module VCDOM
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
alias :node_name :tag_name
|
27
|
-
|
28
|
-
def prefix
|
29
|
-
@prefix.nil? ? nil : @prefix.to_s()
|
30
|
-
end
|
31
|
-
def local_name
|
7
|
+
|
8
|
+
# This class implements {the interface Element of W3C DOM Element}[http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614].
|
9
|
+
# This class (ElementNS) supports a namespace URI, and the class Element doesn't support a namespace URI.
|
10
|
+
class ElementNS < Element
|
11
|
+
|
12
|
+
def initialize( doc, namespace_uri, prefix, local_name ) # :nodoc:
|
13
|
+
super( doc, local_name )
|
14
|
+
@namespace_uri = namespace_uri
|
15
|
+
@prefix = prefix
|
16
|
+
end
|
17
|
+
|
18
|
+
def node_type
|
19
|
+
ELEMENT_NODE
|
20
|
+
end
|
21
|
+
|
22
|
+
def tag_name
|
23
|
+
if @prefix then
|
24
|
+
"#{@prefix.to_s}:#{@local_name.to_s}"
|
25
|
+
else
|
32
26
|
@local_name.to_s()
|
33
27
|
end
|
34
|
-
def namespace_uri
|
35
|
-
@namespace_uri.nil? ? nil : @namespace_uri.to_s()
|
36
|
-
end
|
37
|
-
|
38
|
-
def append_child( new_child )
|
39
|
-
# �m�[�h�̃^�C�v�`�F�b�N�Ȃ�
|
40
|
-
_append_child( new_child )
|
41
|
-
end
|
42
|
-
|
43
28
|
end
|
29
|
+
alias :node_name :tag_name
|
30
|
+
|
31
|
+
def prefix
|
32
|
+
@prefix.nil? ? nil : @prefix.to_s()
|
33
|
+
end
|
34
|
+
def local_name
|
35
|
+
@local_name.to_s()
|
36
|
+
end
|
37
|
+
def namespace_uri
|
38
|
+
@namespace_uri.nil? ? nil : @namespace_uri.to_s()
|
39
|
+
end
|
40
|
+
|
41
|
+
#def append_child( new_child )
|
42
|
+
# _append_child( new_child )
|
43
|
+
#end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
44
47
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- nobuoka
|
@@ -14,11 +14,11 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-04 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
21
|
-
description:
|
21
|
+
description:
|
22
22
|
email: nobuoka@r-definition.com
|
23
23
|
executables: []
|
24
24
|
|
@@ -27,6 +27,7 @@ extensions: []
|
|
27
27
|
extra_rdoc_files:
|
28
28
|
- README.rdoc
|
29
29
|
files:
|
30
|
+
- README.rdoc
|
30
31
|
- lib/vcdom/attr.rb
|
31
32
|
- lib/vcdom/attr_node_map.rb
|
32
33
|
- lib/vcdom/attr_ns.rb
|
@@ -42,7 +43,6 @@ files:
|
|
42
43
|
- lib/vcdom/xml_ls/xml_parser.rb
|
43
44
|
- lib/vcdom/xml_ls/xml_serializer.rb
|
44
45
|
- lib/vcdom/xml_ls.rb
|
45
|
-
- lib/vcdom/xpath/evaluative.rb.old
|
46
46
|
- lib/vcdom/xpath/internal/command.rb
|
47
47
|
- lib/vcdom/xpath/internal/evaluator.rb
|
48
48
|
- lib/vcdom/xpath/internal/expr.rb
|
@@ -54,12 +54,12 @@ files:
|
|
54
54
|
- lib/vcdom/xpath/xpath_ns_resolver.rb
|
55
55
|
- lib/vcdom/xpath/xpath_result.rb
|
56
56
|
- lib/vcdom/xpath.rb
|
57
|
+
- lib/vcdom.rb
|
57
58
|
- test/main_test_1.8.rb.old
|
58
59
|
- test/main_test_1.9.rb.old
|
59
60
|
- test/test_main.rb
|
60
61
|
- test/test_parsing.rb
|
61
62
|
- test/test_xpath.rb
|
62
|
-
- README.rdoc
|
63
63
|
has_rdoc: true
|
64
64
|
homepage:
|
65
65
|
licenses: []
|
@@ -1,73 +0,0 @@
|
|
1
|
-
# coding : utf-8
|
2
|
-
|
3
|
-
module VCDOM
|
4
|
-
module XPath
|
5
|
-
|
6
|
-
module Evaluative
|
7
|
-
|
8
|
-
def create_expression( expression, resolver )
|
9
|
-
end
|
10
|
-
|
11
|
-
def create_ns_resolver( node_resolver )
|
12
|
-
end
|
13
|
-
|
14
|
-
def evaluate( expression, context_node, resolver, type, result )
|
15
|
-
self.create_expression( expression, resolver ).evaluate( context_node, type, result )
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
class Expression
|
21
|
-
def evaluate( context_node, type, result )
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class NSResolver
|
26
|
-
def lookup_namespace_uri( prefix )
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class XPathResult
|
31
|
-
# XPathResultType
|
32
|
-
ANY_TYPE = 0
|
33
|
-
NUMBER_TYPE = 1
|
34
|
-
STRING_TYPE = 2
|
35
|
-
BOOLEAN_TYPE = 3
|
36
|
-
UNORDERED_NODE_ITERATOR_TYPE = 4
|
37
|
-
ORDERED_NODE_ITERATOR_TYPE = 5
|
38
|
-
UNORDERED_NODE_SNAPSHOT_TYPE = 6
|
39
|
-
ORDERED_NODE_SNAPSHOT_TYPE = 7
|
40
|
-
ANY_UNORDERED_NODE_TYPE = 8
|
41
|
-
FIRST_ORDERED_NODE_TYPE = 9
|
42
|
-
|
43
|
-
def result_type
|
44
|
-
end
|
45
|
-
def number_value
|
46
|
-
end
|
47
|
-
def string_value
|
48
|
-
end
|
49
|
-
|
50
|
-
def boolean_value
|
51
|
-
end
|
52
|
-
|
53
|
-
def single_node_value
|
54
|
-
end
|
55
|
-
def invalid_iterator_state
|
56
|
-
end
|
57
|
-
def snapshot_length
|
58
|
-
end
|
59
|
-
|
60
|
-
def iterate_next()
|
61
|
-
end
|
62
|
-
def snapshot_item( index )
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
class Namespace < Node
|
67
|
-
XPATH_NAMESPACE_NODE = 13
|
68
|
-
def owner_element
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|