xml文档如下<?xml version="1.0" encoding="utf-8" ?>
<Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../file-formats/tsdmas.xsd">
<Alarm AlarmCode="1" StartT="20080627T220140" EndT="20080627T220140" AckedYN="20080627T220140"> </Alarm></Message>
xsd如下
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Message">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Alarm" />
</xsd:sequence>
</xsd:complexType>
</xsd:element><xsd:simpleType name="dateTimeFormat">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(19 ¦20)[0-9]{2}(0[1-9] ¦1[012])(0[1-9] ¦[12][0-9] ¦3[01])T([01][0-9] ¦2[0-3])([0-5][0-9]){2}" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="dateTimeFormatOrEmpty">
<xsd:restriction base="xsd:string">
<xsd:pattern value="((19 ¦20)[0-9]{2}(0[1-9] ¦1[012])(0[1-9] ¦[12][0-9] ¦3[01])T([01][0-9] ¦2[0-3])([0-5][0-9]){2})*" />
</xsd:restriction>
</xsd:simpleType><xsd:element name="Alarm">
<xsd:complexType>
<xsd:attribute name="AlarmCode" type="xsd:integer" />
<xsd:attribute name="StartT" type="dateTimeFormat" />
<xsd:attribute name="EndT" type="dateTimeFormatOrEmpty" />
<xsd:attribute name="AckedYN" type="dateTimeFormatOrEmpty" />
</xsd:complexType>
</xsd:element>
</xsd:schema>每次用java解析这个xml都抛异常The XML document has the wrong format. Error on line 23:
cvc-complex-type.2.1: Element 'Alarm' must have no character or element information item [children],
because the type's content type is empty.弄了好长时间了 求大家帮帮我吧
<Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../file-formats/tsdmas.xsd">
<Alarm AlarmCode="1" StartT="20080627T220140" EndT="20080627T220140" AckedYN="20080627T220140"> </Alarm></Message>
xsd如下
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Message">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Alarm" />
</xsd:sequence>
</xsd:complexType>
</xsd:element><xsd:simpleType name="dateTimeFormat">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(19 ¦20)[0-9]{2}(0[1-9] ¦1[012])(0[1-9] ¦[12][0-9] ¦3[01])T([01][0-9] ¦2[0-3])([0-5][0-9]){2}" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="dateTimeFormatOrEmpty">
<xsd:restriction base="xsd:string">
<xsd:pattern value="((19 ¦20)[0-9]{2}(0[1-9] ¦1[012])(0[1-9] ¦[12][0-9] ¦3[01])T([01][0-9] ¦2[0-3])([0-5][0-9]){2})*" />
</xsd:restriction>
</xsd:simpleType><xsd:element name="Alarm">
<xsd:complexType>
<xsd:attribute name="AlarmCode" type="xsd:integer" />
<xsd:attribute name="StartT" type="dateTimeFormat" />
<xsd:attribute name="EndT" type="dateTimeFormatOrEmpty" />
<xsd:attribute name="AckedYN" type="dateTimeFormatOrEmpty" />
</xsd:complexType>
</xsd:element>
</xsd:schema>每次用java解析这个xml都抛异常The XML document has the wrong format. Error on line 23:
cvc-complex-type.2.1: Element 'Alarm' must have no character or element information item [children],
because the type's content type is empty.弄了好长时间了 求大家帮帮我吧
楼主【wodi1015】截止到2008-07-15 13:14:19的历史汇总数据(不包括此帖):
发帖的总数量:56 发帖的总分数:2290 每贴平均分数:40
回帖的总数量:49 得分贴总数量:3 回帖的得分率:6%
结贴的总数量:54 结贴的总分数:2090
无满意结贴数:8 无满意结贴分:270
未结的帖子数:2 未结的总分数:200
结贴的百分比:96.43 % 结分的百分比:91.27 %
无满意结贴率:14.81 % 无满意结分率:12.92 %
值得尊敬
必须转为
<Alarm AlarmCode="1" StartT="20080627T220140" EndT="20080627T220140" AckedYN="20080627T220140"/>