它采用与Android的功放解析XML; LT;和&安培; GT;而不是"<"和">"安培、功放、而不是、XML

2023-09-06 11:20:29 作者:不美不萌照樣拽

我在使用Web服务,返回XML格式,但&放大器; LT; &放大器; GT; 而不是<和>

I'm using a WEB service which return XML format but with &lt; and &gt; instead of "<" and ">".

现在我不知道该如何解析呢?

Now I dont know how to parse it?

我试过了标准的 SAX解析器:

if (entity != null && responseCode==200) {

            // A Simple JSON Response Read
            InputStream instream = entity.getContent();
            BufferedReader rd = null;             
                rd = new BufferedReader(new InputStreamReader(instream));
                InputSource is=new InputSource(rd);
                WebServiceRespondParser parser=new WebServiceRespondParser(category);
                SAXParserFactory factory=SAXParserFactory.newInstance();
                SAXParser sp=factory.newSAXParser();
                XMLReader reader=sp.getXMLReader();
                reader.setContentHandler(parser);
                reader.parse(is);   
                markers=parser.getMarkers();
        }

WEB服务:

http://gisn.tel-aviv.gov.il/ws_iriya_zmina/wsgis.asmx/GetData4TargetLayersFromAddress?Format=xml&TargetIriaLayerIDs=659&Radiuses=2000&Rechov=798&Bayit=3&Knisa=

我看了一些类似的问题,但大多数是在不同的语言,或者没有答案。

I read few similar question, but most are in different languages, or doesn't have answer.

推荐答案

这是XML是连接codeD,因为它是在标签内。你需要做的是先解析原始的XML,然后得到来自标签的价值。这将让你在正确的XML,你现在可以解析照常进行。

That XML is encoded because it's inside the tag. What you need to do is to first parse the original XML, then get the value from the tag. This will get you the proper XML that you can now parse as usual.