Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357340 - XSD: Improve Cryptic error message
Summary: XSD: Improve Cryptic error message
Status: RESOLVED WORKSFORME
Alias: None
Product: EMF
Classification: Modeling
Component: XSD (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-11 23:18 EDT by S Kalia CLA
Modified: 2023-01-12 11:52 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description S Kalia CLA 2011-09-11 23:18:13 EDT
Build Identifier: Eclipse 3.6.2  XSD plugin org.eclipse.xsd_2.6.0

Attached schema contains 2 elements in a model group with same name but different types which is not permitted in schema. The error message is very cryptic and user cannot figure out the exact problem. 

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/test"
	xmlns:tns="http://www.example.org/test" elementFormDefault="qualified">

	<xsd:element name="a" type="tns:Atype"></xsd:element>

	<xsd:complexType name="Atype">
		<xsd:sequence>
			<xsd:element name="MRM22B2A_GROUP06_E02">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="4" />
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>

			<xsd:element name="MRM22B2A_GROUP06_E02">
				<xsd:simpleType>
					<xsd:restriction base="xsd:string">
						<xsd:maxLength value="4" />
					</xsd:restriction>
				</xsd:simpleType>
			</xsd:element>
		</xsd:sequence>

	</xsd:complexType>
</xsd:schema>

The element 'http://www.example.org/test#MRM22B2A_GROUP06_E02' may not have both type 'http://www.example.org/test#MRM22B2A_GROUP06_E02_._type' and type 'http://www.example.org/test#MRM22B2A_GROUP06_E02_._type'	

Suggested improvement : 

Element declaration 'MRM22B2A_GROUP06_E102' has parent content model <sequence>, which prohibits duplicates with different types.

There are number of other error messages that are hard to understand. It would be much better if you can prefix each error message with a unique 8 digit error ID so the using products can look for this ID in the error message and issue an appropriate message. 




Reproducible: Always
Comment 1 Ed Merks CLA 2011-09-12 03:59:07 EDT
I really don't see that the suggestion is any less cryptic.  It doesn't seem worth the effort to change it.
Comment 2 S Kalia CLA 2011-09-12 09:35:16 EDT
(In reply to comment #1)
> I really don't see that the suggestion is any less cryptic.  It doesn't seem
> worth the effort to change it.

Based on feedback from users not intimately familiar with XML schema, they find it very hard to understand the current message. If you do not want to change the message, then please provide an enhancement to associate error message ID with the message, then using products can use the error id and issue an error message tailored for their audience.
Comment 3 Ed Merks CLA 2011-09-12 10:51:03 EDT
XSDDiagnostic.getKey already supports what you suggest,i.e., a key you can use to create your own detailed specialized messages, or just to add the key itself to the message string.

What you show here is kind of a corner case where there are two anonymous types with really no way of distinguishing the two types based on their names. Your suggestion also seems to deal only with this one corner case.