Conversation
| else if node.complexContent?[0].extension | ||
| type.xsdChildrenMode = 'extension' | ||
| type.xsdChildren = node.complexContent[0].extension[0] | ||
| else if node.simpleContent?[0].extension |
There was a problem hiding this comment.
Are we parsing the simpleType node in parseComplexType? I think that node is only parsed in parseSimpleType, right?
There was a problem hiding this comment.
We are not parsing simple type, but complex type with simple content. The simpleContent element can appear in complex type, e.g. when defining an element with string content (simple content) and an attribute:
<xs:complexType name="myType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>| atom.notifications.addError "can't find base type " + extenType.$.base | ||
| continue | ||
| # Ingore link type for simple types reffering to standard simple types like xs:string, etc. | ||
| if type.xsdType == 'simple' and ":" in extenType.$.base |
There was a problem hiding this comment.
What do you think about creating a global list of built-in types? Then we can check here against that list (and also in #48). As a start we can add to the list the most common built-in types:
- xs:string
- xs:decimal
- xs:integer
- xs:boolean
- xs:date
- xs:time
There was a problem hiding this comment.
I agree that the way I distinguish between a built-in type and custom type is not perfect, but it is working fine for the usual cases. So I think it is a reasonable simplification.
If you want to include list of built-in types than I would suggest to make the list complete. To be perfect the namespace prefix would have to be checked too to distinguish between xs:string and my:string.
There was a problem hiding this comment.
Make sense, it will be implemented from a different issue from #49.
This PR extends autocomplete-xml package with ability to recognize simple content extension. For example when a simple type is extended with an attribute.
The fix shoud work correcly for both standard simple types like
xs:stringand custom simples, e.g. string restrictions, etc.Please review the PR and consider merging it to your package.