albanm / node-libxml-xsd

XSD validation for node.js using libxml.
70 stars 28 forks source link

Retrieving xsd annotation and xsd documentation for elements with errors #31

Open renegadeandy opened 6 years ago

renegadeandy commented 6 years ago

Hi,

If I get an error on a particular element, I get a JSON object back in the validate callback which looks as follows:

{"domain":17,"code":1866,"level":2,"column":0,"line":149,"str1":"tracmaxFiles"}

This error element has xsd:annotations and xsd:documentation tags associated with it. Is is possible to get access to these elements? Are their alternative libraries which could do this if this can't. If not, would it be possible to extend libxml-xsd to make this a capability?

Thanks!

albanm commented 6 years ago

You would like to access the element that caused the error ? Seems like a good idea, I don't know if it is doable. I don't maintain this module actively, but I review pull requests, so feel free to look into it and submit a PR.

renegadeandy commented 6 years ago

hahah 👍 Okay, if I somehow find time i'll look into extending it!

renegadeandy commented 6 years ago

Actually, it's not quite just access the element, some elements have annotations or documentation, I would like to have these in the response object. I have taken a quick look, and I may be wrong, but I believe that I would need to modify libxmljs-mt in order to achieve what I want with this module. Does that seem / sound right?