I think it is ok to add the get/setParent() to OMAttribute and
implement the restriction where the same attribute cannot be added to
two nodes.

Saliya can you pls send a patch with this change?

Thanks,
Ruchith

On 8/5/07, Saliya Ekanayake <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> OMAttribute interface doesn't provide methods to retrieve its parent.
> OMAttribute interface is implemented in the following classes,
>
>   1. org.apache.axiom.om.impl.llom.OMAttributeImpl
>   2. org.apache.axiom.om.xpath.DocumentNavigator.OMAttributeEx
>   3. org.apache.axiom.om.impl.dom.AttrImpl
>
> AttrImpl already has methods, getParent() and setParent() as it implememnts
> OMNode interface. OMAttributeEx also set the parent in its constructor. Thus
> adding a getParent() and setParent() method to OMAttribute interface would
> not affect these two implementations. Thus we can freely implement these two
> methods in OMAttributeImpl class.
>
> The issue is if we add a parent reference to OMAttirbute we need to restrict
> the use of an instance of OMAttribute only with a particular instance of
> OMElement, i.e. we can't do the following,
>
>     OMAttribute attr = //create an OMAttribute
>     OMElement e1 = //create an OMElement
>     OMElement e2 = //create another OMElement
>
>     e1.addAttribute(attr);//same attribute is added to both the elments
>     e2.addAttribute(attr);
>
> This restriction is infact obvious because if we allow this then an
> OMAttribute would have more than one parent which is of no use.
>
> Adding a method to retrieve the parent of an OMAttribute is really useful so
> I guess it is worth the cost to enforce this restriction.
>
> Your idea on this matter is greatly accepted
>
> Thanks in advance
>
> Saliya
>


-- 
www.ruchith.org
www.wso2.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to