How to retrieve value of an attribute which contains colon in the attribute name using xpath

I have a simple requirement where in I need to fetch the value of attribute xml:id i.e af1.
I am making use of a SAXParser and here is my xpath:a/aff/@xml:id on the contrary I was able to fetch value of using the xpath:a/aff/@value.

But i was unable to retrieve the value could you please help me?

  • Issue with databinding using Kotlin for Android
  • android sqlite CREATE TABLE IF NOT EXISTS
  • ProgressBars and Espresso
  • FileProvider error
  • MonoDroid: Error when calling constructor of custom view - TwoDScrollView
  • Why don't some xhdpi mobiles display image located in /res/drawable only?
  • <?xml version="1.0" encoding="UTF-8" ?>
    <a>
       <aff xml:id="af1" value="a">
            <uAff>
                Hello
            </uAff>
        </aff>
        <aff xml:id="corr1">
            <uAff>
                Hello1
            </uAff>
        </aff>
    </a>
    

    Thanks in advance.

    Related posts:

    Android Retrofit - onProgressUpdate for showing Progress Notification
    How to include a .so lib in Intellij IDEA for Android project?
    Implementing App-to-App calling on Android
    How do I use the Simple HTTP client in Android?
    How to open a different activity on recyclerView item onclick
    onGetViewFactory only called once for multiple widgets
  • Java/Android: anonymous local classes vs named classes
  • Android: Is onResume always called after onCreate?
  • Android Push Notification (GCM), is there any Daily Limit?
  • Android LongClickListener on ExpandableListView group items
  • What to do when - java.io.FileNotFoundException: No content provider?
  • error: cannot find symbol method getMap() after dependencies update
  • 2 Solutions collect form web for “How to retrieve value of an attribute which contains colon in the attribute name using xpath”

    To get the value of the attributes you could use:

    /a/aff/@*[name()='xml:id']
    

    /a/aff/@xml:id works just fine in getting the values…

    Are you trying to get both values?

    If you are trying to get just the first value you could use /a/aff[1]/@xml:id

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.