0

ドキュメント タイプのリストとドキュメント コレクションのリストを管理する XML シートを作成しています。現在、次のようになっています。

<collection>
    <types>
        <type id="T001">CD</type>
        <type id="T002">Drawing</type>
        <type id="T003">Book</type>
        <type id="T004">Photo</type>
        <type id="T005">Letter</type>
    </types>
    <languages>
        <lang id="EN">English</taal>
        <lang id="FR">French</taal>
    </languages>
    <documents>
        <document>
            <type>T001</type>
            <lang>EN</lang>
        </document>
        <document>
            <type>T003</type>
            <lang>FR</lang>
        </document>
        <document>
            <type>T001</type>
            <lang>EN</lang>
        </document>
        <document>
            <type>T002</type>
            <lang>EN</lang>
        </document>
    <documents>
</collection>

XSL / Xpath を使用してクエリを実行できるように、DTD エンティティを使用する代わりに、XML シート内で型と言語のリストを管理します。

ご覧のとおり、 要素と 要素は 2 つの異なるケースで使用されます。最初のリスト (型/言語) ではそれらを識別子として使用し、後でそれらを参照要素として使用しますが、同じノード名を使用します。識別子と参照要素の両方に同じノード名を使用するのは、あまりきちんとしていないと思います。これを行うための別のより良い方法は何でしょうか?

4

1 に答える 1

1

それは単なる慣習の問題です。個人的には、次のように変更します。

<documents>
    <document>
        <typeRef>T001</type>
        <langRef>EN</lang>
        ...

または:

<documents>
    <document type="T001" lang="EN">
    ...
于 2013-01-14T12:07:03.013 に答える