从 XML 字符串及其存储在字符串中的模式进行内存中解组,可能吗?
假设我将一个 XML 字符串存储到一个变量中
String resp = new String("<?xml version=\"1.0\" encodin...");
,并将与此 XML 相关的模式定义存储在另一个变量中:
String xsd = new String("<xs:schema xmlns="http://schema-...");
您认为有一种方法可以验证和解组“resp”吗? 到对象中(例如使用 JAXB)?有没有人已经 尝试过或成功实施了这样的东西?
提前,非常感谢您的任何建议...... 塞布
Let's suppose I store an XML string into a variable
String resp = new String("<?xml version=\"1.0\" encodin...");
and the schema definition related to this XML in another one:
String xsd = new String("<xs:schema xmlns="http://schema-...");
do you think there is a way to validate and unmarshall 'resp'
into objects (using JAXB for example) ?? Has anybody already
tried or successfully implemented such stuff ??
In advance, thanks a lot for any suggestion...
Seb
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 unmarshal(源代码) 和 Unmarshaller 类的 setSchema(Schema schema)。这应该有效:
You can use unmarshal(Source source) and setSchema(Schema schema) of the Unmarshaller class. This should work: