Help Required to understand namespaceNormalization Algorithms

Hi All,
I need help to understand namespaceNormalization() algorithm given in DOM level 3 specifications,i have given my understanding also
plz correct my understanding if i am wrong,For u people these questions might be very silly 

void Element.normalizeNamespaces()
{
  if ( Element's namespaceURI != null )
  {
    if ( Element's prefix/namespace pair (or default namespace,if no prefix) are within the scope of a binding )
    {
      ==> do nothing, declaration in scope is inherited

   ????? > if namespace  is already declared in the current element or in ancestors   do nothing    am i correct  ?????
         
    }
    else
    {
      ==> Create a local namespace declaration attr for this namespace,with Element's current prefix (or a default namespace, if  no prefix). 
       
         >if the namespace is not declared create an Attr for namespace declaration
       
     ==>If there's a conflicting local declaration already present, change its value to use this namespace.

        >if already any other namespace declaration with same prefix present...change its value to use this name
  ???? ?>  Here i have a question suppose i have  attribute attX which is using the conflicting local declaration (which is going to be changed as mentioned above)
             What shall i do here?shall i change the prefix of attrX...suggest me,
   
   }
  }
 

  for ( all Attrs of Element )
  {
    if ( Attr[i] has a namespace URI )
    {
      if ( Attr has no prefix, or has a prefix that conflicts with a binding already active in scope )

   ?????>"  has a prefix that conflicts with a binding already active in scope  " what it means?
      {
  ??????????>can u explain the following conditions?

        if ( Element is in the scope of a non default binding for this namespace )
        {
          if ( one or more prefix bindings are available )
          {
            if ( one is locally defined )
            {
              ==> pick that one. 
            }
            else
            {
              ==> pick one arbitrarily 
            }
            ==> Change the Attr to use that prefix.
          }
          else
          {
            ==> Create a local namespace declaration attr for this namespace with a prefix not already used in the current scope and following
            the pattern "NS" + index (starting at 1).

            Change the Attr to use this prefix.
     
          }
        }
      }
 
Thanks in advance,
Regards,
pavithran

Received on Wednesday, 2 October 2002 05:40:15 UTC