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.
9
10
11
12
13
14
15
|
# File 'lib/rfeedparser/parsers.rb', line 9
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.
8
9
10
|
# File 'lib/rfeedparser/parsers.rb', line 8
def bozo
@bozo
end
|
#entries ⇒ Object
Returns the value of attribute entries.
8
9
10
|
# File 'lib/rfeedparser/parsers.rb', line 8
def entries
@entries
end
|
#exc ⇒ Object
Returns the value of attribute exc.
8
9
10
|
# File 'lib/rfeedparser/parsers.rb', line 8
def exc
@exc
end
|
#feeddata ⇒ Object
Returns the value of attribute feeddata.
8
9
10
|
# File 'lib/rfeedparser/parsers.rb', line 8
def feeddata
@feeddata
end
|
Instance Method Details
#character(text, start, length) ⇒ Object
Also known as:
characters
62
63
64
65
|
# File 'lib/rfeedparser/parsers.rb', line 62
def character(text, start, length)
handle_data(text)
end
|
84
85
86
|
# File 'lib/rfeedparser/parsers.rb', line 84
def ()
handle_comment()
end
|
#endElement(name) ⇒ Object
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/rfeedparser/parsers.rb', line 73
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
41
42
|
# File 'lib/rfeedparser/parsers.rb', line 41
def endNamespaceDecl(prefix)
end
|
#entityDecl(*foo) ⇒ Object
88
89
|
# File 'lib/rfeedparser/parsers.rb', line 88
def entityDecl(*foo)
end
|
#error(exc) ⇒ Object
93
94
95
96
|
# File 'lib/rfeedparser/parsers.rb', line 93
def error(exc)
@bozo = true
@exc = exc
end
|
#fatalError(exc) ⇒ Object
98
99
100
101
|
# File 'lib/rfeedparser/parsers.rb', line 98
def fatalError(exc)
error(exc)
raise exc
end
|
#getAttrs(attrs) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/rfeedparser/parsers.rb', line 21
def getAttrs(attrs)
ret = []
for i in 0..attrs.getLength
ret.push([attrs.getName(i), attrs.getValue(i)])
end
ret
end
|
#getPos ⇒ Object
17
18
19
|
# File 'lib/rfeedparser/parsers.rb', line 17
def getPos
[@locator.getSystemId, @locator.getLineNumber]
end
|
#setDocumentLocator(loc) ⇒ Object
29
30
31
|
# File 'lib/rfeedparser/parsers.rb', line 29
def setDocumentLocator(loc)
@locator = loc
end
|
#startCdata(content) ⇒ Object
69
70
71
|
# File 'lib/rfeedparser/parsers.rb', line 69
def startCdata(content)
handle_data(content)
end
|
#startDoctypeDecl(name, pub_sys, long_name, uri) ⇒ Object
33
34
35
|
# File 'lib/rfeedparser/parsers.rb', line 33
def startDoctypeDecl(name, pub_sys, long_name, uri)
end
|
#startElement(name, attrs) ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/rfeedparser/parsers.rb', line 44
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
37
38
39
|
# File 'lib/rfeedparser/parsers.rb', line 37
def startNamespaceDecl(prefix, uri)
trackNamespace(prefix, uri)
end
|
#unparsedEntityDecl(*foo) ⇒ Object
91
92
|
# File 'lib/rfeedparser/parsers.rb', line 91
def unparsedEntityDecl(*foo)
end
|