nikku / node-xsd-schema-validator

A schema (XSD) validator for NodeJS
https://www.npmjs.com/package/xsd-schema-validator
MIT License
52 stars 24 forks source link

[question] find xsd by xsi:schemaLocation #23

Closed joneldiablo closed 3 years ago

joneldiablo commented 3 years ago

its possible validate xml files usign the xsi:schemaLocation attribute from the xml file? I have an xml which has this attribute but also has a tag with the very same attribute. The principal tag, points to one xsd, I have downloaded and I'm using it for validate but when I run my node project, always shows error in the child tag which have the xsi:schemaLocation pointing to another xsd, so.... Its possible put multiple xsd files to validate one xml or its possible just put null the second parametter and let search the xsd online?

<?xml version="1.0" encoding="utf-8"?>
<cfdi:Comprobante ... xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd" Version="3.3" ...... >
   .......
   <tfd:TimbreFiscalDigital xsi:schemaLocation="http://www.sat.gob.mx/TimbreFiscalDigital http://www.sat.gob.mx/sitio_internet/cfd/TimbreFiscalDigital/TimbreFiscalDigitalv11.xsd" >......</tfd:TimbreFiscalDigital>
</cfdi:Comprobante>
nikku commented 3 years ago

To my knowledge this is not possible at the moment. We expect a schema to be passed that we use for validation.

Contributions to improve the current state are welcome. I'll not personally be able to follow up on this one unfortunately though.