开发者

In XML what do you call this: //@Dohicky.0 and how to address it in Java

开发者 https://www.devze.com 2023-01-06 20:06 出处:网络
It\'s my first time parsing XML and I don\'t really know what I\'m doing at the moment.Here\'s my XML:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号