Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
androidxml样式表解析_Android_Xml_Stylesheet - Fatal编程技术网

androidxml样式表解析

androidxml样式表解析,android,xml,stylesheet,Android,Xml,Stylesheet,如何在android中解析这些xml数据 xml样式表格式不同于普通xml 我需要这些领域 柯德 纸币购买 纸币销售 <?xml version="1.0" encoding="ISO-8859-9"?> <?xml-stylesheet type="text/xsl" href="isokur.xsl"?> <Tarih_Date Tarih="20.07.2012" Date="07/20/2012"> <Currency Kod="USD" Cu

如何在android中解析这些xml数据

xml样式表格式不同于普通xml

我需要这些领域

柯德 纸币购买 纸币销售

<?xml version="1.0" encoding="ISO-8859-9"?>
<?xml-stylesheet type="text/xsl" href="isokur.xsl"?>
<Tarih_Date Tarih="20.07.2012" Date="07/20/2012">

<Currency Kod="USD" CurrencyCode="USD">
    <Unit>1</Unit>
    <Isim>AMERİKAN DOLARI</Isim>
    <CurrencyName>US DOLLAR</CurrencyName>
    <ForexBuying>1.7967</ForexBuying>
    <ForexSelling>1.8054</ForexSelling>
    <BanknoteBuying>1.7954</BanknoteBuying>
    <BanknoteSelling>1.8081</BanknoteSelling>
    <CrossRateUSD>1</CrossRateUSD>
    <CrossRateOther></CrossRateOther>
</Currency>

<Currency Kod="EUR" CurrencyCode="EUR">
    <Unit>1</Unit>
    <Isim>EURO</Isim>
    <CurrencyName>EURO</CurrencyName>
    <ForexBuying>2.1998</ForexBuying>
    <ForexSelling>2.2104</ForexSelling>
    <BanknoteBuying>2.1983</BanknoteBuying>
    <BanknoteSelling>2.2137</BanknoteSelling>
    <CrossRateUSD></CrossRateUSD>
    <CrossRateOther>1.2243</CrossRateOther>
</Currency>

1.
阿默尔坎·多拉里
美元
1.7967
1.8054
1.7954
1.8081
1.
1.
欧元
欧元
2.1998
2.2104
2.1983
2.2137
1.2243

我认为不应该有什么不同。最后,这也是一个由标记和属性组成的XML文件。
如果您需要有关解析XML的更新,可能会让您热身。

您可以安全地忽略并像解析任何其他XML一样解析XML<代码>xml样式表是一种向表示代理(如浏览器)暗示转换的方法,该转换将按预期的方式表示xml。仍然由代理决定是否使用样式表


本例中的代理就是您的应用程序。

Android提供了大部分java api(SAX和DOM)来解析XML文档。您可以执行如下操作来解析xml并获取所需的字段

DocumentBuilder docBuild= docBuildFactory.newDocumentBuilder();
InputSource in= new InputSource();
in.setCharacterStream(new StringReader(xml));
Document doc = docBuild.parse(in); 
NodeList nodes = doc.getElementsByTagName("Currency");
Element e = (Element)nodes.item(i);
XMLfunctions.getValue(e, "BanknoteBuying")

这必须解决您的问题……)

如果您真的希望将isokur.xsl XSLT样式表应用于XML,那么我认为您可能运气不好。据我所知,Android上目前还没有XSLT处理器。我们正在考虑将Saxon移植到这个平台的可能性,但现在还没有