My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 76: Convert From XML to XSD :- instance timestamp value conversion - NMTOKEN type takes priority over dateTime
2 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by blueheybrook, Apr 28, 2009
What steps will reproduce the problem?
1. Convert the attached SampleXML.xml file to XSD


What is the expected output? What do you see instead?

I expect to see value testDate="2004-07-21T10:00:00.000" converted to a 
dateTime type in the resulting XSD. Instead I see :-
<xs:attribute name="testDate" use="required" type="xs:NMTOKEN"/>

What version of the product are you using? On what operating system?
Latest trunk source, Windows XP Professional JDK1.6

Please provide any additional information below.

1. Type conversion priority appears to be controlled by the order of the 
type list in the class com.thaiopensource.xml.infer.DatatypeRepertoire

e.g

  static private final String[] typeNames = {
    "boolean",
    // XXX add int?
    "integer",
    "decimal",
    "double",
    "NCName",
    "NMTOKEN",
    "time",
    "date",
    "dateTime",
    "duration",
    "hexBinary",
    "base64Binary",
    "anyURI"
  };

The value "2004-07-21T10:00:00.000" will match NMTOKEN and dateTime, but 
as NMToken appears in the list before dateTime, therefore it is the chosen 
type, but not the most appropriate.

An obvious fix would be to shuffle the list so that NCName and NMTOKEN 
appear between the type anyURI and base64Binary. However I am not sure if 
this would have any knock on effect. 
simpleXML.xml
90 bytes   Download
Sign in to add a comment

Hosted by Google Code