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

doesn't support xs:anySimpleType #34

Closed
ghost opened this Issue Apr 15, 2011 · 9 comments

Comments

Projects
None yet
2 participants
@ghost

ghost commented Apr 15, 2011

I'm attempting to compile the vCloud API XSD(s) found at http://communities.vmware.com/docs/DOC-13564. This is a fairly large, complex collection of XSDs and might make a good testbed. :-)

After downloading a few imported XSDs that are referred to, a

scalaxb `find . -name '*.xsd'`

fails with:

java.lang.RuntimeException: Args: Unsupported type XsAnySimpleType
at scala.Predef$.error(Predef.scala:58)
at scalaxb.compiler.xsd.Args$class.buildArg(Args.scala:178)
at scalaxb.compiler.xsd.GenSource.buildArg(GenSource.scala:30)
at scalaxb.compiler.xsd.Args$class.buildArg(Args.scala:165)
at scalaxb.compiler.xsd.GenSource.buildArg(GenSource.scala:30)
at scalaxb.compiler.xsd.GenSource.argsString$1(GenSource.scala:269)
at scalaxb.compiler.xsd.GenSource.companionCode$1(GenSource.scala:338)
at scalaxb.compiler.xsd.GenSource.makeCaseClassWithType(GenSource.scala:384)
at scalaxb.compiler.xsd.GenSource.makeType(GenSource.scala:80)
at scalaxb.compiler.xsd.GenSource$$anonfun$run$1.apply(GenSource.scala:59)
at scalaxb.compiler.xsd.GenSource$$anonfun$run$1.apply(GenSource.scala:53)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
at scala.collection.immutable.List.map(List.scala:45)
at scalaxb.compiler.xsd.GenSource.run(GenSource.scala:53)
at scalaxb.compiler.xsd.Driver.generate(Driver.scala:51)
at scalaxb.compiler.xsd.Driver.generate(Driver.scala:31)
at scalaxb.compiler.Module$$anonfun$processImportables$1$1.apply(Module.scala:228)
at scalaxb.compiler.Module$$anonfun$processImportables$1$1.apply(Module.scala:222)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
at scala.collection.immutable.List.map(List.scala:45)
at scalaxb.compiler.Module$class.processImportables$1(Module.scala:222)
at scalaxb.compiler.Module$class.processReaders(Module.scala:263)
at scalaxb.compiler.xsd.Driver.processReaders(Driver.scala:31)
at scalaxb.compiler.Module$class.processFiles(Module.scala:122)
at scalaxb.compiler.xsd.Driver.processFiles(Driver.scala:31)
at scalaxb.compiler.Main$.start(Main.scala:81)
at scalaxb.compiler.Main$.main(Main.scala:33)
at scalaxb.compiler.Main.main(Main.scala)

A look at Args.scala line 178 reveals that the exception is honestly arrived at :-) but I don't know yet what to suggest by way of changes to support xs:anySimpleType. Hopefully the issue is at least easy enough to reproduce to be helpful to you.

@ghost ghost assigned eed3si9n Apr 15, 2011

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Apr 16, 2011

Owner

XML Schema Part 2:

Definition: The simple ur-type definition is a special restriction of the ur-type definition whose name is anySimpleType in the XML Schema namespace. anySimpleType can be considered as the base type of all primitive datatypes. anySimpleType is considered to have an unconstrained lexical space and a value space consisting of the union of the value spaces of all the primitive datatypes and the set of all lists of all members of the value spaces of all the primitive datatypes.

For value space that big, it needs to map to Any.

Owner

eed3si9n commented Apr 16, 2011

XML Schema Part 2:

Definition: The simple ur-type definition is a special restriction of the ur-type definition whose name is anySimpleType in the XML Schema namespace. anySimpleType can be considered as the base type of all primitive datatypes. anySimpleType is considered to have an unconstrained lexical space and a value space consisting of the union of the value spaces of all the primitive datatypes and the set of all lists of all members of the value spaces of all the primitive datatypes.

For value space that big, it needs to map to Any.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 16, 2011

Yeah. sigh. Is that easy to do?

ghost commented Apr 16, 2011

Yeah. sigh. Is that easy to do?

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Apr 16, 2011

Owner

Yea, it's not bad since there's code in there for xs:anyType already.

Owner

eed3si9n commented Apr 16, 2011

Yea, it's not bad since there's code in there for xs:anyType already.

eed3si9n added a commit that referenced this issue Apr 17, 2011

@eed3si9n eed3si9n closed this in 0e34d83 Apr 17, 2011

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Apr 17, 2011

Owner

The following should at least generate the code.

$ mkdir dmtf
$ cd dmtf
$ wget http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://schemas.dmtf.org/wbem/wscim/1/common.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd
$ cd ..
$ scalaxb `find . -name '*.xsd'` --wrap-contents "{http://www.vmware.com/vcloud/v1}EntityType" --wrap-contents "{http://www.vmware.com/vcloud/v1}UserType" -p vcloud
Owner

eed3si9n commented Apr 17, 2011

The following should at least generate the code.

$ mkdir dmtf
$ cd dmtf
$ wget http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://schemas.dmtf.org/wbem/wscim/1/common.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd
$ cd ..
$ scalaxb `find . -name '*.xsd'` --wrap-contents "{http://www.vmware.com/vcloud/v1}EntityType" --wrap-contents "{http://www.vmware.com/vcloud/v1}UserType" -p vcloud

