Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError on adding a valid schema #1

Open
burmisov opened this issue Jun 30, 2014 · 13 comments
Open

AssertionError on adding a valid schema #1

burmisov opened this issue Jun 30, 2014 · 13 comments

Comments

@burmisov
Copy link

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.

@mitar
Copy link
Member

mitar commented Jun 30, 2014

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?

@mitar
Copy link
Member

mitar commented Jun 30, 2014

From looking at the schema, it will probably fail at xs:key tags. 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 other directory of tests.

@mitar
Copy link
Member

mitar commented Jun 30, 2014

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.)

@mitar
Copy link
Member

mitar commented Aug 2, 2014

Ping?

@mitar
Copy link
Member

mitar commented Aug 2, 2014

Can you provide me with an example XML and schema?

@burmisov
Copy link
Author

burmisov commented Aug 3, 2014

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.

@mitar
Copy link
Member

mitar commented Aug 3, 2014

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.

@burmisov
Copy link
Author

burmisov commented Aug 3, 2014

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.

@mitar
Copy link
Member

mitar commented Aug 3, 2014

Good idea. I can try that as well. :-)

@felixhao28
Copy link

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

@mitar
Copy link
Member

mitar commented May 16, 2016

On which value does it fail? I think it would be easy to ignore id. But for abstract, block, final, and any I 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.

@felixhao28
Copy link

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?

@mitar
Copy link
Member

mitar commented May 16, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants