History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-820
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jeen Broekstra
Reporter: Jeen Broekstra
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sesame

Extend XMLDatatypeUtil.isValidValue to cover all primitive XSD datatypes

Created: 23/Aug/11 11:14 PM   Updated: 23/Sep/11 05:55 AM
Component/s: Rio
Affects Version/s: None
Fix Version/s: 2.5.1


 Description   
The Rio parser uses XMLDatatypeUtil.isValidValue to perform validation on datatyped literals. However, this method currently only covers a small subset of XSD datatypes (it checks numeric literals and xsd:dateTime, but not xsd:gYear, or XMLLiteral, for example). It should be relatively easy to extend this method to do syntactical validation checks on these datatypes without great loss of performance.

 All   Comments   Change History      Sort Order:
Comment by Jeen Broekstra [24/Aug/11 10:58 PM]
Comment from Barry:

I noticed something probably inefficient in the implementation of the validation code:

XMLDatatypeUtil.normalizeDecimal(), line 557

String errMsg = "Not a legal decimal: " + decimal;

This string is created when validating every literal, even if it is not used (the majority of cases). I think it would be better to make an exception throwing utility method instead and pass in 'decimal'.

There are possibly more examples like this in this class.

Comment by Jeen Broekstra [01/Sep/11 05:05 AM]
Good point barry, have fixed while I was doing work on extended validation anyway.

In progress. validation of most calendar types now works, onwards an upwards towards more exotic datatype (e.g. hexbinary).

Comment by Jeen Broekstra [06/Sep/11 12:28 AM]
Validation of all primitive xsd datatypes is now implemented, with the following exceptions: xsd:base64Binary, xsd:hexBinary, xsd:anyURI and xsd:QName. For the these formats, validation could conceivably be added, but it seems more trouble than it's worth at the moment (it basically requires a full parser as their lex value syntax is too complex for a simple regex validation).

If we do decide we need validation for these types, we can open separate tasks for each type.

Comment by Jeen Broekstra [23/Sep/11 05:55 AM]
also added support for xsd:QName validation.