Navigating a PlainXmlModel [message #1784863] |
Wed, 04 April 2018 21:27 |
Sina Madani Messages: 160 Registered: November 2015 Location: York, UK |
Senior Member |
|
|
Hi,
I'm trying to query the values of a minimal XML model. The structure is:
<a>
<b x="1">
</b>
<b x="2">
</b>
<c x="1">
</c>
<c x="2">
</c>
</a>
However I can't seem to find any documentation regarding how one would go about accessing attributes and elements. The only workaround I've found is the following, for example trying to get attribute "x" of element "b" (of type t_b) is:
b.getAttributes().getNamedItem("x").getNodeValue()
Probably due to the way reflection works, this attempts to call the methods directly on the implementing instance (in this case, it's com.sun.org.apache.xerces.internal.dom.ElementImpl.getAttributes()) rather than on the interface, leading to warnings about illegal reflective access (from Java 9 onwards).
I was wondering if there's some obvious way that I've missed? Looking at the source for PlainXmlModel, I don't see any obvious notation.
Thanks,
Sina
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05363 seconds