我已经从 XSD 生成了 Java 类,我想从带有前缀命名空间的 JAXB 类中编组
这就是我所拥有的
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/event"
xmlns:tns="http://www.example.org/event"
elementFormDefault="qualified">
<element name="Events" type="tns:EventsType"></element>
<complexType name="EventsType">
<sequence>
<element name="Event" type="tns:inputFlowEventType" maxOccurs="unbounded" minOccurs="1"></element>
</sequence></complexType>
<complexType name="inputFlowEventType">
<sequence>
<element name="DISTRIBUTOR_ID" minOccurs="1" maxOccurs="1">
<simpleType><restriction base="string"><maxLength value="17"></maxLength></restriction></simpleType>
</element>
</sequence>
</complexType>
</schema>
我有这个
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Events xmlns="http://www.example.org/event"><Event><DISTRIBUTOR_ID>6</DISTRIBUTOR_ID></Event></Events>
而不是这个
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <tns:Events xmlns="http://www.example.org/event"> <tns:Event><tns:DISTRIBUTOR_ID>6</tns:DISTRIBUTOR_ID></tns:Event></tns:Events>
有人可以知道出了什么问题吗?
谢谢