Repository navigation
AssertionError on adding a valid schema #1
Description
Activity
Yes, parser is not perfect yet. I mostly implemented stuff needed for me, plus checking the standard a bit. But there are things missing. This is why I added assertions everywhere. :-) Better that it fails than that it says something is parsed but it is not really.
Do you know which line it fails on?
From looking at the schema, it will probably fail at
xs:keytags. It has no clue what to do with them.It currently also ignores groups because I didn't have a need to use that. So referencing a group will probably also fail.
Can you make a pull request with a test of this schema and some valid data? I could then look into it (or we could do it together, I do not have much time this days). Add it to
otherdirectory of tests.It seems we could just delete
xs:key, because it just makes data unique, but this does not influence conversion. (This module does not do full XML validation, it just uses those parts of schema which helps with conversion.)Ping?
Can you provide me with an example XML and schema?
Sorry, I was offline for some time. Do we really need example XML if there adding the schema to parser fails? Don't get me wrong, I've got a bunch of schemas and XML (several hundreds of gigabytes namely), but I just didn't get that far yet.
Example XML is needed to create a test so that in the future there will be no regression. It can be a small XML, with just problematic parts. It does not have to be a XML with real data.
I don't know if it'll be appropriate for the current project stage, but the schema mensioned (http://www.w3.org/2001/XMLSchema.xsd) is in fact can be considered an XML document that should pass itself considered as a schema. As far as I understand.
Good idea. I can try that as well. :-)
I am having the same issue, according to this link, complexType can have id, name, abstract, mixed, block, final... but you are only checking name and abstract: https://github.com/peerlibrary/node-xml4js/blob/master/lib/xsd.js#L311
On which value does it fail? I think it would be easy to ignore
id. But forabstract,block,final, andanyI am unsure how exactly to map it. Not sure also if they do influence conversion at all. Remember, I am not making full schema parser, but just enough to know when to do an array and when not to, and to know to which type to convert a value at the leaves.it fails on literally any value on any property other than
id,name,mixed, because you asserting complexType.$ to be empty. if you only care about types then why not ignore other properties that don't contribute to resulting type?Because I have not went through the whole list of other properties which can be there and think if they do or do not contribute to the resulting type.
Fails to add this schema to parser:
XMLSchema.xsd
An AssertionError dumps to console.
P.S. Thank you for the library and idea. Never found time to implement it myself.