English 中文(简体)
我如何在共同愿景中解脱逃模式?
原标题:How can I disable escape mode in JSOUP?

我正在使用JSOUP(XML档案的java工具),我正在使用以下代码读一部在XML档案中保存的URL。 我的守则如下:

Document d = Jsoup.parse(new File("feed.xml"), null);
Element elementCat = d.getElementsByTag("cat").get(0);
String stringUrl = elementCat.ownText();
System.out.println(stringUrl);

XML投入文件就是这样:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<root>
<cat>http://www.isna.ir/ISNA/FullNews.aspx?SrvID=Event&Lang=P</cat>
</root>

my problem is that the output of program is this: http://www.isna.ir/ISNA/FullNews.aspx?SrvID=Event⟪=P instead of this: http://www.isna.ir/ISNA/FullNews.aspx?SrvID=Event&Lang=P

In other words, it converts "&Lang" to "⟪" automatically. Please pay attention that it is not "&Lang;", it s just "&Lang" without semicolon. I want to disable encoding or escaping and I want the raw data.

我如何解决这一问题?

最佳回答

你们会拿着一部XML。 在XML中,有一种穿梭标记的方式,因为有时你只需要一个包含<代码>和>的文字;或带有<代码>的特性>。 资本使用特性实体参考,先是安乐器,然后是一部法典,然后是半殖民地。 如同:&lt;。 代表<代码><。

当然,这使我们面临营地本身的问题。 如果实际上需要一个安插器,而不是一些不同的特性实体,那么,你就不得不将其编码如下:&amp;

你们知道的是XML。 <代码>&表示,你重新开始特性实体参考,但随后获得<代码>Lang。 现在,也许会 j忙,这不成问题。 但这只是因为它用于超文本平价,而不是XML。 自2006年以来 超文本是比XML更宽松的比照,我假定,光是用其他东西替代它认为不为人所知的特性。 和<代码>。

因此,确保《打击危及海上航行安全公约》得到充分的信息。 如果做不到这一点,就不把它当作XML,而是作为超文本处理。 如果XML处理是你之后的重新处理,则看见SAX、StAX、OM或JAXB。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签