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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:35:42+00:00 2026-06-05T10:35:42+00:00

i want to parse a XAPI xml with the SAXParser. But now i have

  • 0

i want to parse a XAPI xml with the SAXParser.
But now i have a problem.

First a snippet of the xml:

<node id="24924135" lat="49.8800274" lon="8.6453740" version="12" timestamp="2012-05-25T15:13:47Z" changeset="11699394" uid="61927" user="AlexPleiner">
<tag k="addr:city" v="Darmstadt"/>
<tag k="addr:housenumber" v="41"/>
<tag k="addr:postcode" v="64293"/>
<tag k="addr:street" v="Kahlertstraße"/>
<tag k="amenity" v="pub"/>
<tag k="name" v="Kneipe 41"/>
<tag k="note" v="DaLUG Meeting (4st Friday of month 19:30)"/>
<tag k="smoking" v="no"/>
<tag k="website" v="http://www.kneipe41.de/"/>
<tag k="wheelchair" v="limited"/>

And a snippet of my SAXParser code:

public void startElement(String uri, String localName, String qName,
        Attributes atts) throws SAXException {
  if (localName.equals("node")) {
    // Neue Person erzeugen
    poi = new POIS();

    poi.setLat(Float.parseFloat(atts.getValue("lat")));
    poi.setLon(Float.parseFloat(atts.getValue("lon")));
  }
}

public void endElement(String uri, String localName, String qName) throws SAXException {


  poi.setHouseNo(currentValue);


  if (localName.equals("addr:street")) {
    poi.setStreet(currentValue);
  }

  if (localName.equals("amenity")) {
    poi.setType(currentValue);
  }

}

The Latitude and Longtitude aren’t the problem , but the Tag “tag”.

How can i check for the “k” and get the Value of v ?

Anyone an idea? 🙂

  • 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-05T10:35:43+00:00Added an answer on June 5, 2026 at 10:35 am

    The values you are interested in looking at are xml attributes, and will be represented in the startElement(...) method by the Attributes argument passed in.

    What you need to do is very similar to what you have done for the node element.

    public void startElement(String uri, String localName, String qName,
              Attributes atts) throws SAXException 
    {
        //your other node code        
    
        if(localname.equals("tag")) {
            String k = atts.getValue("k");
            if(iAmInterestedInThisK(k)) {
                String v = atts.getValue("v");
                doSomethingWithThisV(v);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want parse xml by looping through it. I referred this but I am
I have implemented ipad application in which i want parse table of content but
I have Date that look like String, and I want parse it. But date
I want to parse (little critical) xml using php simplexml...But i can aither get
i want parse xml file, which does't have xml extension, like this: http://bizonek.wrzuta.pl/xml/plik/1ANdXCgTOit/unknow/undefined/643/ my
I have class model for XML structure, where i want parse xml into it.
I want to parse some XML-file in Qt, but that file is located at
I want to parse a sentence into words but some sentences have two words
I have an XML file in the drawable-folder. I want parse the XML-file using
I want to parse an XML file using SAX parser in java with this

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.