Say you have a set of XML files, each containing information about a book,
and you want to build an index showing the document title and its author for
the collection.
You need to parse the XML files to recognize the title and author elements
and their contents.
You could do this by hand with regular expressions and string functions such
as strtok(), but it’s a lot more complex than it seems.
In addition, such methods are prone to breakage even with valid XML documents.
The easiest and quickest solution is to use one of the XML parsers that
ship with PHP.
------
板友好,最近念到「XML parsing」章節,上方是其中一段,為閱讀方便故適當分行。
依個人解讀,前三句主要是講解析XML,可以使用regular expression或strtok函式。
到第四句就不太懂,因為依字面解讀,應該是說前述兩種做法,容易毀損XML文件。
一來不確定自己解讀是否正確,二來即使解讀正確,也不太清楚其原因為何。
還請板友多指教,謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.248.73.82
→
10/14 09:26, , 1F
10/14 09:26, 1F
→
10/14 11:16, , 2F
10/14 11:16, 2F
→
10/14 12:33, , 3F
10/14 12:33, 3F
→
10/14 12:34, , 4F
10/14 12:34, 4F
→
10/14 12:34, , 5F
10/14 12:34, 5F
→
10/14 12:34, , 6F
10/14 12:34, 6F
→
10/14 13:44, , 7F
10/14 13:44, 7F
→
10/14 13:44, , 8F
10/14 13:44, 8F
→
10/14 23:47, , 9F
10/14 23:47, 9F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章