xml schema validation error “prefix is not bound”

北慕城南 提交于 2019-12-03 04:59:47

In your XML, you either need to:

A. Remove the sample: prefix from sample:school

or

B. Change the xmlns="http://www.example.com" to xmlns:sample="http://www.example.com" and add the sample: prefix to the rest of the elements (<sample:element1>, <sample:element2>, etc.)

When you get an error like this, the simplest way is to add the prefix declaration; in your case, as per schema, just add to your root element the following attribute:

xmlns:sample="http://www.example.com"

Also, this is rather related with XML namespaces.

It's not direct answer to your question, but I stumbled here while trying to solve my own problem, so maybe it will help someone too.

My own error 'The prefix ns2 is not bound' surfaced after upgrading from Weblogic 10.3.6 to 12.2.1.2.

In higher version default JAXB Implementation is Moxy, so I had to change javax.xml.bind.JAXBContext to com.sun.xml.bind.v2.ContextFactory.

How to specify JAXBContext implementation in weblogic 12.1.3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!