0

XMLスキーマをXMLファイルにリンクしたい。私はこの例に従いました:XSDHowTo

note.xml見た目は次のとおりです。

<?xml version="1.0"?>

<note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note> 

そして、note.xsd次のようになります。

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="xs:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema> 

しかし、を開くとnote.xml、ブラウザで通常のXMLのように見え、次のように説明されています。This XML file does not appear to have any style information associated with it. The document tree is shown below.
これらのファイルは両方とも同じディレクトリにあります。

4

2 に答える 2

2

XMLスキーマのアタッチとXSLTトランスフォーメーションのアタッチを混同していませんか?ブラウザが、スキーマがないことではなく、スタイルシートがないことを通知しているためです。

于 2012-05-16T23:14:35.680 に答える
0

XSD(スキーマ)は任意のxmlの検証目的のみを提供します...一方、XSLTはXMLのスタイリング目的を提供するために使用されます-wchはur xmlには存在しないため、ブラウザでのスタイリングをどのように期待できますか?このXMLファイルを実行しています...!!!

于 2012-05-17T07:21:13.607 に答える