Posted: Thu Mar 17, 2005 11:33 am Post subject: custom java plugin node retrieving xml attribute values
Partisan
Joined: 27 Jan 2005 Posts: 397 Location: Philadelphia, PA
I am making a custom java node that will process xml messages to perform xpath queries. One of the xml objects that I need to be able to access are xml attributes. It appears that the plug-in api allows you to create elements that contain attributes but I can't find any way to access them. For example, if I have xml that looks like this
<letter xmlns="alphabet_letters">
A
</letter>
I cannot find any way through the plugin API to access the value of xmlns. Has anyone tried this?
You may have to use MBElement.getFirstChild, MBElement.getNextSibling to walk the tree to find what you need.
You might be able to construct a path that would work for MBElement.getFirstElementByPath, but the fact is that XML Attributes are MBElements of a different type than XML Elements are. I think they end up being NameValue elements instead of Name elements with Value element children. Or the other way around...
Look at a Trace of an XML file with Attributes. It may help you map between the MBElement calls you need to make and the tree structure that is produced. _________________ I am *not* the model of the modern major general.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum