[英]How can I reference XML ids from another XML using XInclude in a way that Webstorm does not mark it as an error?
I have the following XML files: 我有以下XML文件:
main file 主文件
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<template_structure xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xsi:noNamespaceSchemaLocation="template_structure_validator.xsd">
<xi:include href="parameter_definitions.xml" parse="xml"/>
<parameters>
<parameter idref="first_param" value="10"/>
</parameters>
</template_structure>
parameter_definitions.xml parameter_definitions.xml
<parameter_definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="template_structure_validator.xsd">
<def_parameter id="first_param" advanced="true">
<description>
first parameter
</description>
</def_parameter>
<def_parameter id="second_param" advanced="true">
<description>
second parameter
</description>
</def_parameter>
</parameter_definitions>
template_structure_validator.xsd: template_structure_validator.xsd:
<xs:element name="parameter_definitions">
<xs:complexType>
<xs:sequence>
<xs:element ref="def_parameter" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="def_parameter">
<xs:complexType>
<xs:sequence>
<xs:element ref="description"/>
</xs:sequence>
<xs:attribute name="id" use="required" type="xs:ID"/>
<xs:attribute name="advanced" use="required" type="xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name="parameters">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="parameter"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="parameter">
<xs:complexType>
<xs:attribute name="idref" use="required" type="xs:IDREF"/>
<xs:attribute name="value" use="required" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="js_template_structure">
<xs:complexType>
<xs:sequence>
<xs:element ref="parameter_definitions"/>
<xs:element ref="parameters"/>
</xs:sequence>
</xs:complexType>
</xs:element>
When I load them with Webstorm I get an error "first_param" is unresolved
in the main file. 当我用Webstorm加载它们时,在主文件中"first_param" is unresolved
错误"first_param" is unresolved
。 How can I fix it? 我该如何解决?
IDREF requires that the value specified for the attribute is also specified elsewhere in the document as an ID-attribute value. IDREF要求为属性指定的值也必须在文档的其他位置指定为ID属性值。 An IDREF value must appear elsewhere as an ID value: IDREF值必须在其他地方显示为ID值:
<xs:attribute name="id" type="xs:ID" use="required"/>
<!--...-->
<xs:attribute name="idref" use="required" type="xs:IDREF"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.