Skip to content

know if a tag is empty or not #37

@jlecour

Description

@jlecour

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions