Extensions to the Hpricot XML parser.
# File lib/davclient/hpricot_extensions.rb, line 93 def basename File.basename(self.at("d:href").innerText) end
Get content from resources on server Example:
webpage = WebDAV.find("http://example.org/index.html") print "html src: " + page.content
# File lib/davclient/hpricot_extensions.rb, line 39 def content if(!isCollection?) WebDAV.get(self.at("d:href").innerText) end end
# File lib/davclient/hpricot_extensions.rb, line 45 def content=(string) if(!isCollection?) WebDAV.put_string(href,string) end end
Get property for resource or collection. Example:
page = WebDAV.find(url) print page.property("published-date")
# File lib/davclient/hpricot_extensions.rb, line 55 def property(name) # TODO: Make list of recognized namespace prefixes configurable property = property = self.at(name) if(property)then returnValue = property.innerText return returnValue end property = property = self.at(name.downcase) if(property)then return property.innerText end vrtx_property = self.at("v:" + name) if(vrtx_property)then return vrtx_property.innerText end vrtx_property = self.at("v:" + name.downcase) if(vrtx_property)then return vrtx_property.innerText end dav_property = self.at("d:" +name) if( dav_property)then return dav_property.innerText end dav_property = self.at("d:" +name.downcase) if( dav_property)then return dav_property.innerText end return nil end
Set the items WebDAV properties. Properties must be a string with XML. Example:
find(url) do |item| if(item.href =~ /html$/) then item.proppatch("<d:getcontenttype>text/html</d:getcontenttype>") end end
# File lib/davclient/hpricot_extensions.rb, line 106 def proppatch(properties) WebDAV.proppatch(href, properties) end
Generated with the Darkfish Rdoc Generator 2.