We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let's say I have an XML snippet like this :
<article> <title>My Title</title> <author/> </article>
and this mapping :
class Author include ROXML xml_reader :whatever end class Article include ROXML xml_reader :title xml_reader :author, :as => Author end
Is it possible to know that the author is present without looking inside? I wish I could something like this
article = Article.from_xml(xml) puts article.author.whatever if article.author.present?
Thanks for this really great gem. I use it a lot, and am very happy with it.
The text was updated successfully, but these errors were encountered:
It appears this works with current versions of the gem. This script outputs what you'd expect:
require 'rubygems' require 'roxml' class Author include ROXML xml_reader :whatever end class Article include ROXML xml_reader :title xml_reader :author, :as => Author end xml = "<article> <title>My Title</title><author/></article>" xml2 = "<article> <title>My Title</title></article>" article = Article.from_xml(xml) puts "present" if article.author.present? article2 = Article.from_xml(xml2) puts "not present" unless article2.author.present?
If I'm missing something there please let me know. Otherwise (or if you've long since moved on) I think we can probably close this issue.
Sorry, something went wrong.
No branches or pull requests
Let's say I have an XML snippet like this :
and this mapping :
Is it possible to know that the author is present without looking inside?
I wish I could something like this
Thanks for this really great gem. I use it a lot, and am very happy with it.
The text was updated successfully, but these errors were encountered: