Jaxb将XML转换为ElementNSImpl类型而不是正确的类型

时间:2017-11-23 07:10:11

标签: java xml jaxb

我有以下xml。

<ovf:Item vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml" vcloud:href="https://tckrtvcd.tcloudtst.local/api/vApp/vm-baa5d82b-12e5-475e-94a3-518f89b13238/virtualHardwareSection/cpu">    
    <vmw:CoresPerSocket ovf:required="false">1</vmw:CoresPerSocket>
    <Link rel="edit" href="https://tckrtvcd.tcloudtst.local/api/vApp/vm-baa5d82b-12e5-475e-94a3-518f89b13238/virtualHardwareSection/cpu" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
</ovf:Item>

我期待jaxb将vmw:CoresPerSocket对象映射到CoresPerSocket.java类,但它会将其映射到ElementNSImpl类。

这是CoresPerSocket类的定义。

package com.vmware.schema.ovf;

@XmlType(name = "CoresPerSocket_Type")
public class CoresPerSocketType

这是CoresPerSocket xml定义。

xmlns:vmw="http://www.vmware.com/schema/ovf"
...

   <xs:element name="CoresPerSocket" type="vmw:CoresPerSocket_Type">
        <xs:annotation>
            <xs:documentation source="since">5.5</xs:documentation>
            <xs:documentation xml:lang="en">
               Virtual hardware element expressing number of cores per socket
            </xs:documentation>
        </xs:annotation>
   </xs:element>

   <xs:complexType name="CoresPerSocket_Type">
        <xs:annotation>
            <xs:appinfo><meta:version added-in="5.5"/></xs:appinfo>
            <xs:documentation source="since">5.5</xs:documentation>
            <xs:documentation xml:lang="en">Type for CoresPerSocket element</xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
           <xs:extension base="cim:cimUnsignedInt">
              <xs:attribute ref="ovf:required" use="optional"/>
              <xs:anyAttribute namespace="##any" processContents="lax"/>
           </xs:extension>
        </xs:simpleContent>
   </xs:complexType>

这是生成的CoresPerSocket类。

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2017.11.21 at 09:11:08 AM EET 
//


package com.vmware.schema.ovf;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import org.dmtf.schemas.wbem.wscim._1.common.CimUnsignedInt;


/**
 * Type for CoresPerSocket element
 * 
 * <p>Java class for CoresPerSocket_Type complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="CoresPerSocket_Type">
 *   &lt;simpleContent>
 *     &lt;extension base="&lt;http://schemas.dmtf.org/wbem/wscim/1/common>cimUnsignedInt">
 *       &lt;attribute ref="{http://schemas.dmtf.org/ovf/envelope/1}required"/>
 *       &lt;anyAttribute processContents='lax'/>
 *     &lt;/extension>
 *   &lt;/simpleContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CoresPerSocket_Type")
public class CoresPerSocketType
    extends CimUnsignedInt
    implements Serializable
{

    private final static long serialVersionUID = 1L;
    @XmlAttribute(name = "required", namespace = "http://schemas.dmtf.org/ovf/envelope/1")
    protected Boolean required;

    /**
     * Gets the value of the required property.
     * 
     * @return
     *     possible object is
     *     {@link Boolean }
     *     
     */
    public boolean isRequired() {
        if (required == null) {
            return true;
        } else {
            return required;
        }
    }

    /**
     * Sets the value of the required property.
     * 
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *     
     */
    public void setRequired(Boolean value) {
        this.required = value;
    }

}

这是要映射到Vapp类的xml。

    <?xml version="1.0" encoding="UTF-8"?>
<VApp xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" 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:vmw="http://www.vmware.com/schema/ovf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ovfDescriptorUploaded="true" deployed="true" status="4" name="vapp02" id="urn:vcloud:vapp:070d3808-b095-4893-a58e-cdcae90990ae" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae" type="application/vnd.vmware.vcloud.vApp+xml" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://blabla.local/api/v1.5/schema/master.xsd http://www.vmware.com/schema/ovf http://www.vmware.com/schema/ovf http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd">
    <Link rel="power:powerOff" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/power/action/powerOff"/>
    <Link rel="power:reboot" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/power/action/reboot"/>
    <Link rel="power:reset" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/power/action/reset"/>
    <Link rel="power:shutdown" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/power/action/shutdown"/>
    <Link rel="power:suspend" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/power/action/suspend"/>
    <Link rel="deploy" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/action/deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml"/>
    <Link rel="undeploy" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/action/undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml"/>
    <Link rel="down" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/controlAccess/" type="application/vnd.vmware.vcloud.controlAccess+xml"/>
    <Link rel="controlAccess" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/action/controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml"/>
    <Link rel="recompose" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/action/recomposeVApp" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml"/>
    <Link rel="up" href="https://blabla.local/api/vdc/4e11dcc4-2da2-4d60-b663-250ce27ffd81" type="application/vnd.vmware.vcloud.vdc+xml"/>
    <Link rel="edit" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae" type="application/vnd.vmware.vcloud.vApp+xml"/>
    <Link rel="down" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/owner" type="application/vnd.vmware.vcloud.owner+xml"/>
    <Link rel="down" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/metadata" type="application/vnd.vmware.vcloud.metadata+xml"/>
    <Link rel="ovf" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/ovf" type="text/xml"/>
    <Link rel="down" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/productSections/" type="application/vnd.vmware.vcloud.productSections+xml"/>
    <Link rel="snapshot:create" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/action/createSnapshot" type="application/vnd.vmware.vcloud.createSnapshotParams+xml"/>
    <Description/>
    <LeaseSettingsSection href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/leaseSettingsSection/" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" ovf:required="false">
        <ovf:Info>Lease settings section</ovf:Info>
        <Link rel="edit" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/leaseSettingsSection/" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"/>
        <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
        <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
    </LeaseSettingsSection>
    <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml" vcloud:href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/startupSection/">
        <ovf:Info>VApp startup section</ovf:Info>
        <ovf:Item ovf:id="vapp02" ovf:order="0" ovf:startAction="powerOn" ovf:startDelay="0" ovf:stopAction="powerOff" ovf:stopDelay="0"/>
        <Link rel="edit" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/startupSection/" type="application/vnd.vmware.vcloud.startupSection+xml"/>
    </ovf:StartupSection>
    <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml" vcloud:href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/networkSection/">
        <ovf:Info>The list of logical networks</ovf:Info>
        <ovf:Network ovf:name="none">
            <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
        </ovf:Network>
    </ovf:NetworkSection>
    <NetworkConfigSection href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/networkConfigSection/" type="application/vnd.vmware.vcloud.networkConfigSection+xml" ovf:required="false">
        <ovf:Info>The configuration parameters for logical networks</ovf:Info>
        <Link rel="edit" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/networkConfigSection/" type="application/vnd.vmware.vcloud.networkConfigSection+xml"/>
        <NetworkConfig networkName="none">
            <Description>This is a special place-holder used for disconnected network interfaces.</Description>
            <Configuration>
                <IpScopes>
                    <IpScope>
                        <IsInherited>false</IsInherited>
                        <Gateway>196.254.254.254</Gateway>
                        <Netmask>255.255.0.0</Netmask>
                        <Dns1>196.254.254.254</Dns1>
                    </IpScope>
                </IpScopes>
                <FenceMode>isolated</FenceMode>
            </Configuration>
            <IsDeployed>false</IsDeployed>
        </NetworkConfig>
    </NetworkConfigSection>
    <SnapshotSection href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae/snapshotSection" type="application/vnd.vmware.vcloud.snapshotSection+xml" ovf:required="false">
        <ovf:Info>Snapshot information section</ovf:Info>
    </SnapshotSection>
    <DateCreated>2017-10-18T10:37:44.258+03:00</DateCreated>
    <Owner type="application/vnd.vmware.vcloud.owner+xml">
        <User href="https://blabla.local/api/admin/user/6bc2a013-7bd7-4a10-87b3-63326f955029" name="system" type="application/vnd.vmware.admin.user+xml"/>
    </Owner>
    <InMaintenanceMode>false</InMaintenanceMode>
    <Children>
        <Vm needsCustomization="false" nestedHypervisorEnabled="false" deployed="true" status="4" name="vapp02" id="urn:vcloud:vm:dc29ab3c-f6ea-432c-884c-cf81dc07fcb2" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2" type="application/vnd.vmware.vcloud.vm+xml">
            <Link rel="power:powerOff" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/power/action/powerOff"/>
            <Link rel="power:reboot" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/power/action/reboot"/>
            <Link rel="power:reset" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/power/action/reset"/>
            <Link rel="power:shutdown" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/power/action/shutdown"/>
            <Link rel="power:suspend" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/power/action/suspend"/>
            <Link rel="undeploy" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/action/undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml"/>
            <Link rel="edit" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2" type="application/vnd.vmware.vcloud.vm+xml"/>
            <Link rel="down" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/metadata" type="application/vnd.vmware.vcloud.metadata+xml"/>
            <Link rel="down" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/productSections/" type="application/vnd.vmware.vcloud.productSections+xml"/>
            <Link rel="down" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/metrics/current" type="application/vnd.vmware.vcloud.metrics.currentUsageSpec+xml"/>
            <Link rel="down" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/metrics/historic" type="application/vnd.vmware.vcloud.metrics.historicUsageSpec+xml"/>
            <Link rel="metrics" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/metrics/current" type="application/vnd.vmware.vcloud.metrics.currentUsageSpec+xml"/>
            <Link rel="metrics" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/metrics/historic" type="application/vnd.vmware.vcloud.metrics.historicUsageSpec+xml"/>
            <Link rel="screen:thumbnail" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/screen"/>
            <Link rel="screen:acquireTicket" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/screen/action/acquireTicket"/>
            <Link rel="screen:acquireMksTicket" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/screen/action/acquireMksTicket" type="application/vnd.vmware.vcloud.mksTicket+xml"/>
            <Link rel="media:insertMedia" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/media/action/insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"/>
            <Link rel="media:ejectMedia" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/media/action/ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"/>
            <Link rel="disk:attach" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/disk/action/attach" type="application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml"/>
            <Link rel="disk:detach" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/disk/action/detach" type="application/vnd.vmware.vcloud.diskAttachOrDetachParams+xml"/>
            <Link rel="installVmwareTools" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/action/installVMwareTools"/>
            <Link rel="customizeAtNextPowerOn" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/action/customizeAtNextPowerOn"/>
            <Link rel="snapshot:create" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/action/createSnapshot" type="application/vnd.vmware.vcloud.createSnapshotParams+xml"/>
            <Link rel="reconfigureVm" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/action/reconfigureVm" name="vapp02" type="application/vnd.vmware.vcloud.vm+xml"/>
            <Link rel="up" href="https://blabla.local/api/vApp/vapp-070d3808-b095-4893-a58e-cdcae90990ae" type="application/vnd.vmware.vcloud.vApp+xml"/>
            <Description/>
            <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" ovf:transport="" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" vcloud:href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/virtualHardwareSection/">
                <ovf:Info>Virtual hardware requirements</ovf:Info>
                <ovf:System>
                    <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
                    <vssd:InstanceID>0</vssd:InstanceID>
                    <vssd:VirtualSystemIdentifier>vapp02</vssd:VirtualSystemIdentifier>
                    <vssd:VirtualSystemType>vmx-11</vssd:VirtualSystemType>
                </ovf:System>
                <ovf:Item>
                    <rasd:Address>00:50:56:01:02:45</rasd:Address>
                    <rasd:AddressOnParent>0</rasd:AddressOnParent>
                    <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
                    <rasd:Connection vcloud:ipAddressingMode="NONE" vcloud:primaryNetworkConnection="true">none</rasd:Connection>
                    <rasd:Description>E1000s ethernet adapter on "none"</rasd:Description>
                    <rasd:ElementName>Network adapter 0</rasd:ElementName>
                    <rasd:InstanceID>1</rasd:InstanceID>
                    <rasd:ResourceSubType>E1000E</rasd:ResourceSubType>
                    <rasd:ResourceType>10</rasd:ResourceType>
                </ovf:Item>
                <ovf:Item>
                    <rasd:Address>0</rasd:Address>
                    <rasd:Description>SCSI Controller</rasd:Description>
                    <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
                    <rasd:InstanceID>2</rasd:InstanceID>
                    <rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
                    <rasd:ResourceType>6</rasd:ResourceType>
                </ovf:Item>
                <ovf:Item>
                    <rasd:AddressOnParent>0</rasd:AddressOnParent>
                    <rasd:Description>Hard disk</rasd:Description>
                    <rasd:ElementName>Hard disk 1</rasd:ElementName>
                    <rasd:HostResource vcloud:storageProfileHref="https://blabla.local/api/vdcStorageProfile/333cb40d-b29f-46ff-bf86-a3238b9d1374" vcloud:busType="6" vcloud:busSubType="lsilogicsas" vcloud:capacity="1024" vcloud:storageProfileOverrideVmDefault="false"/>
                    <rasd:InstanceID>2000</rasd:InstanceID>
                    <rasd:Parent>2</rasd:Parent>
                    <rasd:ResourceType>17</rasd:ResourceType>
                    <rasd:VirtualQuantity>1073741824</rasd:VirtualQuantity>
                    <rasd:VirtualQuantityUnits>byte</rasd:VirtualQuantityUnits>
                </ovf:Item>
                <ovf:Item>
                    <rasd:Address>0</rasd:Address>
                    <rasd:Description>IDE Controller</rasd:Description>
                    <rasd:ElementName>IDE Controller 0</rasd:ElementName>
                    <rasd:InstanceID>3</rasd:InstanceID>
                    <rasd:ResourceType>5</rasd:ResourceType>
                </ovf:Item>
                <ovf:Item>
                    <rasd:AddressOnParent>0</rasd:AddressOnParent>
                    <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
                    <rasd:Description>CD/DVD Drive</rasd:Description>
                    <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
                    <rasd:HostResource/>
                    <rasd:InstanceID>3000</rasd:InstanceID>
                    <rasd:Parent>3</rasd:Parent>
                    <rasd:ResourceType>15</rasd:ResourceType>
                </ovf:Item>
                <ovf:Item>
                    <rasd:AddressOnParent>0</rasd:AddressOnParent>
                    <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
                    <rasd:Description>Floppy Drive</rasd:Description>
                    <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
                    <rasd:HostResource/>
                    <rasd:InstanceID>8000</rasd:InstanceID>
                    <rasd:ResourceType>14</rasd:ResourceType>
                </ovf:Item>
                <ovf:Item vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml" vcloud:href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/virtualHardwareSection/cpu">
                    <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
                    <rasd:Description>Number of Virtual CPUs</rasd:Description>
                    <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
                    <rasd:InstanceID>4</rasd:InstanceID>
                    <rasd:Reservation>0</rasd:Reservation>
                    <rasd:ResourceType>3</rasd:ResourceType>
                    <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
                    <rasd:Weight>0</rasd:Weight>
                    <vmw:CoresPerSocket ovf:required="false">1</vmw:CoresPerSocket> // This item causes problem
                    <Link rel="edit" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/virtualHardwareSection/cpu" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
                </ovf:Item>
                <ovf:Item vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml" vcloud:href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/virtualHardwareSection/memory">
                    <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
                    <rasd:Description>Memory Size</rasd:Description>
                    <rasd:ElementName>1024 MB of memory</rasd:ElementName>
                    <rasd:InstanceID>5</rasd:InstanceID>
                    <rasd:Reservation>0</rasd:Reservation>
                    <rasd:ResourceType>4</rasd:ResourceType>
                    <rasd:VirtualQuantity>1024</rasd:VirtualQuantity>
                    <rasd:Weight>0</rasd:Weight>
                    <Link rel="edit" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/virtualHardwareSection/memory" type="application/vnd.vmware.vcloud.rasdItem+xml"/>
                </ovf:Item>
                                </ovf:VirtualHardwareSection>
            <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" ovf:id="112" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="windows9Server64Guest" vcloud:href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/operatingSystemSection/">
                <ovf:Info>Specifies the operating system installed</ovf:Info>
                <ovf:Description>Microsoft Windows Server 2016 (64-bit)</ovf:Description>
                <Link rel="edit" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/operatingSystemSection/" type="application/vnd.vmware.vcloud.operatingSystemSection+xml"/>
            </ovf:OperatingSystemSection>
            <NetworkConnectionSection href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/networkConnectionSection/" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" ovf:required="false">
                <ovf:Info>Specifies the available VM network connections</ovf:Info>
                <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
                <NetworkConnection needsCustomization="true" network="none">
                    <NetworkConnectionIndex>0</NetworkConnectionIndex>
                    <IsConnected>false</IsConnected>
                    <MACAddress>00:50:56:01:02:45</MACAddress>
                    <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
                </NetworkConnection>
                <Link rel="edit" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/networkConnectionSection/" type="application/vnd.vmware.vcloud.networkConnectionSection+xml"/>
            </NetworkConnectionSection>
            <GuestCustomizationSection href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/guestCustomizationSection/" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" ovf:required="false">
                <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
                <Enabled>false</Enabled>
                <ChangeSid>true</ChangeSid>
                <VirtualMachineId>dc29ab3c-f6ea-432c-884c-cf81dc07fcb2</VirtualMachineId>
                <JoinDomainEnabled>false</JoinDomainEnabled>
                <UseOrgSettings>false</UseOrgSettings>
                <AdminPasswordEnabled>true</AdminPasswordEnabled>
                <AdminPasswordAuto>true</AdminPasswordAuto>
                <AdminAutoLogonEnabled>false</AdminAutoLogonEnabled>
                <AdminAutoLogonCount>0</AdminAutoLogonCount>
                <ResetPasswordRequired>false</ResetPasswordRequired>
                <ComputerName>vapp02</ComputerName>
                <Link rel="edit" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/guestCustomizationSection/" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"/>
            </GuestCustomizationSection>
            <RuntimeInfoSection xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" vcloud:href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/runtimeInfoSection">
                <ovf:Info>Specifies Runtime info</ovf:Info>
            </RuntimeInfoSection>
            <SnapshotSection href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/snapshotSection" type="application/vnd.vmware.vcloud.snapshotSection+xml" ovf:required="false">
                <ovf:Info>Snapshot information section</ovf:Info>
            </SnapshotSection>
            <DateCreated>2017-10-18T10:40:44.155+03:00</DateCreated>
            <VAppScopedLocalId>9d7f958d-b1ec-4c7d-83bb-132bf57d5015</VAppScopedLocalId>
            <VmCapabilities href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/vmCapabilities/" type="application/vnd.vmware.vcloud.vmCapabilitiesSection+xml">
                <Link rel="edit" href="https://blabla.local/api/vApp/vm-dc29ab3c-f6ea-432c-884c-cf81dc07fcb2/vmCapabilities/" type="application/vnd.vmware.vcloud.vmCapabilitiesSection+xml"/>
                <MemoryHotAddEnabled>false</MemoryHotAddEnabled>
                <CpuHotAddEnabled>false</CpuHotAddEnabled>
            </VmCapabilities>
            <StorageProfile href="https://blabla.local/api/vdcStorageProfile/333cb40d-b29f-46ff-bf86-a3238b9d1374" name="NL-SAS" type="application/vnd.vmware.vcloud.vdcStorageProfile+xml"/>
        </Vm>
    </Children>
</VApp>

如何让jaxb将xml元素映射到CoresPerSocket类而不是ElementNSImpl类?

0 个答案:

没有答案