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

  • Home
  • SEARCH
  • 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 6234709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:32:08+00:00 2026-05-24T10:32:08+00:00

if i parse this xml file: <?xml version=1.0 encoding=UTF-8?> <rootnode> <testnode info=Test1/> <testnode info=Test2/>

  • 0

if i parse this xml file:

<?xml version="1.0" encoding="UTF-8"?>
<rootnode>
  <testnode info="Test1"/>
  <testnode info="Test2"/>
</rootnode>

with this pice of groovy code all works fine:

def parser = new XmlParser()
def result = parser.parse(new File('test.xml').getCanonicalPath())
result.testnode.each {node -> println node.'@info'}

But if the node name change from “testnode” to “test-node”

i got the following message:

Exception in thread "main" groovy.lang.MissingPropertyException: No such property: node for class:..

How can i solve this problem (the content of the xml is untouchable)

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-24T10:32:08+00:00Added an answer on May 24, 2026 at 10:32 am

    You’ll need to quote the nodename so Groovy knows it’s not a subtraction:

    result.'test-node'.each {node -> println node.'@info'}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml file <?xml version=1.0 encoding=UTF-8?> <xml> <settings> <title>Calendar2</title> <subTitle>Calendar2</subTitle> </settings> <events
I have the following XML file: <?xml version=1.0 encoding=utf-8 ?> <strategies> <strategy name=God Class>
When I parse my xml file (variable f) in this method, I get an
I'm trying to parse UTF-8 XML file and save some parts of it to
I have the following xml snippet: <?xml version=1.0 encoding=UTF-8 ?> <!DOCTYPE sqlMap PUBLIC -//ibatis.apache.org//DTD
I'm getting this error (see title) while trying to parse an XML file in
The xml file has this snippet: <?xml version=1.0?> <PC-AssayContainer xmlns=http://www.ncbi.nlm.nih.gov xmlns:xs=http://www.w3.org/2001/XMLSchema-instance xs:schemaLocation=http://www.ncbi.nlm.nih.gov ftp://ftp.ncbi.nlm.nih.gov/pubchem/specifications/pubchem.xsd >
I'm using TinyXML to parse/build XML files. Now, according to the documentation this library
What path would you took to parse a large XML file (2MB - 20
hi i have xml file whitch i want to parse, it looks something like

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.