Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 522335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:20:36+00:00 2026-05-13T08:20:36+00:00

I have an xml, and I can’t parse this file with xmlslurper. Here a

  • 0

I have an xml, and I can’t parse this file with xmlslurper.
Here a copy of my xml file :

<Entrezgene-Set>
<Entrezgene>
<Entrezgene_summary>The protein encoded by this gene is a plasma glycoprotein of unknown function. The protein shows sequence similarity to the variable regions of some immunoglobulin supergene family member proteins. [provided by RefSeq]</Entrezgene_summary>
</Entrezgene>
</Entrezgene-Set>

I just need to get text from <Entrezgene_summary>

Here my code :

  def pubmedEfetch = {

  def base = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?"
  def qs = []
  qs << "db=gene"
  qs << "id=1"
  qs << "retmode=xml"
  def url = new URL(base + qs.join("&"))
  def connection = url.openConnection()

  def result = [:]

  if(connection.responseCode == 200){
    def xml = connection.content.text
    def eFetchResult = new XmlSlurper().parseText(xml)
    result.geneSummary = eFetchResult.Entrezgene-Set.Entrezgene.Entrezgene_summary
  }
  else{
    log.error("PubmedEfetchParserService.PubmedEsearch FAILED")
    log.error(url)
    log.error(connection.responseCode)
    log.error(connection.responseMessage)
  }
  render result
}

And my error message :

Error 500: groovy.lang.MissingPropertyException: No such property: Entrezgene for class: java.util.Set
Servlet: grails
URI: /geneInfo/grails/genes/pubmedEfetch.dispatch
Exception Message: No such property: Entrezgene for class: java.util.Set 
Caused by: groovy.lang.MissingPropertyException: No such property: Entrezgene for class: java.util.Set 
Class: GenesController 

I don’t see where is my fault?

I also try : result.geneSummary = eFetchResult./Entrezgene-Set/.Entrezgene.Entrezgene_summary

Someone has an idea?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:20:36+00:00Added an answer on May 13, 2026 at 8:20 am

    You don’t need to dereference the top tag (Entersgene-Set>). The following works for me in groovyconsole:

    xml = """<Entrezgene-Set>
    <Entrezgene>
       <Entrezgene_summary>The protein encoded by this gene is a plasma glycoprotein of unknown function. The protein shows sequence similarity to the variable regions of some immunoglobulin supergene family member proteins. [provided by RefSeq]
       </Entrezgene_summary>
    </Entrezgene>
    </Entrezgene-Set>
    """
    
    
    def eFetchResult = new XmlSlurper().parseText(xml)
    x = eFetchResult.Entrezgene.Entrezgene_summary
    println "x is [${x}]"
    

    BTW, your error message is caused by trying to use a property name with a dash in it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder if this is possible in jaxb2. I have a xml that can
I have an xml mapping file that looks something like this <colourMappings> <model name=modelX>
I have XML column in my table which can contain XML like these 2
I have some xml similar to this: <?xml version=1.0 encoding=utf-8 ?> <data> <resources> <resource
I have an XML that needs to be databound to a WPF TreeView .
the following perl script (Showing down) print the following XML file but the XML
I have a XML setting I am trying to load using simplexml. The XML
I have some XML that has creating using an XmlDocument object in C#. I
Say I have the following XML <?xml version=1.0 encoding=utf-8?> <Person> <FirstName>Bjorn</FirstName> <LastName>Ellis-Gowland</LastName> </Person> That
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.