2015-09-10 21 views
0

喜現在即時通訊使用XSLT的工作,現在我打電話給服務如何在服務中逃避xml空間?

像這樣

<xsl:for-each select="ext"> 
        <config type="2" liveserver="XXX.com" localserver="XXX.com" httpuri="/myservices/jsonrequesthomenew?companyid=homepage&amp;outputtype=xml" params="" readtimeout="10000"/> 
       </xsl:for-each> 

如果我cehck這個活的URL不是顯示了這一結果

<?xml version="1.0" encoding="UTF-8"?> 
<indexes> 
    <data> 
     <sensex> 
      <CloseIndexValue>25719.58</CloseIndexValue> 
      <trend>equal</trend> 
      <premarket>false</premarket> 
      <DateTime>03:53 PM | 10 Sep 2015</DateTime> 
      <CurrentIndexValue>25622.17</CurrentIndexValue> 
      <Segment>BSE</Segment> 
      <OpenIndexValue>25522.96</OpenIndexValue> 
      <IndexName>SENSEX</IndexName> 
      <PercentChange>-0.38</PercentChange> 
      <NetChange>-97.41</NetChange> 
     </sensex> 
     <nifty> 
      <CloseIndexValue>7818.60</CloseIndexValue> 
      <trend>equal</trend> 
      <premarket>false</premarket> 
      <DateTime>03:53 PM | 10 Sep 2015</DateTime> 
      <CurrentIndexValue>7788.10</CurrentIndexValue> 
      <Segment>NSE</Segment> 
      <OpenIndexValue>7729.05</OpenIndexValue> 
      <IndexName>CNX NIFTY</IndexName> 
      <PercentChange>-0.39</PercentChange> 
      <NetChange>-30.50</NetChange> 
     </nifty> 
     <USD> 
      <DateTime>2015-09-10 15:48:06.0</DateTime> 
      <netChange>0.05</netChange> 
      <percentChange>0.08</percentChange> 
      <name>USD/INR</name> 
      <bidprice>66.47</bidprice> 
     </USD> 
     <silver> 
      <ClosePrice>35294.00</ClosePrice> 
      <trend>negative</trend> 
      <OpenPrice>35391.00</OpenPrice> 
      <ExpiryDate>2015-12-04</ExpiryDate> 
      <SpotSymbol>SSILVERAHM</SpotSymbol> 
      <LastTradedPrice>35475.00</LastTradedPrice> 
      <DateTime>10-September-2015 15:46:32</DateTime> 
      <Symbol>SILVER</Symbol> 
      <PercentChange>0.51</PercentChange> 
      <CommodityName>Silver</CommodityName> 
      <NetChange>181.00</NetChange> 
      <SpotPrice>34912.0</SpotPrice> 
      <PriceQuotationUnit>1 KGS </PriceQuotationUnit> 
     </silver> 
     <marketstatus> 
      <currentMarketStatus>Live</currentMarketStatus> 
     </marketstatus> 
     <gold> 
      <ClosePrice>26057.00</ClosePrice> 
      <trend>positive</trend> 
      <OpenPrice>26143.00</OpenPrice> 
      <ExpiryDate>2015-10-05</ExpiryDate> 
      <SpotSymbol>SGOLDAHM</SpotSymbol> 
      <LastTradedPrice>26067.00</LastTradedPrice> 
      <DateTime>10-September-2015 15:46:15</DateTime> 
      <Symbol>GOLD</Symbol> 
      <PercentChange>0.04</PercentChange> 
      <CommodityName>Gold</CommodityName> 
      <NetChange>10.00</NetChange> 
      <SpotPrice>26003.0</SpotPrice> 
      <PriceQuotationUnit>10 GRMS </PriceQuotationUnit> 
     </gold> 
     <DXY Index> 
      <DateTime>2015-09-10 15:49:21.0</DateTime> 
      <netChange>0.1</netChange> 
      <percentChange>0.1</percentChange> 
      <name>DXY Index</name> 
      <bidprice>96.11</bidprice> 
     </DXY Index> 
    </data> 
</indexes> 

但這服務不是調用我的xslt文件爲什麼你可以幫我。

我檢查這個XML在thsi網址http://www.xmlvalidation.com/index.php?id=1&L=0

比顯示的數據證實此錯誤

Click on to jump to the error. In the document, you can point at with your mouse to see the error message. 
Errors in the XML document: 
    1: 1931 Attribute name "Index" associated with an element type "DXY" must be followed by the ' = ' character. 

如何解決在前端的這個錯誤。

+0

請佈置您的代碼。一行2110個字符是完全不可讀的......如果你已經完成了,你可能立即發現了明顯的錯誤;),參見[mcve] – Abel

回答

2

你所得到的錯誤是因爲該元素在你的XML

<DXY Index> 
    <DateTime>2015-09-10 15:49:21.0</DateTime> 
    <netChange>0.1</netChange> 
    <percentChange>0.1</percentChange> 
    <name>DXY Index</name> 
    <bidprice>96.11</bidprice> 
    </DXY Index> 

DXY Index不是一個有效的元素名稱,因爲你不能在元素名稱空間。

的XML需要更正,所以這個名字是什麼DXYIndexDXY-Index,儘管你實際使用將取決於哪些XML實際使用的名稱。