Re: Jdom with XMI Files
Paul Libbrecht <[email protected]>
| Newsgroups | gmane.comp.java.jdom.general |
|---|---|
| Message-ID | <[email protected]> |
Le 23-nov.-08 à 04:09, Fabio Leal a écrit :
> I'm trying to manipulate a XMI file with Jdom, and I have
> experienced some difficulties doing it.
> For example:
> All the subnodes of the root Element have the "same name", but have
> different attributes.
> How can I choose a specific "Element", by specifying it's attributes?
XPath only can do that, it's equivalent to serial search. Something
such as:
xmiNS = Namespace.getNamespace("xmi","http://schema.omg.org/spec/XMI/
2.1");
XPath x = new XPath("./*[@xmi:type='cmof:Comment'])
x.addNamsepace(xmiNS)
> Another point is that the attributes started with "xmi:" aren't
> recognized by Jdom.
of course they are, they are attributes with namespace.
element.getAttribute("id",xmiNS);
> I've already tested a bunch of things to make it recognizable, but
> all of them were unsuccessful. =/
> I think that my problems are quite easy to solve, but I haven't
> found anything that could help me in the web.
> If Jdom isn't a great tool with XMI, could you suggest me other?
paul
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
smime.p7s
(application/pkcs7-signature, 2.2 KB) - not displayed