java - xsd 模式生成的类中的问题
问题描述
我有一个 xsd 架构。我由 Eclipse 插件 java 类(Generate-->JaxbClasses)生成。我生成的类在 xmlRootElement 注释上显示错误:@XmlRootElement(name = "CommonData"):
在这一行,我收到此错误
“无法在此上下文中使用命名空间 '' 和名称 'CommonData' 解析 XML 元素声明”。
其他生成的类也有同样的问题。
有什么建议吗?
谢谢。
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:simpleType name="MsisdnInterrogatoType">
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
<xs:pattern value="([0-9])+"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="OperatoreType">
<xs:restriction base="xs:string">
<xs:maxLength value="12"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SceltaTipoTrafficoType">
<xs:restriction base="xs:string">
<xs:enumeration value="Y"/>
<xs:enumeration value=" "/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SubSysType">
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="QueryRiepilogoCosti">
<xs:complexType>
<xs:sequence>
<xs:element ref="CommonData"/>
<xs:element ref="QueryGroup"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CommonData">
<xs:complexType>
<xs:sequence>
<xs:element name="SubSys" type="SubSysType"/>
<xs:element name="Operatore" type="OperatoreType"/>
<xs:element name="MsisdnInterrogato" type="MsisdnInterrogatoType"/>
<xs:element name="DataInizio" type="xs:dateTime"/>
<xs:element name="DataFine" type="xs:dateTime"/>
<xs:element name="TutteLeTipologie" type="SceltaTipoTrafficoType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="QueryGroup">
<xs:complexType>
<xs:sequence>
<xs:element name="WAP" type="SceltaTipoTrafficoType"/>
<xs:element name="GPRS" type="SceltaTipoTrafficoType"/>
<xs:element name="GPRSEstero" type="SceltaTipoTrafficoType"/>
<xs:element name="WAPEvento" type="SceltaTipoTrafficoType"/>
<xs:element name="GPRSEvento" type="SceltaTipoTrafficoType"/>
<xs:element name="WLAN" type="SceltaTipoTrafficoType" minOccurs="0"/>
<xs:element name="RCS" type="SceltaTipoTrafficoType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>'
解决方案
推荐阅读
- jquery - 当没有更多的嵌套列表隐藏一个元素时
- asp.net-mvc - 我们应该将 DevExpress 添加到我们的 ASP.NET MVC 标准工具集中吗?
- java - API 最小化数据使用
- dynamics-crm - 在 CDS 上为 D365 MDA 创建一个可点击的网格调度类工具
- python - CX_Freeze EXE 在未映射的网络驱动器上不起作用
- c++ - 如何在没有`std::endl`的情况下在VS Code调试控制台中显示内容?
- javascript - 403 IAM 权限,尽管授予代理管理员权限以授予列出意图的权限
- c++ - CUDA 速度比预期慢 - 图像处理
- c - 如何使用输出段错误错误的 random() 函数解决猜数游戏?
- mysql - Cloud SQL 实例第 2 代 ALTERNATIVE 激活策略“按需”