j2eeDom api needs some serious thought
I'm trying to have my own descriptors generated, and the xml stuff in the j2eeDom package seems somewhat badly thought out (well, to be honest, it doesn't seem thought out at all, let alone badly).
I might be missing something, but there seems to be no way currently to create attributes for xml data objects. Even worse, there is a method called 'createAttributeOn' which creates a child element.
So the questions that come to mind are:
1) Why the ridiculous naming scheme? An element is not an attribute, and mixing the two is confusing and misleading.
2) Why this separate API instead of just using JDOM in some way to allow callers to arbitrarily manipulate the xml for a descriptor? Why not extend JDOM classes or provide wrappers around them that still allow access to the underlying elements?
请先登录再写评论。
You can use jdom if you want, there is no necessity to use this api. It was
implemented to support renaming, references, completion. For example, if you
created reference to j2ee object this references will be renamed when object
was renamed. And there is special reference to psi class for example to
support a way to get or create this class. XmlObjectsCollection supports a
way to work with j2ee instances (to enable client to get the same object
even if xml was changed).
--
Olesya Smirnova
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Hani Suleiman" <hani@formicary.net> wrote in message
news:28239543.1086578386248.JavaMail.itn@is.intellij.net...
j2eeDom package seems somewhat badly thought out (well, to be honest, it
doesn't seem thought out at all, let alone badly).
>
create attributes for xml data objects. Even worse, there is a method called
'createAttributeOn' which creates a child element.
>
>
mixing the two is confusing and misleading.
>
callers to arbitrarily manipulate the xml for a descriptor? Why not extend
JDOM classes or provide wrappers around them that still allow access to the
underlying elements?
How? The factory specified to XmlbasedObjectsManager takes in two params, XmlBasedObject and XmlTag, and I don't see a way of adding an attribute to an element through either.
How about the naming issue? Don't you think methods like 'createAttributeOn' should be renamed to something more consistent like 'addChild'?
XmlBasedObject and XmlTag, and I don't see a way of adding an attribute to
an element through either.
>
You can do not use XmlbasedObjectsManager at all.
'createAttributeOn' should be renamed to something more consistent like
'addChild'?
Maybe... but this "child" can be subtag or attribute or even value based on
a tag name. Can you suggest some name suitable in all of these cases?
--
Olesya Smirnova
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Hani Suleiman" <hani@formicary.net> wrote in message
news:20781975.1086624033951.JavaMail.itn@is.intellij.net...
XmlBasedObject and XmlTag, and I don't see a way of adding an attribute to
an element through either.
>
'createAttributeOn' should be renamed to something more consistent like
'addChild'?
It can't though, from what I can see, a call to that method always creates a child element, never an attribute!
I'd actually like to use XmlbasedObjectsManager, if only it allowed me to add attributes and not just elements, I'd be happy!
Created object depends on XmlPath. When I called this object "attribute" I
meant attribute of a object but not xml attribute.
myXmlData.createAttributeOn(XmlPathFactory.getInstance().goToAttribute("id")
) is reference to xml attribute
myXmlData.createAttributeOn(XmlPathFactory.getInstance().goTo("id")) is
reference to xml tag
--
Olesya Smirnova
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Hani Suleiman" <hani@formicary.net> wrote in message
news:29384924.1086709960810.JavaMail.itn@is.intellij.net...
creates a child element, never an attribute!
>
add attributes and not just elements, I'd be happy!
it'll be renamed to "property"
--
Olesya Smirnova
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Hani Suleiman" <hani@formicary.net> wrote in message
news:29384924.1086709960810.JavaMail.itn@is.intellij.net...
creates a child element, never an attribute!
>
add attributes and not just elements, I'd be happy!