Last post Jul 13, 2018 09:45 AM by jimmy69
Contributor
2195 Points
950 Posts
Jul 12, 2018 02:15 PM|jimmy69|LINK
Hello all,
Imagine this scenario, i have some mobile app on android.
this app, create xml file with some information and see to a ftp.
Sometimes and i don't know actually why we receive some xml who some tag <tag> are not closed ...
I would like to know how i can detect in a xml file the node who is not closed and close it of course ?
Here is it the structure of the xml file
<parent> <chid1> <datas1></datas1> <datas2></datas2> </child1> <child2> <datas1></datas1> <datas2></datas2> </child2> </parent>
thanks for all
All-Star
52201 Points
23274 Posts
Jul 12, 2018 03:14 PM|mgebhard|LINK
XML schemas (XSD) are used to validate XML documents,
https://docs.microsoft.com/en-us/dotnet/standard/data/xml/xml-schema-xsd-validation-with-xmlschemaset
https://msdn.microsoft.com/en-us/library/ms162371(v=vs.110).aspx
Member
740 Points
321 Posts
Jul 13, 2018 09:15 AM|Abraham Qian|LINK
Hi Jimmy69,
According to your description, I think we could use XML Schema Definition Language to validate XML.
Here is official document about how to customize the validation XML document
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml
Here is a XMLValidation sample.
http://xmlvalidation.com/example/
For some custom grammar rule validation, I think you could view the relevant documents below.
https://docs.microsoft.com/en-us/dotnet/api/system.xml.schema.extensions.validate?view=netframework-4.7.2
Best Regards
Abraham
Jul 13, 2018 09:45 AM|jimmy69|LINK
thanks for your ideas, link that's great to share your knowledge ...
for me the best solutino (fast) it's to get all the xml file in ftp with a cmd project who runs every night and check the validay of these files ...
if ok => do nothing / if not ok => open xml and find the bad node and TRY to close the node ...
because, find the error, make the correction, test the app on device, and deploy will take more time ...
Off course, the bug will be find and a correction also but i'm holiday ...in a few day :) :)
see your next time guys
Contributor
2195 Points
950 Posts
xml file => how to know if a tag is well closed ?
Jul 12, 2018 02:15 PM|jimmy69|LINK
Hello all,
Imagine this scenario, i have some mobile app on android.
this app, create xml file with some information and see to a ftp.
Sometimes and i don't know actually why we receive some xml who some tag <tag> are not closed ...
I would like to know how i can detect in a xml file the node who is not closed and close it of course ?
Here is it the structure of the xml file
thanks for all
All-Star
52201 Points
23274 Posts
Re: xml file => how to know if a tag is well closed ?
Jul 12, 2018 03:14 PM|mgebhard|LINK
XML schemas (XSD) are used to validate XML documents,
https://docs.microsoft.com/en-us/dotnet/standard/data/xml/xml-schema-xsd-validation-with-xmlschemaset
https://msdn.microsoft.com/en-us/library/ms162371(v=vs.110).aspx
Member
740 Points
321 Posts
Re: xml file => how to know if a tag is well closed ?
Jul 13, 2018 09:15 AM|Abraham Qian|LINK
Hi Jimmy69,
According to your description, I think we could use XML Schema Definition Language to validate XML.
Here is official document about how to customize the validation XML document
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml
Here is a XMLValidation sample.
http://xmlvalidation.com/example/
For some custom grammar rule validation, I think you could view the relevant documents below.
https://docs.microsoft.com/en-us/dotnet/api/system.xml.schema.extensions.validate?view=netframework-4.7.2
Best Regards
Abraham
Contributor
2195 Points
950 Posts
Re: xml file => how to know if a tag is well closed ?
Jul 13, 2018 09:45 AM|jimmy69|LINK
Hello all,
thanks for your ideas, link that's great to share your knowledge ...
for me the best solutino (fast) it's to get all the xml file in ftp with a cmd project who runs every night and check the validay of these files ...
if ok => do nothing / if not ok => open xml and find the bad node and TRY to close the node ...
because, find the error, make the correction, test the app on device, and deploy will take more time ...
Off course, the bug will be find and a correction also but i'm holiday ...in a few day :) :)
see your next time guys