java - 如何在基于 Spring DAO 的应用程序中实现 xml?

标签 java xml spring oxm

在我的项目中,我使用了 JSF 和 SpringDAO 以及 Web 服务。 我正在调用各种 Web 服务,这些服务会返回 XML,并且我需要解析和使用此 XML。 所以我的问题是...我可以使用什么?

Spring 默认情况下有什么我可以检查的吗? 我是否需要单独解析我的内容并通过核心java代码使用它? 或其他任何事情...

这种情况下可以做什么呢?

最佳答案

两种经典的XML解析器都是基于SAX和DOM的。阅读此处了解有关 this 的更多信息.

Spring 还支持对象/XML 映射。即,

A new feature, as of Spring 3.0, is the O/X Mapper. The concept of an O/X mapper is not new. The O stands for Object. The X stands for XML. The idea is to translate a Java object (almost always a plain old Java object or POJO) into an XML document and vice versa.

So, for example, you might have a simple bean with a few attributes and you have a business need to translate that Java object into an XML document. Spring's O/X Mapper can handle that for you. If the reverse is true (that is, you need to take an XML document and translate it into a simple Java bean), Spring's O/X Mapper can also handle that.

阅读文章 here或 API here .

这真的很有趣,可以隐藏代码中 XML 解析的复杂性。如果可以的话请选择它。

关于java - 如何在基于 Spring DAO 的应用程序中实现 xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9534287/

相关文章:

java - 为什么 `%4.` 在我的号码中添加空格?

java - 在 Java 中生成音调并改变它的音色?

java - 更改 Maven 原型(prototype)中的默认类名 :generate

C从XML中提取数据

java - 如何在 Java 中使用 DOM 获取目标命名空间及其前缀?

Android设计——RelativeLayout(背景色)

java - Json 忽略实体中的集合

java - 表达式执行 Spring 方面

java - 使用 Resteasy 验证请求的正确方法是什么?

java - 在 Spring 中处理空的 RequestBody