You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Glen Daniels (JIRA)" <ji...@apache.org> on 2007/08/06 20:17:59 UTC

[jira] Commented: (WSCOMMONS-230) Method to retrieve the owner element of an OMAttribute instance

    [ https://issues.apache.org/jira/browse/WSCOMMONS-230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517995 ] 

Glen Daniels commented on WSCOMMONS-230:
----------------------------------------

Hi Saliya!

I don't think we should do this.  If you have an explicit setParent() method, you open yourself up to broken object models.  Simple example, if you just call attr.setParent(elem) before calling elem.addChild(attr), you now have a "floating" attribute that *thinks* it belongs to the OMElelement "elem", but it doesn't!  The only way to set the parent of an OMAttribute, IMO, should be to actually add it as a child to an OMElement.  This makes sure all the structural constraints are always correct.

I agree an OMAttribute should *have* a single parent, and perhaps an exception should be thrown if you try to "relocate" one that has already been added to an element, but I am opposed to an API which allows setting the parent outside of the normal structure-building APIs.

Thanks,
--Glen


> Method to retrieve the owner element of an OMAttribute instance
> ---------------------------------------------------------------
>
>                 Key: WSCOMMONS-230
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-230
>             Project: WS-Commons
>          Issue Type: Improvement
>          Components: AXIOM
>            Reporter: Saliya Ekanayake
>            Priority: Minor
>         Attachments: omattribute_patch.txt
>
>
> Providing methods to set and get the owner element of an instance of OMAttribute is pretty much useful. An OMAttribute instance is then restricted to be added only to a single OMElement instance (DOM Attr has similar restriction).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org