File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 4848 <example >
4949 <title >引用符付きの属性の変換</title >
5050 <programlisting role =" php" >
51- <![CDATA[
51+ <![CDATA[
5252<?php
5353$doc = new DOMDocument;
5454$doc->loadXML(<<<XML
5555<books>
5656 <book name="'quoted' name">Book title</book>
5757</books>
5858XML);
59+
5960$xpath = new DOMXPath($doc);
61+
6062$query = "//book[@name=" . DOMXPath::quote("'quoted' name") . "]";
6163echo $query, "\n";
64+
6265$entries = $xpath->query($query);
66+
6367foreach ($entries as $entry) {
6468 echo "Found ", $entry->textContent, "\n";
6569}
@@ -68,7 +72,7 @@ foreach ($entries as $entry) {
6872 </programlisting >
6973 &example.outputs;
7074 <screen >
71- <![CDATA[
75+ <![CDATA[
7276//book[@name="'quoted' name"]
7377Found Book title
7478]]>
@@ -77,15 +81,15 @@ Found Book title
7781 引用符が混在している文字列もサポートします:
7882 </simpara >
7983 <programlisting role =" php" >
80- <![CDATA[
84+ <![CDATA[
8185<?php
8286echo DOMXPath::quote("'different' \"quote\" styles");
8387?>
8488]]>
8589 </programlisting >
8690 &example.outputs;
8791 <screen >
88- <![CDATA[
92+ <![CDATA[
8993concat("'different' ",'"quote" styles')
9094]]>
9195 </screen >
121125vim600: syn=xml fen fdm=syntax fdl=2 si
122126vim: et tw=78 syn=sgml
123127vi: ts=1 sw=1
124- -->
128+ -->
You can’t perform that action at this time.
0 commit comments