You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Chris Simmons (JIRA)" <xe...@xml.apache.org> on 2005/12/14 17:20:45 UTC

[jira] Created: (XERCESJ-1123) Schema default attributes overwritten when names collide.

Schema default attributes overwritten when names collide.
---------------------------------------------------------

         Key: XERCESJ-1123
         URL: http://issues.apache.org/jira/browse/XERCESJ-1123
     Project: Xerces2-J
        Type: Bug
  Components: DOM (Level 3 Core)  
    Versions: 2.7.1    
 Environment: Linux.
    Reporter: Chris Simmons
    Priority: Minor


If you have an element with a schema-defaulted attribute, and another attribute with the same local name actually occurring on that element, then one of the attributes is lost.  This occurs when parsing (ie not an issue with the DOM tree as such).

I think the problem is that AbstractDOMParser does


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Resolved: (XERCESJ-1123) Schema default attributes overwritten when names collide.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1123?page=all ]
     
Michael Glavassevich resolved XERCESJ-1123:
-------------------------------------------

    Resolution: Fixed

We need to take special care of schema defaulted attributes. Calling the non-namespace aware setAttributeNode() method could overwrite another attribute with the same local name. Since we know all of the attributes in the document which were not defaulted from the schema will have unique qualified names and that all of the schema defaults will be at the end of the list we can add them to the element with setAttributeNode(). Schema defaults are added with setAttributeNodeNS(). Normally its unwise to mix these methods but the implementation of setAttributeNode() in Xerces is much more efficient [O(log n) instead of O(n)] than setAttributeNodeNS(), it would hurt performance if we switched over in all cases. Should be fixed in SVN now.

> Schema default attributes overwritten when names collide.
> ---------------------------------------------------------
>
>          Key: XERCESJ-1123
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1123
>      Project: Xerces2-J
>         Type: Bug

>   Components: DOM (Level 3 Core)
>     Versions: 2.7.1
>  Environment: Linux.
>     Reporter: Chris Simmons
>     Assignee: Michael Glavassevich
>     Priority: Minor
>  Attachments: bug.zip
>
> If you have an element with a schema-defaulted attribute, and another attribute with the same local name actually occurring on that element, then one of the attributes is lost.  This occurs when parsing (ie not an issue with the DOM tree as such).
> I think the problem is that AbstractDOMParser does

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XERCESJ-1123) Schema default attributes overwritten when names collide.

Posted by "Chris Simmons (JIRA)" <xe...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XERCESJ-1123?page=comments#action_12360429 ] 

Chris Simmons commented on XERCESJ-1123:
----------------------------------------

el.setAttributeNode (attr);

rather than

if (fNamespaceAware) {
  el.setAttributeNodeNS(attr);
}
else {
  el.setAttributeNode(attr);
}

> Schema default attributes overwritten when names collide.
> ---------------------------------------------------------
>
>          Key: XERCESJ-1123
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1123
>      Project: Xerces2-J
>         Type: Bug
>   Components: DOM (Level 3 Core)
>     Versions: 2.7.1
>  Environment: Linux.
>     Reporter: Chris Simmons
>     Priority: Minor

>
> If you have an element with a schema-defaulted attribute, and another attribute with the same local name actually occurring on that element, then one of the attributes is lost.  This occurs when parsing (ie not an issue with the DOM tree as such).
> I think the problem is that AbstractDOMParser does

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (XERCESJ-1123) Schema default attributes overwritten when names collide.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1123?page=all ]

Michael Glavassevich updated XERCESJ-1123:
------------------------------------------

    Fix Version/s: 2.8.1

> Schema default attributes overwritten when names collide.
> ---------------------------------------------------------
>
>                 Key: XERCESJ-1123
>                 URL: http://issues.apache.org/jira/browse/XERCESJ-1123
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: DOM (Level 3 Core)
>    Affects Versions: 2.7.1
>         Environment: Linux.
>            Reporter: Chris Simmons
>         Assigned To: Michael Glavassevich
>            Priority: Minor
>             Fix For: 2.8.1
>
>         Attachments: bug.zip
>
>
> If you have an element with a schema-defaulted attribute, and another attribute with the same local name actually occurring on that element, then one of the attributes is lost.  This occurs when parsing (ie not an issue with the DOM tree as such).
> I think the problem is that AbstractDOMParser does

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (XERCESJ-1123) Schema default attributes overwritten when names collide.

Posted by "Chris Simmons (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1123?page=all ]

Chris Simmons updated XERCESJ-1123:
-----------------------------------

    Attachment: bug.zip

The zip file contains a test demonstrating this.

File a.xml has an element with an attribute correctly defaulted.

File b.xml includes an attribute of the same local name in a different namespace.

The unit test shows that the attribute is correctly defaulted for a.xml but is lost for b.xml.

> Schema default attributes overwritten when names collide.
> ---------------------------------------------------------
>
>          Key: XERCESJ-1123
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1123
>      Project: Xerces2-J
>         Type: Bug
>   Components: DOM (Level 3 Core)
>     Versions: 2.7.1
>  Environment: Linux.
>     Reporter: Chris Simmons
>     Priority: Minor
>  Attachments: bug.zip
>
> If you have an element with a schema-defaulted attribute, and another attribute with the same local name actually occurring on that element, then one of the attributes is lost.  This occurs when parsing (ie not an issue with the DOM tree as such).
> I think the problem is that AbstractDOMParser does

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Assigned: (XERCESJ-1123) Schema default attributes overwritten when names collide.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1123?page=all ]

Michael Glavassevich reassigned XERCESJ-1123:
---------------------------------------------

    Assign To: Michael Glavassevich

> Schema default attributes overwritten when names collide.
> ---------------------------------------------------------
>
>          Key: XERCESJ-1123
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1123
>      Project: Xerces2-J
>         Type: Bug
>   Components: DOM (Level 3 Core)
>     Versions: 2.7.1
>  Environment: Linux.
>     Reporter: Chris Simmons
>     Assignee: Michael Glavassevich
>     Priority: Minor
>  Attachments: bug.zip
>
> If you have an element with a schema-defaulted attribute, and another attribute with the same local name actually occurring on that element, then one of the attributes is lost.  This occurs when parsing (ie not an issue with the DOM tree as such).
> I think the problem is that AbstractDOMParser does

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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