【发布时间】:2011-01-20 05:52:43
【问题描述】:
尝试 SAX 解析
<foo bar:car="zoo"/>
结果:
org.dom4j.DocumentException: Error on line 1 of document file:///c:/temp/test.xml : The prefix "bar" for attribute "bar:car" associated with an element type "foo" is not bound. Nested exception: The prefix "bar" for attribute "bar:car" associated with an element type "foo" is not bound.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.io.SAXReader.read(SAXReader.java:321)
at .<init>(<console>:18)
at .<clinit>(<console>)
at RequestResult$.<init>(<console>:9)
at RequestResult$.<clinit>(<console>)
at RequestResult$scala_repl_result(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja...
如何在不更改 XML 的情况下解决这个问题? (真正的 XML 来自我无法控制的 Web 服务)
【问题讨论】:
标签: java xml namespaces sax