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 开发者_如何学Gobetter way, right?
Thanks All!
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.
精彩评论