Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 346128

Summary: [content model] New XML Wizard creates invalid value for gMonth data type
Product: [WebTools] WTP Source Editing Reporter: Andrea Rice <arice>
Component: wst.xsdAssignee: Salvador Zalapa <zalapa>
Status: RESOLVED FIXED QA Contact: Keith Chong <keith.chong.ca>
Severity: normal    
Priority: P3 CC: arice, nsand.dev, spriet, zalapa
Version: unspecifiedFlags: nsand.dev: iplog+
nsand.dev: review+
Target Milestone: 3.5 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
An XSD file which includes the gMonth data type none

Description Andrea Rice CLA 2011-05-17 13:40:44 EDT
Build Identifier: M20110210-1200

There is an action to generate an XML instance document based on an XSD schema document.  If the schema contains elements of type gMonth, the value that is used to populate those fields is '--01--'.  However, according to the following schema documentation, the format should be '--01'.  

http://www.w3.org/TR/xmlschema11-2/#gMonth

There, the following is the regular expression for gMonth values:

--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?

The trailing slashes are thus invalid based on the above regular expression.

I am not positive but I think at one point there may have been an errata in the XML specification which may be why this format was used in the first place.  I believe the now erroneous format is accepted in some places but not all and it would be better to use the proper format of --01.

Reproducible: Always

Steps to Reproduce:
1.  Right-click the attached MyDateTestingTypes.xsd file
2.  Invoked the Generate > XML File... action
3.  In the New XML File Wizard, proceed to the second page and click the 'create optional elements' checkbox.
4.  Click OK to create the .xml file
Problem:  In the created file, the field 'a17_gMonth' has a value of '--01--'
Comment 1 Andrea Rice CLA 2011-05-17 13:42:09 EDT
Created attachment 195897 [details]
An XSD file which includes the gMonth data type
Comment 2 Salvador Zalapa CLA 2013-01-24 13:12:18 EST
Modifying the default value:
pushing to my mirror:

https://github.com/zalapa/webtools.sourceediting/commit/10319a7926bf6c811f6662a656182ddecbf0dd09
Comment 3 Nick Sandonato CLA 2013-02-13 11:47:06 EST
Patch looks good, Chava. Thanks!