axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eran Chinthaka" <chinth...@opensource.lk>
Subject RE: [Axis2][OM] Simpler way to get NameSpace
Date Mon, 13 Dec 2004 10:25:52 GMT

>>
>>"Glen Daniels" <glen@thoughtcraft.com> writes:
>>> 3) Map namespaces at a given OMElement:
>>>
>>>    void registerNamespace(String uri, String prefix)
>>
>>declareNamespace(.,.)?
>>
>>> 4) Ensure that we have a consistent view on what is a namespace
>>> declaration and what is an attribute.  For this XML:
>>>
>>>    <foo xmlns:ns1="http://ns1" attr1="bar"/>
>>>
>>> EITHER:
>>>
>>> getAttributes() returns JUST attr1, and getAllAttributes() returns both
>>> the ns1 declaration and att1
>>>
>>> OR:
>>>
>>> getAttributes() returns both attributes.
>>>
>>> I prefer the former.  In either case I think we should consistency check
>>> attributes by noticing if they are namespace declarations when they get
>>> added.  After this:
>>>
>>>    OMAttribute attr = new OMAttribute(new QName(XMLNS, "ns1"),
>>>                                       "http://ns1");
>>>    element.addAttribute(attr);
>>>
>>> The element should now have a new namespace mapping, and our code should
>>> complain if the "ns1" prefix is already mapped in this element.
>>
>>So this comes down to whether the AXIOM representation is for XML 1.0
>>or XML 1.0 + Namespaces. My pref would be to say that its *only* a
>>namespace aware Infoset model and *never* treat namespace declarations
>>as attributes.
>>
>>That means, getAttribues() only returns "attr1" and we don't have
>>something called getAllAttributes().

[Chinthaka] I also agree with you for not returning namespaces, when asked
for allAttributes()

Current OMElement is like this.

We have a getAllAttributes() to return a collection of *only* the
attributes.
We have getAllDeclaredNamespaces() in OMElement to retrieve all the
namespaces declared in this element (not in the scope).

In addition to that we have following methods as Sanjiva and Alek suggested
earlier.

public OMNamespace declareNamespace(String uri, String prefix);
    public OMNamespace declareNamespace(OMNamespace namespace);

    public OMNamespace findInScopeNamespace(String uri, String prefix)
throws OMException;

    public OMNamespace findDeclaredNamespace(String uri, String prefix)
throws OMException;


Thankx and regards
-- Eran Chinthaka

>>
>>Sanjiva.
>>




Mime
View raw message