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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:52:34+00:00 2026-05-26T12:52:34+00:00

Yesterday Night, i wrote this function to fetch all the tags from string containing

  • 0

Yesterday Night, i wrote this function to fetch all the tags from string containing xml data but something is not correct in this… Pls help… this function is returning java.lang.NullPointerException

  public void parseWebXML(String xd){
      int i, j, k = 0;
      String tagn, check = "";
      int spos, epos;
      byte[] len = xd.getBytes();
      tags = new String[len.length*3/4];
      int nextpos = 0;
      for(i=0;i<len.length*3/4;i++){
        spos = xd.indexOf("<", nextpos);
        epos = xd.indexOf(">", spos);
        tagn = xd.substring(spos, epos);
        if(i == 0 || i == 1 || i == 2){
            if(tagn.indexOf("/") == -1){
                tags[k] = "<"+tagn+">";
                k +=1;
            }else{
                continue;
            }
        }else{
            if(tagn.indexOf("/") == -1){
                for(j=0;j<tags.length;j++){
                    if(tags[i].equals(tags[j])){
                        check = "found";
                    }else{
                        check = "notfound";
                    }
                }
                if(check.equals("notfound")){
                    tags[i] = "<"+tagn+">";
                    k+=1;
                }else{
                    continue;
                }
            }else{
                continue;
            }
        }
        nextpos = epos + 1;
      }
  }

error that i saw while executing in debugger mode

TRACE: <at java.lang.NullPointerException:   0>, Exception caught in Display class
java.lang.NullPointerException:   0
 - httpcon.parseWebXML(), bci=170
  • 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-26T12:52:35+00:00Added an answer on May 26, 2026 at 12:52 pm

    You initialized tags[], but not each of its cells, so tags[i].equals(tags[j]) probably caused the NPE (tags[i] is null).

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

Sidebar

Related Questions

I have been working all night and yesterday on this header section in css,
Yesterday I found this function: function clone(obj) { return typeof obj === 'undefined' ?
Yesterday I asked this post , but I am still having problems when I
I'm writing this question with reference to this one which I wrote yesterday. After
I'm running into a strange issue.... This all worked fine last night when I
Yesterday, I asked this question and never really got an answer I was really
Yesterday, I discovered the Subversion (SVN) blame feature, and I was wondering, is this
Yesterday, I found myself writing code like this: SomeStruct getSomeStruct() { SomeStruct input; cin
Yesterday I got a call from a Microsoft representative asking if we supply hosted
I use cffile action=Upload, and it works just fine for smaller files. But yesterday,

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.