date fromat in xmlGenerator
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 3
- Joined: Thu Jan 12, 2017 12:59 pm
date fromat in xmlGenerator
Hi,
I am trying to generate date format from xsd file through xml generator
to do so I am defining the date in XSD.
It actually generates the appropriate date but the document checker raise an error saying that the value of the element is not valid, do you have an Idea of why this error is raised ?
generated date is : <myType>2006-05-04T18:13:51.0</myType>
Regards
I am trying to generate date format from xsd file through xml generator
to do so I am defining the date in XSD.
Code: Select all
<xs:simpleType name="myType">
<xs:restriction base="xs:dateTime">
<xs:pattern value="\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d\d\d\d"/>
</xs:restriction>
</xs:simpleType>
generated date is : <myType>2006-05-04T18:13:51.0</myType>
Regards
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: date fromat in xmlGenerator
Hi,
Check the full error message from the manual validation (Document > Validate >Validate, Ctrl+Shift+V). It explains that the value is invalid with respect to your restriction pattern.
If that was not your intention (to force the use of 6 digits for milliseconds), you can relax the pattern a bit. Replace the trailing "\.\d\d\d\d\d\d" with "\.\d+" (one or more digits).
Regards,
Adrian
Check the full error message from the manual validation (Document > Validate >Validate, Ctrl+Shift+V). It explains that the value is invalid with respect to your restriction pattern.
To clarify, your pattern specifies 6 digits for milliseconds (after the last dot), but the XML Generator has generated it as a xs:dateTime and specified just one digit ("0"). It will validate with 6 digits, "000000".cvc-pattern-valid: Value '2006-05-04T18:13:51.0' is not facet-valid with respect to pattern '\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d\d\d\d' for type
If that was not your intention (to force the use of 6 digits for milliseconds), you can relax the pattern a bit. Replace the trailing "\.\d\d\d\d\d\d" with "\.\d+" (one or more digits).
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 3
- Joined: Thu Jan 12, 2017 12:59 pm
Re: date fromat in xmlGenerator
Hi Adrian,
Thank you for your answer. The thing that I do not understand is that the date I have on xml was generated by Oxygen from the xsd file so why it is not following the given pattern ?
Maybe the restriction is not taken into account ?
Regards,
Magaly
Thank you for your answer. The thing that I do not understand is that the date I have on xml was generated by Oxygen from the xsd file so why it is not following the given pattern ?
Maybe the restriction is not taken into account ?
Regards,
Magaly
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: date fromat in xmlGenerator
Hi,
Given the example you have provided, you most likely have in Generate Sample XML Files > Options > Settings, "Values of elements and attributes" set to "Default (ignore restrictions)". It should be set to "Random (apply restrictions)".
However, in this case I see it's not working, not even with the correct option being set. The problem seems to be that dateTime is already defining a base pattern for the value and the XML Generator is unable to compose/deduce a single regex pattern (needed for random generation with restrictions) that satisfies both the dateTime pattern and your restriction pattern. It picks the first pattern (dateTime) and uses that.
I've logged this on our issue tracking tool to investigate if there's a way to accommodate this.
Regards,
Adrian
Given the example you have provided, you most likely have in Generate Sample XML Files > Options > Settings, "Values of elements and attributes" set to "Default (ignore restrictions)". It should be set to "Random (apply restrictions)".
However, in this case I see it's not working, not even with the correct option being set. The problem seems to be that dateTime is already defining a base pattern for the value and the XML Generator is unable to compose/deduce a single regex pattern (needed for random generation with restrictions) that satisfies both the dateTime pattern and your restriction pattern. It picks the first pattern (dateTime) and uses that.
I've logged this on our issue tracking tool to investigate if there's a way to accommodate this.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 1
- Joined: Tue Sep 19, 2017 6:37 pm
Re: date fromat in xmlGenerator
Hello,
Are there any development on this issue? I'm facing a similar problem. With the following element definition:
The xmlGenerator generates the following: <TimeStamp>2019-08-07T11:22:04</TimeStamp>.
While this TimeStamp is a valid date and time, it does not follow the min/max inclusive restrictions.
Are there any development on this issue? I'm facing a similar problem. With the following element definition:
Code: Select all
<xs:element name="TimeStamp">
<xs:simpleType>
<xs:restriction base="xs:dateTime">
<xs:minInclusive value="2016-01-01T00:00:00"/>
<xs:maxInclusive value="2017-08-31T23:59:59"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
While this TimeStamp is a valid date and time, it does not follow the min/max inclusive restrictions.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: date fromat in xmlGenerator
Hi,
There is no development in this regard.
Currently there is no way for the pattern generator to combine the two patterns into one.
Regards,
Adrian
There is no development in this regard.
Currently there is no way for the pattern generator to combine the two patterns into one.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service