Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348150 - descendent elements and attributes validated and available for content assist
Summary: descendent elements and attributes validated and available for content assist
Status: RESOLVED WONTFIX
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JAXB (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Paul Fullbright CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-02 18:55 EDT by Paul Fullbright CLA
Modified: 2011-07-01 15:54 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Fullbright CLA 2011-06-02 18:55:08 EDT
Given the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema 
	xmlns:test="http://example.org/test" 
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	targetNamespace="http://example.org/test">
   
   <xsd:complexType name="root">
      <xsd:sequence>
         <xsd:element name="wrapper" minOccurs="0">
            <xsd:complexType>
               <xsd:sequence>
                  <xsd:element name="element" type="xsd:string"/>
               </xsd:sequence>
            </xsd:complexType>
         </xsd:element>
      </xsd:sequence>
   </xsd:complexType>
   <xsd:element name="root" type="test:root"/>
</xsd:schema>

and test class:

@XmlType
@XmlRootElement(name = "root")
public class Root {
	
	@XmlElement(name = "element")
	private String element;
}


the element "element" is validated as correct, even though it exists *within* the element "wrapper" and is not a direct child of the "root" type.  When getting content assist for the @XmlElement.name() field, both "element" and "wrapper" are given as choices, even though "wrapper" is the only proper choice in this context.  (Note that if an @XmlElementWrapper(name = "wrapper") is used, then "element" is valid.)
Comment 1 Neil Hauge CLA 2011-06-14 14:54:06 EDT
This is borderline for maintenance, but depending on the fix, it may be appropriate.
Comment 2 Paul Fullbright CLA 2011-07-01 15:54:18 EDT
We've decided to not address this for 3.0.1.

At worst, you end up with incorrect validations.  If we fixed the bug, you could end up with incorrect invalidations (i.e. errors showing up in cases where there should be no error), particularly when used with @XmlElementWrapper.  Proper fixing would require addressing xml element wrapper validation, which considering the low impact of this bug, is out of scope for 3.0.1.

This is already addressed in head.