fast-xml-parser
fast-xml-parser copied to clipboard
Feature: Validate XML against XSD
I noticed that there is no way to validate a XML file against a XSD file. This would be a great feature for this project and would prevent people parsing invalid XML files.
I'm glad you find this repository helpful. I'll try to address your issu ASAP. You can watch the repo for new changes or star it.
FXP is basically a syntax parser. But yes, parsing/validating against XSD is required in many cases. Hence, it is in the plan in the next major release.
FXP is basically a syntax parser. But yes, parsing/validating against XSD is required in many cases. Hence, it is in the plan in the next major release.
First of all , thanks Amit for this excellent library. Just wanted to know, is there any timeline that you have planned for this feature? This would be really useful.
@anoop29 I'm working on FXP v4. This will take some time to complete. I have to then incorporate some priority issues in that. And then I'll pick this feature. Working in free time, I currently can't comment on any timelines. But hoping to complete v4 in next 2 weeks.
Hi, any update on this?
@amitguptagwl any news on this?
Sorry I have taken a big gape from opensource in this pandemic. I'm completing cytorus and then will pick FXP v4. Sorry for the delay. But this feature is gonna take long time.
@amitguptagwl thank you! I personally want validation by xsd schema it's very important for me now, if you find time to implement that, it's will be very good!
This feature will be killing if done ;')
I have a case, duno if is going to work but, xsd files sometimes uses 'refs' and imports another xsd files namespaces to resolve the full xsd. An example is https://cpe.sunat.gob.pe/sites/default/files/inline-files/XSD%202.1.zip
from https://cpe.sunat.gob.pe/node/88
These xsd files are used to validate against UBL 2.1 xml standard.
The main xsd is XSD 2.1/maindoc/UBL-Invoice-2.1.xsd
and it calls other namespaces from around the dir.
Hope the funcion that calls validation understands and resolves agains relative references from those files ;')
This would also help with https://github.com/NaturalIntelligence/fast-xml-parser/issues/279
Without the schema, there's no real way it could determine that both of these are strings:
<FullName>Joe Schmoe</FullName>
<PhoneNumber>1234567890</PhoneNumber>
But it could properly differentiate if aware of a schema:
<xsd:element name="FullName" type="xsd:string"/>
<xsd:element name="PhoneNumber" type="xsd:string"/>
It would be really useful feature. Please take consider that there are no consistent library doing xsd validation. If anyone knows, please notify me. Thank you.
without parsing xml using xsd schema, for complex large structures this library is useless. @ehaynes99 show small example of it.
All, I've just completed detailed-xml-validator for some other need. Can you please explore and provide your feedback based on your need.
@amitguptagwl a new schema format is cool I guess, but it doesn't replace the xsd schemas already out there that are used to validate xml files. Imo this issue should be reopened.
@Narretz I found XSD little complex than the new format I used in detailed-xml-validator. Though, I've not add more features in that but some existing features make it easy to use. And direct embedding of rules make it to be used by non-technical people as well. Hence, there is no plan for XSD validation currently,