gpt4 book ai didi

android - XSD 字段 "No resource type specified"上的 Eclipse 错误

转载 作者:行者123 更新时间:2023-11-30 03:40:45 25 4
gpt4 key购买 nike

这是后续问题:

How to set restriction on XSD for id attributes

我使用 Eclipse。我用答案代码创建了一个 XSD 文件,但我遇到了这 3 个错误:

error: Error: No resource type specified (at 'xpath' with value '@id'). fsm.xsd /test/res/xml   line 24 Android AAPT Problem
error: Error: No resource type specified (at 'xpath' with value '@toState'). fsm.xsd /test/res/xml line 32 Android AAPT Problem
error: Error: No resource type specified (at 'xpath' with value '@fromState'). fsm.xsd /test/res/xml line 28 Android AAPT Problem

使用 xsd 的 XMLSchema 实例的 XML 测试文件验证正常,即使存在 3 个提到的错误。
我想知道这些错误是否只是 Eclipse 中的一个小故障,还是我需要定义其他东西来消除它们。

XSD 源代码:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="FSM">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="state">
<xs:complexType>
<xs:attribute name="id" type="xs:unsignedByte" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="transition">
<xs:complexType>
<xs:attribute name="fromState" type="xs:unsignedByte" use="required"/>
<xs:attribute name="toState" type="xs:unsignedByte" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:key name="PKStates">
<xs:selector xpath="state"/>
<xs:field xpath="@id"/>
</xs:key>
<xs:keyref name="FKTransitionToStatesFrom" refer="PKStates">
<xs:selector xpath="transition"/>
<xs:field xpath="@fromState"/>
</xs:keyref>
<xs:keyref name="FKTransitionToStatesTo" refer="PKStates">
<xs:selector xpath="transition"/>
<xs:field xpath="@toState"/>
</xs:keyref>
</xs:element>
</xs:schema>

XML 测试文件:

<?xml version="1.0" encoding="utf-8"?>
<FSM xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="fsm.xsd">
<state name="S1" id="1"/>
<state name="S2" id="2"/>
<state name="S3" id="3"/>
<transition toState="1" fromState="2"/>
</FSM>

最佳答案

这是一个 Eclipse 问题,很可能与您的设置有关。该模式在各种工具和平台中完全有效,包括 QTAssistant、Visual Studio、NetBeans、Xerces 和 Eclipse Helios(我知道,有点旧)。

关于android - XSD 字段 "No resource type specified"上的 Eclipse 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15790321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com