Class: FeedParser::StrictFeedParser
- Inherits:
-
XML::SAX::HandlerBase
- Object
- XML::SAX::HandlerBase
- FeedParser::StrictFeedParser
show all
- Includes:
- FeedParserMixin
- Defined in:
- lib/rfeedparser/parsers.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
#_parse_date_greek, #_parse_date_hungarian, #_parse_date_iso8601, #_parse_date_mssql, #_parse_date_nate, #_parse_date_onblog, #_parse_date_perforce, #_parse_date_rfc822, #_parse_date_w3dtf, #extract_tuple, #parse_date, #rollover, #set_self
Constructor Details
#initialize(baseuri, baselang, encoding) ⇒ StrictFeedParser
Returns a new instance of StrictFeedParser.
8
9
10
11
12
13
14
|
# File 'lib/rfeedparser/parsers.rb', line 8
def initialize(baseuri, baselang, encoding)
$stderr << "trying StrictFeedParser\n" if $debug
startup(baseuri, baselang, encoding)
@bozo = false
@exc = nil
super()
end
|
Instance Attribute Details
#bozo ⇒ Object
Returns the value of attribute bozo.
7
8
9
|
# File 'lib/rfeedparser/parsers.rb', line 7
def bozo
@bozo
end
|
#entries ⇒ Object
Returns the value of attribute entries.
7
8
9
|
# File 'lib/rfeedparser/parsers.rb', line 7
def entries
@entries
end
|
#exc ⇒ Object
Returns the value of attribute exc.
7
8
9
|
# File 'lib/rfeedparser/parsers.rb', line 7
def exc
@exc
end
|
#feeddata ⇒ Object
Returns the value of attribute feeddata.
7
8
9
|
# File 'lib/rfeedparser/parsers.rb', line 7
def feeddata
@feeddata
end
|
Instance Method Details
#character(text, start, length) ⇒ Object
Also known as:
characters
61
62
63
64
|
# File 'lib/rfeedparser/parsers.rb', line 61
def character(text, start, length)
handle_data(text)
end
|
83
84
85
|
# File 'lib/rfeedparser/parsers.rb', line 83
def ()
handle_comment()
end
|
#endElement(name) ⇒ Object
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/rfeedparser/parsers.rb', line 72
def endElement(name)
name =~ /^(([^;]*);)?(.+)$/ namespaceuri = ($2 || '').downcase
prefix = @matchnamespaces[namespaceuri]
if prefix and not prefix.empty?
localname = prefix + ':' + name
end
name.downcase!
unknown_endtag(name)
end
|
#endNamespaceDecl(prefix) ⇒ Object
40
41
|
# File 'lib/rfeedparser/parsers.rb', line 40
def endNamespaceDecl(prefix)
end
|
#entityDecl(*foo) ⇒ Object
87
88
|
# File 'lib/rfeedparser/parsers.rb', line 87
def entityDecl(*foo)
end
|
#error(exc) ⇒ Object
92
93
94
95
|
# File 'lib/rfeedparser/parsers.rb', line 92
def error(exc)
@bozo = true
@exc = exc
end
|
#fatalError(exc) ⇒ Object
97
98
99
100
|
# File 'lib/rfeedparser/parsers.rb', line 97
def fatalError(exc)
error(exc)
raise exc
end
|
#getAttrs(attrs) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/rfeedparser/parsers.rb', line 20
def getAttrs(attrs)
ret = []
for i in 0..attrs.getLength
ret.push([attrs.getName(i), attrs.getValue(i)])
end
ret
end
|
#getPos ⇒ Object
16
17
18
|
# File 'lib/rfeedparser/parsers.rb', line 16
def getPos
[@locator.getSystemId, @locator.getLineNumber]
end
|
#setDocumentLocator(loc) ⇒ Object
28
29
30
|
# File 'lib/rfeedparser/parsers.rb', line 28
def setDocumentLocator(loc)
@locator = loc
end
|
#startCdata(content) ⇒ Object
68
69
70
|
# File 'lib/rfeedparser/parsers.rb', line 68
def startCdata(content)
handle_data(content)
end
|
#startDoctypeDecl(name, pub_sys, long_name, uri) ⇒ Object
32
33
34
|
# File 'lib/rfeedparser/parsers.rb', line 32
def startDoctypeDecl(name, pub_sys, long_name, uri)
end
|
#startElement(name, attrs) ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/rfeedparser/parsers.rb', line 43
def startElement(name, attrs)
name =~ /^(([^;]*);)?(.+)$/ namespaceuri = ($2 || '').downcase
name = $3
if /backend\.userland\.com\/rss/ =~ namespaceuri
namespaceuri = 'http://backend.userland.com/rss'
end
prefix = @matchnamespaces[namespaceuri]
"unbound prefix (XMLParserError)"
if prefix and not prefix.empty?
name = prefix + ':' + name
end
name.downcase!
unknown_starttag(name, attrs)
end
|
#startNamespaceDecl(prefix, uri) ⇒ Object
36
37
38
|
# File 'lib/rfeedparser/parsers.rb', line 36
def startNamespaceDecl(prefix, uri)
trackNamespace(prefix, uri)
end
|
#unparsedEntityDecl(*foo) ⇒ Object
90
91
|
# File 'lib/rfeedparser/parsers.rb', line 90
def unparsedEntityDecl(*foo)
end
|