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

anyType + anySimpleType issue #103

Open
Adraesh opened this issue Jan 13, 2020 · 13 comments
Open

anyType + anySimpleType issue #103

Adraesh opened this issue Jan 13, 2020 · 13 comments

Comments

@Adraesh
Copy link

Adraesh commented Jan 13, 2020

Hi!

First of all, thank you very much for this lib!

I am trying to make it work without success bellow my issue:

In SchemaReader.php line 1056:
                                                                                                             
  Can't find type named {http://www.opengis.net/gml/3.2}#anyType, at line 21 in http://schemas.opengis.net/  
  gml/3.2.1/gmlBase.xsd                                                                                      
                                                                                                             

In Schema.php line 100:
                                                                       
  Can't find the Type named {http://www.opengis.net/gml/3.2}#anyType. 

Though anyType and anySimpleType are well set to their alias as following:

aliases: 
        'http://www.opengis.net/gml/3.2':
            anyType: 'Jms\Handler\GmlAnyTypeHandler'
            anySimpleType: 'Jms\Handler\GmlAnySimpleTypeHandler'

The related handler's classes are registered as service and tag to jms_serializer.subscribing_handler as following:

App\Jms\Handler\GmlAnyTypeHandler:
       public: true
       tags:
           - { name: jms_serializer.subscribing_handler }

    App\Jms\Handler\GmlAnySimpleTypeHandler:
       public: true
       tags:
           - { name: jms_serializer.subscribing_handler }

Any idea? Thank you in advance.

@goetas
Copy link
Member

goetas commented Jan 14, 2020

as in this example https://github.com/goetas-webservices/xsd2php#dealing-with-xsdanytype-or-xsdanysimpletype, anytype is in te http://www.w3.org/2001/XMLSchema namespace.

@Adraesh
Copy link
Author

Adraesh commented Jan 14, 2020

@goetas Same issue using this configuration:

xsd2php:
    namespaces:
        'http://www.aixm.aero/schema/5.1.1': 'App\AIXM'
        'http://www.opengis.net/gml/3.2': 'App\AIXM'
        'http://www.w3.org/1999/xlink': 'App\AIXM'
        'http://www.isotc211.org/2005/gmd': 'App\AIXM'
        'http://www.isotc211.org/2005/gmx': 'App\AIXM'
        'http://www.isotc211.org/2005/gsr': 'App\AIXM'
        'http://www.isotc211.org/2005/gss': 'App\AIXM'
        'http://www.isotc211.org/2005/gts': 'App\AIXM'

    destinations_php: 
        'App\AIXM': src/AIXM

    destinations_jms:
        'App\AIXM': src/AIXM

    aliases: 
        'http://www.w3.org/2001/XMLSchema':
            anyType: 'Jms\Handler\GmlAnyTypeHandler'
            anySimpleType: 'Jms\Handler\GmlAnySimpleTypeHandler'
    naming_strategy: short
    path_generator: psr4

@Adraesh
Copy link
Author

Adraesh commented Jan 14, 2020

Basically I am trying to use your lib in order to create the mapped related PHP classes from this XSD schema: http://www.aixm.aero/sites/aixm.aero/files/imce/AIXM511/aixm_5_1_1_xsd_with_local_copies.zip

If you can check it out, I am on it since 2 days without success :)

Thank you in advance.

@Adraesh
Copy link
Author

Adraesh commented Jan 15, 2020

@goetas Hi! Any news on this topic and/or guideline?

Thank you.

@Adraesh
Copy link
Author

Adraesh commented Jan 15, 2020

Hi!

I think I got it, basically the lib seems to not cover the case of having anyType or anySimpleType linked to any other namespace than 'http://www.w3.org/2001/XMLSchema' and in my case I have elements of type anyType and anySimpleType linked to the 'http://www.opengis.net/gml/3.2' namespace.

iex:

<element name="AbstractValue" type="anyType" abstract="true" substitutionGroup="gml:AbstractObject">
		<annotation>
			<documentation>gml:AbstractValue is an abstract element which acts as the head of a substitution group which contains gml:AbstractScalarValue, gml:AbstractScalarValueList, gml:CompositeValue and gml:ValueExtent, and (transitively) the elements in their substitution groups.
These elements may be used in an application schema as variables, so that in an XML instance document any member of its substitution group may occur.</documentation>
		</annotation>

Any feedback on this?

@goetas
Copy link
Member

goetas commented Jan 15, 2020

Hmm... it could be that the namespaced anyType is not supported yet... :-/

@Adraesh
Copy link
Author

Adraesh commented Jan 15, 2020

@goetas Any tips, starting point in order to implement it?

@goetas
Copy link
Member

goetas commented Jan 17, 2020

The any element is probably not supported by the xsd reader. You should add support for it in https://github.com/goetas-webservices/xsd-reader/blob/master/src/SchemaReader.php, after you will be able to assign to it a handler in this library

@Adraesh
Copy link
Author

Adraesh commented Jan 18, 2020

@goetas I took time yesterday to dig more into your lib. I found the reason about anyType basically whenever an element is not declaring a Type is therefore implicitly (according to the rules of W3C XML Schema) an XML Schema anyType. But your lib still try to resolve it using the targetNamespace from the file the element is in my case targetNamespace="http://www.opengis.net/gml/3.2" and not from the http://www.w3.org/2001/XMLSchema namespace. I fix this by simply adding explicitly the type to this element type="anyType". Still could you please handle this case properly?

Then, it seems that the lib does not handle the notion of deprecated types, I have a deprecatedTypes.xsd which declare all the element/types and other that are still part of the schema but deprecated, the lib still try to find the type in the related namespace without checking if it's a deprecated type. Could you also please handle this issue?

@goetas
Copy link
Member

goetas commented Jan 24, 2020

i'm happy to see that you solved your issue.

whenever an element is not declaring a Type is therefore implicitly (according to the rules of W3C XML Schema) an XML Schema anyType.

did not know that, thanks for looking into it

Still could you please handle this case properly?

would be happy to accept a PR

Then, it seems that the lib does not handle the notion of deprecated types, I have a deprecatedTypes.xsd which declare all the element/types and other that are still part of the schema but deprecated, the lib still try to find the type in the related namespace without checking if it's a deprecated type. Could you also please handle this issue?

this seems a complete new feature, would be happy to accept a PR

@Adraesh
Copy link
Author

Adraesh commented Jan 24, 2020

@goetas So if I understand clearly you are not maintaining anymore this lib.

@goetas
Copy link
Member

goetas commented Jan 24, 2020

This is an open source project licensed under the MIT license (see https://github.com/goetas-webservices/xsd2php/blob/master/LICENSE.txt), with all pros and cons of it. The project is maintained for my needs and its progress depends on my available time to work on it.

Currently I do not have a specific need for the feature you are asking, and nobody is paying me (yet) to implement it. All the projects that I'm working on do not have this usecase.
I'm willing to accept a PR with the changes you need. In some cases, the development has been sponsored by companies (see #71 (comment)).

@mussbach
Copy link

mussbach commented Feb 7, 2020

@Adraesh how did you fix your problem? Where did you add element type="anyType"? Would you mind sharing it? Perhaps we could join forces to come up with a PR to improve this library?

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