I want to create an RSS feed using Yahoo! Pipes. The feed source coming from a website in XML format doesn't have a date/time in its own tags for every item. How can I pull out this content (date & location event) and put it in 2 tags using Yahoo Pipes? The content is in <description> tag.
<description>
<![CDATA[ 2013/11/06 # Polytechnique Montréal - Pavillon Lassonde<br/><br/>
...
</description>
Can anyone show me how to do this using Yahoo! Pipes?
Related
I have a need to hold a "Purchase Contract" type of report in my website. I am using Sinatra using erb files to deliver content. I would like to email the current report (the versions will change) out when people sign up for various items.
I'm thinking I can house it in the database, or an external file, in some kind of format, so I can do the both:
import it into an erb file for presentation on the web
use it in an email so it's readable in text format
So basically I need it in a format that's basic as possible, but it has to translate into HTML (erb) and text.
What are my options with the format of this file? And how can I translate that into HTML? I've looked at markdown and it's not very pretty with the gems that I find that translate to text. Seeing that it needs plain text as well as HTML I'm a bit lost as to how to get this done.
File Snippet
Privacy Policy
Updated Feb 20, 2019
Website.com (“Website”) is a private business. In this Privacy Statement the terms “we” and “our” refer to Website. This Privacy Statement explains Website’s practices regarding personal information of our users and visitors to this website (the “Website”), as well as those who have transactions with us through telephone, Internet, faxes and other means of communications.
Website’s Commitment to Privacy
At Website, we are committed to respecting the privacy of our members and our Website visitors. For that reason we have taken, and will continue to take, measures to help protect the privacy of personal information held by us.
This Privacy Statement provides you with details regarding: (1) how and why we collect personal information; (2) what we do with that information; (3) the steps that we take to help ensure that access to that information is secure; (4) how you can access personal information pertaining to you; and (5) who you should contact if you have questions and concerns about our policies or practices.
Solution: Save the file as HTML and use this gem for conversion into text:
https://github.com/soundasleep/html2text_ruby
Works fine if the HTML is simple enough.
Remaining: Still have the issue as using the HTML file as a partial.
Solved:
#text = markdown File.read('views/privacy.md')
So park the source file as a markdown file, which can translate to HTML. When I need the email version, I need to translate to HTML then to text using the HTML2text gem. https://rubygems.org/gems/html2text
As I understand it, you have a portion of text (stored in a database or a file, it doesn't really matter where) and you want to:
serve this up formatted as HTML via a webpage
send it plain via email
Assuming a standard Sinatra project layout where the views directory lives in the project dir, e.g.
project-root/
app.rb
views/
and a route to deliver the text in app.rb:
get "/sometext" do
end
If you put the erb template in the views directory and as the last line of the route make a call to the erb template renderer you should get the output in HTML. e.g.
project-root/
app.rb
views/
sometext.erb # this is the erb template
In the Sinatra app
# app.rb
# I'm assuming you've some way to differentiate
# bits of text, e.g.
get "/sometext/:id" do |id|
#text = DB.sometext.getid id # my fake database call
erb :sometext # <- this will render it, make it the final statement of the block
# make sure #text is in the template
# else use locals, e.g.
# erb :sometext, :locals => { text: #text }
end
Now when a user visits http://example.org/sometext/485995 they will receive HTML. Emailing the text to the user could be triggered via the website or some other method of your choice.
I have a raw xml file on Gist:
https://gist.githubusercontent.com/EmDubeu/196d95b561fa83a4ef360654ed919fe5/raw/9e2dde8d08a2ea4e45871bf8c55693334f8a69e1/NEIPA.xml
I store the above url in a cell in my Google spreadsheet (Settings!E27).
I'm trying to use importxml from my google sheet with the following formula:
=IMPORTXML(Settings!E27, "//HOP/NAME"), but it returns "Error Imported Xml content can not be parsed."
My formula works with this url:
http://www.beerxml.com/recipes.xml
Why is it not working with my Gist hosted xml file?
GitHub is not for file-hosting and Content-Type headers is not set properly. If you type http://www.beerxml.com/recipes.xml in the browser, it will render the page as XML contents, but not for your https://gist.githubusercontent.com/EmDubeu/... since it cannot recognize it as a XML page.
In this case, people(at least, I) usually use sites like https://rawgit.com/. For your gist file, rawgit URL is https://rawgit.com/EmDubeu/196d95b561fa83a4ef360654ed919fe5/raw/fcb019a0db249ea90a9512f9162725547f4a43b5/NEIPA.xml.
But when I type this URL, my browser says it cannot parse the page because of characters like &. It should be HTML(XML) character encoded. You can verify this by viewing the source of http://www.beerxml.com/recipes.xml, in which & is encoded to & properly. You should html-encode your gist too.
Insert a break line between <?xml version="1.0" encoding="ISO-8859-1"?> and <RECIPES>
I have a XML file(Input file) which I use to generate a PDF file(Output file) which is basically a letter sent to the customers. I have to automate the validation of PDF content. I am able to get the text in PDF using PDF-Reader gem. Now I have to validate this text.
This PDF contains some static text(Text that will remain same for every customer) like, the Heading of the letter, sender address, part of the text in body of the letter, but things like Recipient address and name, Account number payment amount in the body of the letter will change for every customer.
These changing values I can get from XML. So to automate the validation I want to use a text file that has the static text and for the dynamic text I want to pass a the value from the XML using Nokogiri gem.
Then compare this text file with the PDF text.
I need some help in creating this text file with the variables.
Or if any one has any other suggestion please suggest ?
Example:
Sample XML:
<RealTimeLetter>
<Customer>
<RTLtr_LetterNumber>00510</RTLtr_LetterNumber>
<RTLtr_CustomerAddress1>Recipient address1</RTLtr_CustomerAddress1>
<RTLtr_CustomerAddress2>*</RTLtr_CustomerAddress2>
<RTLtr_CustomerCity>CITY</RTLtr_CustomerCity>
<RTLtr_CustomerState>STATE</RTLtr_CustomerState>
<RTLtr_CustomerZip>221501020</RTLtr_CustomerZip>
<RTLtr_CustomerName>Recipient name1</RTLtr_CustomerName>
<RTLtr_CustomerSSN>111111111</RTLtr_CustomerSSN>
<RTLtr_ActNum>1111111</RTLtr_ActNum>
</Customer>
<Customer>
<RTLtr_LetterNumber>00510</RTLtr_LetterNumber>
<RTLtr_CustomerAddress1>Recipient address2</RTLtr_CustomerAddress1>
<RTLtr_CustomerAddress2>*</RTLtr_CustomerAddress2>
<RTLtr_CustomerCity>CITY</RTLtr_CustomerCity>
<RTLtr_CustomerState>STATE</RTLtr_CustomerState>
<RTLtr_CustomerZip>221501020</RTLtr_CustomerZip>
<RTLtr_CustomerName>Recipient name2</RTLtr_CustomerName>
<RTLtr_CustomerSSN>111111111</RTLtr_CustomerSSN>
<RTLtr_ActNum>2222222</RTLtr_ActNum>
</Customer>
</RealTimeLetter>
Sample PDF Text:
Sender Name Letter Send Date
Sender Address Letter Heading
Sender City, State zip
Recipient name Account #: 1111111
Recipient address
Recipient City, state zip
Dear Recipient name,
Body of the letter. Some text in this will not change. Payment amount $1234. The amount will keep chenge.
Paragraph 2. XXXXXXXXXXXX.yyyyyyyy.
Sincerely,
Customer Care Department
Sender Signature
I want to be able to put the value of the tag
<RTLtr_CustomerAddress1>Recipient address1</RTLtr_CustomerAddress1>
as a variable in the text file that also has the other static text in it. and be able to compare it with the text extracted from PDF.
I am looking to pull job postings from a site that has multiple pages of postings. I can pull the content from one page
On a simple example I can get it to iterate and grab page content (this is a simple example site base)
However when I take the first example and try to clean the data (I can't use the Xpath filter to grab the HTML id and I cand seem to find a way to limit the scope elsewhere. Here is what I am trying (regex, rename...):
http://pipes.yahoo.com/pipes/pipe.edit?_id=3619ea93d66e47442659a1976746ba6c
Any thoughts?
I have a currency converter application for iphone which uses web service. The web service is returning result in the following format:-
<Date>4/5/2010</Date>
<Time>7:18:09 AM</Time>
<Amount>20</Amount>
<ExchangeRate>44.7336419443466</ExchangeRate>
<Result>894.672839</Result>
I'm storing the whole xml file in an NSString variable called theXML. I want to show the value inside the result tag.How can i read the data from the xml file or from the string..
Thanks in advance..
Use XPath.