How to restrict the date and time in Schema?XML Schema (XSD) validation tool?How to save application settings in a Windows Forms Application?How do I parse XML in Python?How do you parse and process HTML/XML in PHP?How to rollback a specific migration?Getting attribute using XPathExtract value of attribute node via XPathHow to pretty print XML from the command line?XML Schema (XSD) element with enumeration and child elementHow to restrict number of child elements in XSD 1.0?
How does Vivi differ from other Black Mages?
Can I say "I have encrypted something" if I hash something?
How do you build a Dominant 7th chord?
Random point on a sphere
Do Milankovitch Cycles fully explain climate change?
Relevance of the Resurrection
The Royal Mint of Alphagonia
Dividing Divisive Divisors
How would a village use its river that it shares with another village downstream?
Is there a star over my head?
I changed a word from a source, how do I cite it correctly?
Variable Prefixes and Suffixes
What is the use of FullForm in Mathematica?
Has any object launched from Earth gone into the Sun?
A medieval fantasy adventurer lights a torch in a 100% pure oxygen room. What happens?
Why did it become so much more expensive to start a university?
How to help my 2.5-year-old daughter take her medicine when she refuses to?
Tall red piece with coffee cup, phone and gas picture?
Kingdom Map and Travel Pace
How can a PC determine what planes a Cubic Gate is linked to?
Do all humans have an identical nucleotide sequence for certain proteins, e.g haemoglobin?
Is the definition of integral extension, why we use monic polynomial?
Should I use my toaster oven for slow roasting?
Why do sellers care about down payments?
How to restrict the date and time in Schema?
XML Schema (XSD) validation tool?How to save application settings in a Windows Forms Application?How do I parse XML in Python?How do you parse and process HTML/XML in PHP?How to rollback a specific migration?Getting attribute using XPathExtract value of attribute node via XPathHow to pretty print XML from the command line?XML Schema (XSD) element with enumeration and child elementHow to restrict number of child elements in XSD 1.0?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have the following element in XML File:
<checkinfo checksum="2af4" txtime="04:35pm" txdate="2/17/07" />
How can i restrict the values in XSD from txtime and txdate
to accept only values like 03:15:pm and 03/07/2018
xml schema xsd-1.0
add a comment |
I have the following element in XML File:
<checkinfo checksum="2af4" txtime="04:35pm" txdate="2/17/07" />
How can i restrict the values in XSD from txtime and txdate
to accept only values like 03:15:pm and 03/07/2018
xml schema xsd-1.0
Do you really have to use these date and time formats? Wouldn't it be better to adopt international standards and use 2018-07-03 and 16:35?
– Michael Kay
Mar 28 at 13:01
Yes, because the XML File is given and I need to adapt the XSD Schema with this file..
– MitKan
Mar 31 at 9:10
I think you (well, someone) has made a bad design decision and you are now paying the cost of the mistake. When that happens, it's best not to dig yourself deeper into the hole.
– Michael Kay
Mar 31 at 18:26
add a comment |
I have the following element in XML File:
<checkinfo checksum="2af4" txtime="04:35pm" txdate="2/17/07" />
How can i restrict the values in XSD from txtime and txdate
to accept only values like 03:15:pm and 03/07/2018
xml schema xsd-1.0
I have the following element in XML File:
<checkinfo checksum="2af4" txtime="04:35pm" txdate="2/17/07" />
How can i restrict the values in XSD from txtime and txdate
to accept only values like 03:15:pm and 03/07/2018
xml schema xsd-1.0
xml schema xsd-1.0
edited Mar 28 at 8:51
JIJOMON K.A
1,1412 gold badges7 silver badges24 bronze badges
1,1412 gold badges7 silver badges24 bronze badges
asked Mar 28 at 8:43
MitKanMitKan
86 bronze badges
86 bronze badges
Do you really have to use these date and time formats? Wouldn't it be better to adopt international standards and use 2018-07-03 and 16:35?
– Michael Kay
Mar 28 at 13:01
Yes, because the XML File is given and I need to adapt the XSD Schema with this file..
– MitKan
Mar 31 at 9:10
I think you (well, someone) has made a bad design decision and you are now paying the cost of the mistake. When that happens, it's best not to dig yourself deeper into the hole.
– Michael Kay
Mar 31 at 18:26
add a comment |
Do you really have to use these date and time formats? Wouldn't it be better to adopt international standards and use 2018-07-03 and 16:35?
– Michael Kay
Mar 28 at 13:01
Yes, because the XML File is given and I need to adapt the XSD Schema with this file..
– MitKan
Mar 31 at 9:10
I think you (well, someone) has made a bad design decision and you are now paying the cost of the mistake. When that happens, it's best not to dig yourself deeper into the hole.
– Michael Kay
Mar 31 at 18:26
Do you really have to use these date and time formats? Wouldn't it be better to adopt international standards and use 2018-07-03 and 16:35?
– Michael Kay
Mar 28 at 13:01
Do you really have to use these date and time formats? Wouldn't it be better to adopt international standards and use 2018-07-03 and 16:35?
– Michael Kay
Mar 28 at 13:01
Yes, because the XML File is given and I need to adapt the XSD Schema with this file..
– MitKan
Mar 31 at 9:10
Yes, because the XML File is given and I need to adapt the XSD Schema with this file..
– MitKan
Mar 31 at 9:10
I think you (well, someone) has made a bad design decision and you are now paying the cost of the mistake. When that happens, it's best not to dig yourself deeper into the hole.
– Michael Kay
Mar 31 at 18:26
I think you (well, someone) has made a bad design decision and you are now paying the cost of the mistake. When that happens, it's best not to dig yourself deeper into the hole.
– Michael Kay
Mar 31 at 18:26
add a comment |
1 Answer
1
active
oldest
votes
You cant change the date type to a specific format but you can take it as a string and choose a specific format that you want.
For the format of date MM/DD/YYYY. the code snippet is given below.
<xs:element name="StartDate">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="d2[/]d2[/]d4"></xs:pattern>
<xs:length value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
For more info please refer
https://www.w3schools.com/xml/schema_dtypes_date.asp
you can simply restict to date and time format as given in the link below. For custom date time you need to use a pattern. If this helps please accept the answer thanks
– Tushar Narang
Mar 28 at 9:00
Thanks for your answer, but it's not working after I tried to validate I got two errors: Description Resource Path Location Type cvc-attribute.3: The value '2/17/07' of attribute 'txdate' on element 'checkinfo' is not valid with respect to its type, 'null'. fax.xml /XML/src/faxExercise line 19 XML Problem &&&&&&& Description Resource Path Location Type cvc-pattern-valid: Value '2/17/07' is not facet-valid with respect to pattern 'd2[/]d2[/]d4' for type '#AnonType_txdatecheckinfoType'. fax.xml /XML/src/faxExercise line 19 XML Problem
– MitKan
Mar 28 at 9:17
The regex given requires two-digits for day and month. It also makes no attempt to make 2/31/2019 invalid, for that you will need a MUCH more complex regular expression.
– Michael Kay
Mar 31 at 18:28
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393282%2fhow-to-restrict-the-date-and-time-in-schema%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You cant change the date type to a specific format but you can take it as a string and choose a specific format that you want.
For the format of date MM/DD/YYYY. the code snippet is given below.
<xs:element name="StartDate">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="d2[/]d2[/]d4"></xs:pattern>
<xs:length value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
For more info please refer
https://www.w3schools.com/xml/schema_dtypes_date.asp
you can simply restict to date and time format as given in the link below. For custom date time you need to use a pattern. If this helps please accept the answer thanks
– Tushar Narang
Mar 28 at 9:00
Thanks for your answer, but it's not working after I tried to validate I got two errors: Description Resource Path Location Type cvc-attribute.3: The value '2/17/07' of attribute 'txdate' on element 'checkinfo' is not valid with respect to its type, 'null'. fax.xml /XML/src/faxExercise line 19 XML Problem &&&&&&& Description Resource Path Location Type cvc-pattern-valid: Value '2/17/07' is not facet-valid with respect to pattern 'd2[/]d2[/]d4' for type '#AnonType_txdatecheckinfoType'. fax.xml /XML/src/faxExercise line 19 XML Problem
– MitKan
Mar 28 at 9:17
The regex given requires two-digits for day and month. It also makes no attempt to make 2/31/2019 invalid, for that you will need a MUCH more complex regular expression.
– Michael Kay
Mar 31 at 18:28
add a comment |
You cant change the date type to a specific format but you can take it as a string and choose a specific format that you want.
For the format of date MM/DD/YYYY. the code snippet is given below.
<xs:element name="StartDate">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="d2[/]d2[/]d4"></xs:pattern>
<xs:length value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
For more info please refer
https://www.w3schools.com/xml/schema_dtypes_date.asp
you can simply restict to date and time format as given in the link below. For custom date time you need to use a pattern. If this helps please accept the answer thanks
– Tushar Narang
Mar 28 at 9:00
Thanks for your answer, but it's not working after I tried to validate I got two errors: Description Resource Path Location Type cvc-attribute.3: The value '2/17/07' of attribute 'txdate' on element 'checkinfo' is not valid with respect to its type, 'null'. fax.xml /XML/src/faxExercise line 19 XML Problem &&&&&&& Description Resource Path Location Type cvc-pattern-valid: Value '2/17/07' is not facet-valid with respect to pattern 'd2[/]d2[/]d4' for type '#AnonType_txdatecheckinfoType'. fax.xml /XML/src/faxExercise line 19 XML Problem
– MitKan
Mar 28 at 9:17
The regex given requires two-digits for day and month. It also makes no attempt to make 2/31/2019 invalid, for that you will need a MUCH more complex regular expression.
– Michael Kay
Mar 31 at 18:28
add a comment |
You cant change the date type to a specific format but you can take it as a string and choose a specific format that you want.
For the format of date MM/DD/YYYY. the code snippet is given below.
<xs:element name="StartDate">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="d2[/]d2[/]d4"></xs:pattern>
<xs:length value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
For more info please refer
https://www.w3schools.com/xml/schema_dtypes_date.asp
You cant change the date type to a specific format but you can take it as a string and choose a specific format that you want.
For the format of date MM/DD/YYYY. the code snippet is given below.
<xs:element name="StartDate">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="d2[/]d2[/]d4"></xs:pattern>
<xs:length value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
For more info please refer
https://www.w3schools.com/xml/schema_dtypes_date.asp
answered Mar 28 at 8:54
Tushar NarangTushar Narang
8762 gold badges13 silver badges44 bronze badges
8762 gold badges13 silver badges44 bronze badges
you can simply restict to date and time format as given in the link below. For custom date time you need to use a pattern. If this helps please accept the answer thanks
– Tushar Narang
Mar 28 at 9:00
Thanks for your answer, but it's not working after I tried to validate I got two errors: Description Resource Path Location Type cvc-attribute.3: The value '2/17/07' of attribute 'txdate' on element 'checkinfo' is not valid with respect to its type, 'null'. fax.xml /XML/src/faxExercise line 19 XML Problem &&&&&&& Description Resource Path Location Type cvc-pattern-valid: Value '2/17/07' is not facet-valid with respect to pattern 'd2[/]d2[/]d4' for type '#AnonType_txdatecheckinfoType'. fax.xml /XML/src/faxExercise line 19 XML Problem
– MitKan
Mar 28 at 9:17
The regex given requires two-digits for day and month. It also makes no attempt to make 2/31/2019 invalid, for that you will need a MUCH more complex regular expression.
– Michael Kay
Mar 31 at 18:28
add a comment |
you can simply restict to date and time format as given in the link below. For custom date time you need to use a pattern. If this helps please accept the answer thanks
– Tushar Narang
Mar 28 at 9:00
Thanks for your answer, but it's not working after I tried to validate I got two errors: Description Resource Path Location Type cvc-attribute.3: The value '2/17/07' of attribute 'txdate' on element 'checkinfo' is not valid with respect to its type, 'null'. fax.xml /XML/src/faxExercise line 19 XML Problem &&&&&&& Description Resource Path Location Type cvc-pattern-valid: Value '2/17/07' is not facet-valid with respect to pattern 'd2[/]d2[/]d4' for type '#AnonType_txdatecheckinfoType'. fax.xml /XML/src/faxExercise line 19 XML Problem
– MitKan
Mar 28 at 9:17
The regex given requires two-digits for day and month. It also makes no attempt to make 2/31/2019 invalid, for that you will need a MUCH more complex regular expression.
– Michael Kay
Mar 31 at 18:28
you can simply restict to date and time format as given in the link below. For custom date time you need to use a pattern. If this helps please accept the answer thanks
– Tushar Narang
Mar 28 at 9:00
you can simply restict to date and time format as given in the link below. For custom date time you need to use a pattern. If this helps please accept the answer thanks
– Tushar Narang
Mar 28 at 9:00
Thanks for your answer, but it's not working after I tried to validate I got two errors: Description Resource Path Location Type cvc-attribute.3: The value '2/17/07' of attribute 'txdate' on element 'checkinfo' is not valid with respect to its type, 'null'. fax.xml /XML/src/faxExercise line 19 XML Problem &&&&&&& Description Resource Path Location Type cvc-pattern-valid: Value '2/17/07' is not facet-valid with respect to pattern 'd2[/]d2[/]d4' for type '#AnonType_txdatecheckinfoType'. fax.xml /XML/src/faxExercise line 19 XML Problem
– MitKan
Mar 28 at 9:17
Thanks for your answer, but it's not working after I tried to validate I got two errors: Description Resource Path Location Type cvc-attribute.3: The value '2/17/07' of attribute 'txdate' on element 'checkinfo' is not valid with respect to its type, 'null'. fax.xml /XML/src/faxExercise line 19 XML Problem &&&&&&& Description Resource Path Location Type cvc-pattern-valid: Value '2/17/07' is not facet-valid with respect to pattern 'd2[/]d2[/]d4' for type '#AnonType_txdatecheckinfoType'. fax.xml /XML/src/faxExercise line 19 XML Problem
– MitKan
Mar 28 at 9:17
The regex given requires two-digits for day and month. It also makes no attempt to make 2/31/2019 invalid, for that you will need a MUCH more complex regular expression.
– Michael Kay
Mar 31 at 18:28
The regex given requires two-digits for day and month. It also makes no attempt to make 2/31/2019 invalid, for that you will need a MUCH more complex regular expression.
– Michael Kay
Mar 31 at 18:28
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393282%2fhow-to-restrict-the-date-and-time-in-schema%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you really have to use these date and time formats? Wouldn't it be better to adopt international standards and use 2018-07-03 and 16:35?
– Michael Kay
Mar 28 at 13:01
Yes, because the XML File is given and I need to adapt the XSD Schema with this file..
– MitKan
Mar 31 at 9:10
I think you (well, someone) has made a bad design decision and you are now paying the cost of the mistake. When that happens, it's best not to dig yourself deeper into the hole.
– Michael Kay
Mar 31 at 18:26