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 6669637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:10:26+00:00 2026-05-26T03:10:26+00:00

I am here to ask you a basic question about jdom. I am trying

  • 0

I am here to ask you a basic question about jdom. I am trying to read a Document object but I got an error all the time.
The Document that I am trying to read is,

<message>
<header>
<messageType>snmp</messageType>
<sendFrom>192.168.0.16</sendFrom>
<hostName>oghmasysMehmet</hostName>
<sendTo>192.168.0.12</sendTo>
<receiverName>Mehmet</receiverName>
<date>03/10/2011</date>
</header>
<body>
<snmpType>getbulk</snmpType>
<ip>127.0.0.1</ip>
<port>161</port>
<oids>
  <oid>1.3.6.1.2.1.1</oid>
</oids>
<community>public</community>
<nR>0</nR>
<mR>5</mR>
</body>
</message>

And I am trying to value. To do it, I have written a function,

public Vector<String> getOIDs(Document document){ 

    Vector<String> oids = new Vector<String>();

    Element root = document.getRootElement();
    Element body = root.getChild("body");
    //Element element = body.getChild("oids");
    List rows = body.getChildren("oid");
    for (int i = 0; i < rows.size(); i++) {
        Element row = (Element) rows.get(i);
        String s = row.getText();
        oids.add(s);
    }
    return oids;
}

but When I debug it, I can always see that there is nothing read by the function.
Can you please help me about that ?

Thank you all

EDIT :Ok sorry for asking such a noob question, I just made a mistake in getchildren (); I should have written oids instead of oid

EDIT 2: Actually ı have changed the code as I commented on my question but now, the only thing I read is “\n \n” not “1.3.6.1.2.1.1”. What do you think the problem might be ?

  • 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-26T03:10:27+00:00Added an answer on May 26, 2026 at 3:10 am

    At first glance, seems to me that doesn’t have a “oid” child, it has a “oids” child. The element you’re trying to read is inside the “oids” element.

    You can try and debug it step by step, and see what is the element that isn’t being read. That would be my best guess without trying it out.

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

Sidebar

Related Questions

I was going to ask a question here about whether or not my design
You'd immediately think I went straight to here to ask my question but I
Psssst...! Read on, by all means. But I can tell you here that the
Apologies to ask such a basic question but I really cant see why In3
This question is so basic that I'm almost embarrassed to ask it, but it's
As far as I know, what I ask here isn't possible, but I thought
Many questions here on SO ask about custom classes. I, on the other hand,
I've been in doubt whether to ask this here, but I don't know where
I have already posted something similar here but I would like to ask the
I know this is a very basic question, but I haven't been able to

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.