@ghost ghost reopened this Apr 17, 2011

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 17, 2011

Well, yes, but the resulting code doesn't compile. :-)

ghost commented Apr 17, 2011

Well, yes, but the resulting code doesn't compile. :-)

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Apr 17, 2011

Owner

I renamed dmtf/common.xsd to dmtf/dmtf_common.xsd, and the errors were reduced to the following:

[vcloud-api-xsd-1.0]$ scalac *.scala
CIM_ResourceAllocationSettingData.scala:55: error: value any2 is not a member of vcloud.CIM_ResourceAllocationSettingData_TypableSequence3
  lazy val any2 = cim_resourceallocationsettingdata_typablesequence3.any2
                                                                     ^
CIM_VirtualSystemSettingData.scala:53: error: value any2 is not a member of vcloud.CIM_VirtualSystemSettingData_TypableSequence3
  lazy val any2 = cim_virtualsystemsettingdata_typablesequence3.any2
                                                                ^
dsp8023_1.1.0.scala:311: error: value any2 is not a member of vcloud.CIM_VirtualSystemSettingData_TypableSequence3
  lazy val any2 = cim_virtualsystemsettingdata_typablesequence3.any2
                                                                ^
dsp8023_1.1.0.scala:346: error: value any2 is not a member of vcloud.CIM_ResourceAllocationSettingData_TypableSequence3
  lazy val any2 = cim_resourceallocationsettingdata_typablesequence3.any2
                                                                     ^
four errors found

I'll look into them, but I think they are different issue from xs:anySimpleType.

Owner

eed3si9n commented Apr 17, 2011

I renamed dmtf/common.xsd to dmtf/dmtf_common.xsd, and the errors were reduced to the following:

[vcloud-api-xsd-1.0]$ scalac *.scala
CIM_ResourceAllocationSettingData.scala:55: error: value any2 is not a member of vcloud.CIM_ResourceAllocationSettingData_TypableSequence3
  lazy val any2 = cim_resourceallocationsettingdata_typablesequence3.any2
                                                                     ^
CIM_VirtualSystemSettingData.scala:53: error: value any2 is not a member of vcloud.CIM_VirtualSystemSettingData_TypableSequence3
  lazy val any2 = cim_virtualsystemsettingdata_typablesequence3.any2
                                                                ^
dsp8023_1.1.0.scala:311: error: value any2 is not a member of vcloud.CIM_VirtualSystemSettingData_TypableSequence3
  lazy val any2 = cim_virtualsystemsettingdata_typablesequence3.any2
                                                                ^
dsp8023_1.1.0.scala:346: error: value any2 is not a member of vcloud.CIM_ResourceAllocationSettingData_TypableSequence3
  lazy val any2 = cim_resourceallocationsettingdata_typablesequence3.any2
                                                                     ^
four errors found

I'll look into them, but I think they are different issue from xs:anySimpleType.

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Apr 17, 2011

Owner

I created #35 for any2 issue, and that's fixed. Confirmed that the vcloud generated code compiles.

Owner

eed3si9n commented Apr 17, 2011

I created #35 for any2 issue, and that's fixed. Confirmed that the vcloud generated code compiles.

@eed3si9n eed3si9n closed this Apr 17, 2011

@sagarcjoshi

This comment has been minimized.

Show comment
Hide comment
@sagarcjoshi

sagarcjoshi Mar 7, 2013

xs:anySimpleType gets converted into scalaxb.DataRecord[Any]. Is it right?
I gets difficult to extract value from this. e.g. In CIM_ResourceAllocationSettingData.xsd the value in ResourceType is simple Int/short value. But I am not able to extract it from DataRecord. The value member of this DataRecord returns an XML, instead of actual value.

DataRecord({http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData}ResourceType,<rasd:ResourceType xmlns:ns12="http://www.vmware.com/vcloud/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns="http://www.vmware.com/vcloud/v1.5">3</rasd:ResourceType>)

Actual XML

<ovf:Item>
...
        <rasd:ResourceType>3</rasd:ResourceType>
...
    </ovf:Item>

sagarcjoshi commented Mar 7, 2013

xs:anySimpleType gets converted into scalaxb.DataRecord[Any]. Is it right?
I gets difficult to extract value from this. e.g. In CIM_ResourceAllocationSettingData.xsd the value in ResourceType is simple Int/short value. But I am not able to extract it from DataRecord. The value member of this DataRecord returns an XML, instead of actual value.

DataRecord({http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData}ResourceType,<rasd:ResourceType xmlns:ns12="http://www.vmware.com/vcloud/v1.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns="http://www.vmware.com/vcloud/v1.5">3</rasd:ResourceType>)

Actual XML

<ovf:Item>
...
        <rasd:ResourceType>3</rasd:ResourceType>
...
    </ovf:Item>
@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Mar 7, 2013

Owner

@sagarcjoshi Could you open a separate issue for the handling of ResourceType, or send an email to the mailing list to discuss this please? The answer is a bit involved, and I don't want to tack on to this case.

Owner

eed3si9n commented Mar 7, 2013

@sagarcjoshi Could you open a separate issue for the handling of ResourceType, or send an email to the mailing list to discuss this please? The answer is a bit involved, and I don't want to tack on to this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment