2012-11-25 28 views
1

我有兩個xml文件。我想從另一個xml文件中引用一個節點的值。如何使用xpointer從另一個文檔鏈接到特定節點

例如:1.XML

<?xml version="1.0"?> 
<catalog> 
    <book id="bk101"> 
     <author>Gambardella, Matthew</author> 
     <title>XML Developer's Guide</title> 
     <genre>Computer</genre> 
     <price>44.95</price> 
     <publish_date>2000-10-01</publish_date> 
     <description>An in-depth look at creating applications 
     with XML.</description> 
    </book> 
    <book id="bk102"> 
     <author>Ralls, Kim</author> 
     <title>Midnight Rain</title> 
     <genre>Fantasy</genre> 
     <price>5.95</price> 
     <publish_date>2000-12-16</publish_date> 
     <description>A former architect battles corporate zombies, 
     an evil sorceress, and her own childhood to become queen 
     of the world.</description> 
    </book> 
    <book id="bk103"> 
     <author>Corets, Eva</author> 
     <title>Maeve Ascendant</title> 
     <genre>Fantasy</genre> 
     <price>5.95</price> 
     <publish_date>2000-11-17</publish_date> 
     <description>After the collapse of a nanotechnology 
     society in England, the young survivors lay the 
     foundation for a new society.</description> 
    </book> 
</catalog> 

的2.XML是

<?xml version="1.0" encoding="ISO-8859-1"?> 
<doc xmlns:xi="http://www.w3.org/2003/XInclude"> 
<xi:include href="1.xml" xpointer="bk101"/> 
</doc> 

當我執行2.XML,我得到一個錯誤說 此XML文件沒有出現任何風格的信息與它相關聯。文檔樹如下所示。

<doc><xi:include href="book.xml" xpointer="bk101"/></doc> 

我可以在解決問題時獲得一些幫助。

感謝

回答

相關問題