在我的项目中,我使用了 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.
这真的很有趣,可以隐藏代码中 XML 解析的复杂性。如果可以的话请选择它。
关于java - 如何在基于 Spring DAO 的应用程序中实现 xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9534287/