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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:35:59+00:00 2026-06-17T10:35:59+00:00

header = new LinkedHashMap<String,Object>(); Element headerElement = (Element)doc.getElementsByTagName( Header).item(0); NodeList elementList = headerElement.getElementsByTagName( *

  • 0
header = new LinkedHashMap<String,Object>();
Element headerElement = (Element)doc.getElementsByTagName( "Header").item(0);
NodeList elementList = headerElement.getElementsByTagName( "*" );
for( int index =0; index < elementList.getLength(); index++ ){
    Node element = elementList.item(index);
    System.out.println( element.getChildNodes().item(0).getTextContent() ); // Statement A          
    System.out.println( element.getTextContent()); // Statement B

Both Statement A and Statement B are printing the same output.

What does it means, every node is a child node for itself??

And the input XML is

<Header>
    <tag1>1</tag1>
    <tag2>2</tag2>
    <tag3>3</tag3>
    <tag4>4</tag4>
</Header>
  • 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-06-17T10:36:00+00:00Added an answer on June 17, 2026 at 10:36 am

    getTextContent() returns returns the text content of this node and its descendants.

    Statement A executed at tag1 returns the text node below (1)

    Statement B executed at the same place gets the child nodes of tag1 (a list with one text node), selects the first (only) text node and displays its text value.

    In this instance they are the same thing.

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

Sidebar

Related Questions

byte[] header = new byte[]{255, 216}; string ascii = Encoding.ASCII.GetString(header); I expect ASCII to
Currently, I use: Variabls: int recordCount = 5; Header = Index; // Can also
I recently created a new header file that I want to include in the
i have the follow code: searchResults.SearchResultCollection.Add( new SearchResult() { Header = HttpUtility.HtmlDecode( htmlDocument.DocumentNode .SelectSingleNode(initialXPath
I'm working on a new layout for my site that uses a header, footer
In the header of C++11, there are three new functions for conversion between number
I am using c++11 new <random> header in my application and in one class
edit/operacoes.php header('Content-Type: application/json'); include('../../lib/mysql.class.php'); $db = new MySQL(); if($db->Error()) $db->Kill(); //VARIÁVEIS DA FORM $id
As you know HTML5 introduced some new html tag, like footer,header, ... What prevent
I've copied all my category files & header includes to the new Xcode project,

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.