Hi,
I'd like to create several builders, with common tags, in order to have xml docs like :
<xml version="1.0"?>
<a_kind_of_root>
<!-- This part is common -->
<event_date>20100514</event_date>
<event_id>123</event_id>
<event_type>Conference</event_type>
<!-- This part is specific to the builder -->
...
Does Nokogiri only support XPath 1.0? I'm trying to do simple string replacement in a value-of cell, like so (where element contains something like '* My string (useless text)')
<xsl:value-of select="replace(element,'^\*\ (.+)\ \(.*\)$','\\1')">
Is this poorly formed XSL? Or is there a limitation with Nokogiri?
...
Hi all,
I am pretty green with coding in Ruby but am trying to pull an XML feed into a Ruby object as follows (ignore the ugly code please):
<% doc = Nokogiri::XML(open("http://api.workflowmax.com/job.api/current?apiKey=#{@feed.service.api_key}&accountKey=#{@feed.service.account_key}")) %>
<% doc.xpath('//Jobs/Job').each do |node|...
Which one would you choose? My important attributes are (not in order)
Support & Future enhancements
Community & general knowledge
base (on the Internet)
Comprehensive (i.e proven to
parse a wide range of *.*ml pages)
Performance
Memory Footprint (runtime, not the code-base)
...
Hey guys,
I'm using Nokogiri to parse a return from the Rackspace API
so I'm using their sample code to
response = server.get '/customers/'[email protected]_id.to_s+'/domains/', server.xml_format
doc = Nokogiri::XML::parse response.body
puts "xpath values"
doc.xpath("//name").each do |node|
puts
node.text
end
As...
Edit: I figured out the answer. The problem was namespaces. The following code got it to work: @doc.xpath("xmlns:msms_pipeline_analysis/@date").to_s. I'd put this down as the answer, but this question has been closed.
I'm using Nokogiri to parse pepXML files from different peptide search engines. I have two pepXML files, both of which a...
I have a simple task of accessing the values of some attributes. Below is a simple script that uses Nokogiri::XML::Builder to create a simple xml doc.
require 'nokogiri'
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.Placement(:messageId => "392847-039820-938777", :system => "MOD", :version => "2.0") {
x...
I have an html document located on http://somedomain.com/somedir/example.html
The document contains of four links:
http://otherdomain.com/other.html
http://somedomain.com/other.html
/only.html
test.html
How I can get the full urls for the links in the current domain ?
I mean I should get:
http://somedomain.com/other.html
http://...
After listening to Rails Cast No 190 I sat down to try it
So I installed nokogiri with
gem install nokogiri
on my Windows 7 Ultimate laptop. I use Ruby 1.9
and this is the way i Installed Nokogiri
C:\Ruby>gem install nokogiri
Successfully installed nokogiri-1.4.2-x86-mingw32
1 gem installed
Installing ri documentation for nokogiri...
Hi, I am new to the world of Ruby and Rails.
I have seen rails cast 190 and I just started playing with it. I used selector gadget to find out the CSS and XPath
I have the following code..
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url = "http://www.telegraph.co.uk/sport/football/rss"
doc = Nokogiri::HTML(open...
I'm confused. It's a regular state of affairs for me but specifically in this case I felt I could reach out to fellow stackoverflowers (that is, stackoverflow-ers, not stackover-flowers).
uname -a
Darwin macbookpro 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386
set
bash-3.2$ s...
I've spent my requisite two hours Googling this, and I can not find any good answers, so let's see if humans can beat Google computers.
I want to parse a stylesheet in Ruby so that I can apply those styles to elements in my document (to make the styles inlined). So, I want to take something like
<style>
.mystyle {
color:white;
}
</s...
I think "text" must be a special form because when I use xml.text "hello" the tag doesn't appear in the xml doc. Whatever follows that tag is simply listed without a . I tried to use send.(:"text", "hello") but that doesn't work either.
Ideas?
...
On a ubuntu server, with everything installed (checked against another pc where this works just fine) When trying to run warble on one of my jruby projects, I get this error:
Function 'xmlFirstElementChild' not found in [libexslt.so]
/opt/jruby-1.5.0/lib/ruby/site_ruby/shared/ffi/ffi.rb:112:in `create_invoker'
/opt/jruby-1.5.0/lib/ruby/...
I am using Savon to build the client, but want to kno how to create the actual envelope.
I am thinking of using Nokogiri XML Builder and just pass in the values, but not sure if that's the right way.
The SOAP envelope specs can be found here:
http://api.postalmethods.com/PostalWS.asmx?op=UploadFile
...
Simple question: are there any solid XSLT libraries that work in both Ruby and JRuby?
REXML works in both, but does not have XSLT support.
ruby-xslt doesn't work in JRuby.
The latest Nokogiri betas do support JRuby, but the support is still buggy and throws occasional NullPointerExceptions for XML input that works fine in Ruby. (In pa...
I just started using Cucumber and in the simplest of scenarios I throw the following error:
undefined method has_key?' for #<Nokogiri::XML::Element:0x10677a400> (NoMethodError)
./features/step_definitions/web_steps.rb:36:in/^(?:|I )fill in "([^"])" with "([^"])"$/'
features/authentication.feature:9:in `When I fill in "user_name" with "J...
First the xml:
http://api.chartlyrics.com/apiv1.asmx//GetLyric?lyricId=90&lyricCheckSum=9600c891e35f602eb6e1605fb7b5229e
doc = Nokogiri::XML(open("http://api.chartlyrics.com/apiv1.asmx//GetLyric?lyricId=90&lyricCheckSum=9600c891e35f602eb6e1605fb7b5229e"))
Successfully will grab the document content.
After this point i am unab...
I've a simple script that looks at Twitter username and gets me the location. But some of the username doesn't exist and I get error:
/usr/lib/ruby/1.8/open-uri.rb:277:in `open_http': 404 Not Found (OpenURI::HTTPError)
I've tried to rescue it, but I can't to make it work. Can anyone help? Thanks
a = []
my_file = File.new("location.t...
I have the following XML structure:
<charsets>
<charset>
<name>ANSI_X3.4-1968</name>
<aliases>
<alias>iso-ir-6</alias>
<alias>ANSI_X3.4-1986</alias>
<alias>ISO_646.irv:1991</alias>
<alias>ASCII</alias>
<alias>ISO646-US</alias>
<alias>US-ASCII</alias>
<alias>us</alias>
<alias>IBM3...