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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:43:11+00:00 2026-05-20T05:43:11+00:00

I haven’t worked much with XML before so maybe my ignorance on proper terminology

  • 0

I haven’t worked much with XML before so maybe my ignorance on proper terminology is hurting me in my searches on how to do this. I have the code snippet below which I am using to parse an XML file like the one below. The problem is that it only picks up XML values within <Tag>Value</Tag> but not for the one below where I need to get the value of TagValue, which in this case would be "Russell Diamond".

I would appreciate if anyone can offer assistance as to how to get custom values like this. Thanks.

<Tag TagName="#Subject" TagDataType="Text" TagValue="Russell Diamond"/>

The snippet I am using:

public void printElementNames(String fileName) throws IOException {
    //test write to file
       FileWriter fstream = new FileWriter("/home/user/Desktop/readEDRMtest.txt");
        final BufferedWriter out = new BufferedWriter(fstream);


    //

    try {
        SAXParserFactory parserFact = SAXParserFactory.newInstance();
        SAXParser parser = parserFact.newSAXParser();
        System.out.println("XML Elements: ");
        DefaultHandler handler = new DefaultHandler() {
            public void startElement(String uri, String lName, String ele,
                    Attributes attributes) throws SAXException {
                // print elements of xml
                System.out.println(ele);
                try {
                    out.write(ele);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

             public void characters(char ch[], int start, int length)
             throws SAXException {


                System.out.println("Value : "
                    + new String(ch, start, length));
                try {
                    out.write("Value : "
                            + new String(ch, start, length));
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

            }

        };
  • 1 1 Answer
  • 3 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-20T05:43:11+00:00Added an answer on May 20, 2026 at 5:43 am

    You want to look into extracting attributes. Search on that and you’ll find your answer.

    The DefaultHandler class’s startElement(…) method passes a parameter called attributes that refers to an Attribute object. The API for the Attribute interface will describe how to extract the information you need from this object.

    For example:

    out.write(attributes.getValue("TagValue"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I haven't worked with SQL Reporting much, however I have been trying to get
I haven't seen this datetime format before: 2010-08-19T16:09:07.08 The nearest I have found in
I haven't seen this question anywhere else, I hope someone can help. I have
I haven't found any documentation on this or seen this done before, but is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Haven't done as much of Javascript as I should have done. I am trying
haven't used regex replaces much and am not sure if how I have done
Haven't seen many Geneva related questions yet, I have posted this question in the

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.