0

XMLの特殊文字を検証するためのスキマトロンテストを設定しようとしています...

具体的には、著作権記号(Unicode U + 00A9)が発生した場合に警告を発します。

ルールに次の表記法のいずれかを使用すると、schematronxmlファイルを解析できないようです...

<iso:rule context="myelement>
   <iso:report test="matches(., '\u00A9')">{ES1037} Copyright Symbol Detected</iso:report>
</iso:rule> 

<iso:rule context="myelement>
   <iso:report test="matches(., '\u{00A9}')">{ES1037} Copyright Symbol Detected</iso:report>
</iso:rule> 

<iso:rule context="myelement>
   <iso:report test="matches(., '\u{A9}')">{ES1037} Copyright Symbol Detected</iso:report>
</iso:rule> 

<iso:rule context="myelement>
   <iso:report test="matches(., '\x{00A9}')">{ES1037} Copyright Symbol Detected</iso:report>
</iso:rule> 

Unicode文字を正規表現に埋め込む方法を知っているスキマトロンの専門家はいますか?

前もって感謝します...

4

1 に答える 1

1

XML スキーマ標準で使用されているように、コードを文字エンティティとして記述する必要があります。

<?xml version="1.0" encoding="UTF-8"?>
<iso:schema xmlns:iso="http://purl.oclc.org/dsdl/schematron">
    <iso:pattern id="unicode in regex">
        <iso:rule context="a">
            <iso:report test="matches(., '&#xa9;')">
                Copyright found
            </iso:report>
        </iso:rule>
    </iso:pattern>
</iso:schema>

XML ValidatorBuddy での出力

于 2013-02-03T14:10:18.107 に答える