Module: CocoaXML

Defined in:
lib/cocoa-xml.rb,
lib/cocoa-xml/nodeset.rb,
lib/cocoa-xml/version.rb,
lib/cocoa-xml/nsxmlnode_extras.rb,
lib/cocoa-xml/nsxmldocument_extras.rb

Defined Under Namespace

Modules: NSXMLDocumentExtras, NSXMLNodeExtras Classes: NodeSet

Constant Summary collapse

Version =
'0.4.5'

Class Method Summary collapse

Class Method Details

.HTML(source) ⇒ NSXMLDocument

Parse an input HTML source

Parameters:

  • source (url, NSURL, #read, #to_str)

    a url as a string or NSURL, object that responds to #read, or #to_str

Returns:

  • (NSXMLDocument)

    An NSXMLDocument set to interpret source as HTML



15
16
17
# File 'lib/cocoa-xml.rb', line 15

def self.HTML(source)
  parse source, :html
end

.test_capture(&block) ⇒ Object



32
33
34
# File 'lib/cocoa-xml.rb', line 32

def self.test_capture(&block)
  @@test_capture = lambda { |document, source, type| block.call(document, source, type) }
end

.test_filter(&block) ⇒ Object



28
29
30
# File 'lib/cocoa-xml.rb', line 28

def self.test_filter(&block)
  @@test_filter = lambda { |source, type| block.call(source, type) }
end

.XML(source) ⇒ NSXMLDocument

Parse an input XML source

Parameters:

  • source (url, NSURL, #read, #to_str)

    a url as a string or NSURL, object that responds to #read, or #to_str

Returns:

  • (NSXMLDocument)

    An NSXMLDocument set to inperpret source as XML



24
25
26
# File 'lib/cocoa-xml.rb', line 24

def self.XML(source)
  parse source, :xml
end