0

xinclude に関連する Q をいくつか見つけましたが、外部ドキュメントを含める方法に関する私の非常に基本的な質問に具体的に答えたものはありませんでした

相互に参照したい xml ドキュメントをいくつか示します。

<?xml version="1.0" encoding="UTF-8"?>
<t:person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://test test-schema.xsd"
    xmlns:t="http://test">

    <t:first-name>Wilma</t:first-name>
    <t:last-name>Flintstone</t:last-name>
    <t:spouse>
        <xi:include xmlns:xi="http://www.w3.org/TR/xinclude" href="fred.xml"/>
    </t:spouse>

</t:person>

<?xml version="1.0" encoding="UTF-8"?>
<t:person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://test test-schema.xsd"
 xmlns:t="http://test">
    <t:first-name>Fred</t:first-name>
    <t:last-name>Flintstone</t:last-name>
    <t:spouse>
        <xi:include xmlns:xi="http://www.w3.org/TR/xinclude" href="wilma.xml"/>
    </t:spouse>
</t:person>

およびスキーマ:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://test"
    targetNamespace="http://test" elementFormDefault="qualified"> 

<xs:element name="person" type="personType"/>

<xs:complexType name="personType">
    <xs:sequence>
        <xs:element name="first-name" type="xs:string"/>
        <xs:element name="last-name" type="xs:string"/>
        <xs:element name="spouse" type="personType"/>
    </xs:sequence>
</xs:complexType>

</xs:schema>

xi:include 要素が無効として表示されます。私は周りを検索してきましたが、このような単純な例を見つけることができません。xi:include は、そこにあるはずの要素の単なる代用ですよね?

ありがとう、bp

4

2 に答える 2

1

検証と XInclude 処理の両方を実行したい人は、最初に XInclude を実行してから検証するか、または最初に検証してから XInclude を実行するか、最初に検証してから XInclude 処理を実行してから再度検証することを希望する場合があります。読心術技術の現在の状態では、人間の助けがなければ、ソフトウェアはこれらのどれが望ましいかを判断できません。物事をどのような順序で実行したいかはわかっていますが、ソフトウェアに指示しましたか? あなたの説明から、プロセッサがデフォルトで最初に検証してからXIncludeを実行するように聞こえます。デフォルト以外の処理シーケンスが必要な場合は、プロセッサに通知する必要があります。その方法はプロセッサに依存します。ドキュメントを読んでください。

于 2013-02-10T19:01:51.240 に答える