0

It's my first time parsing XML and I don't really know what I'm doing at the moment. Here's my XML:

<?xml version="1.0" encoding="UTF-8"?>
<MyDocument xmi:version="2.0">
  <Thingamabob name="A" hasDohicky="//@Dohicky.0">
    <Dingus/>
  </Thingamabob>
  <Dohicky name="B"/>
</MyDocument>

So what is "//@Dohicky.0" called? I understand the purpose, but I'm don't know how to deal with it when I'm parsing XML through Java JAXP. I guess I could parse the hasDohicky attribute's value and then lookfor the 0th occurrence of an element by that name... but I bet there's got to be a better way, right?

Thanks All!

JnBrymn
  • 24,245
  • 28
  • 105
  • 147
  • 1
    It's XPath syntax, right? I'm not sure what you're looking for - pass the attribute value into an XPath selector statement and you'll get back the element it's "pointing" to. – Matt Ball Jul 13 '10 at 16:55

1 Answers1

2

In general it's an Attribute (like the "name" attributes in Dohicky and Thingamabob)

In this case hasDohicky looks a bit like a XQuery string, though I am not sure about the ".0" part see here for more info about XQuery.

Mene
  • 3,739
  • 21
  • 40