开发者

Error when converting an XSD to its classes with JAXB

This is the first time I've ever tried to use JAXB for anything at all and I'm running into a problem.

I'm trying to use JAXB's XJC tool to convert an XSD file into Java class files when I get this error:

parsing a schema...  
[ER开发者_Python百科ROR] The prefix "msdata" for attribute "msdata:ColumnName" associated with an element type "xs:simpleContent" is not bound.  
line 10 of file:/home/jeremy/TypeDefs.xsd
Failed to parse a schema.

Line 10 in the schema file reads:

<xs:simpleContent msdata:ColumnName="paramText" msdata:Ordinal="1">

and you can see the whole thing here.

edit: It turns out the XSD file was missing the namespace declaration for msdata. Simply adding xmlns:msdata="http://schemas.microsoft.com/2003/07/msdata.xsd" fixed the problem.


You need to have the msdata namespace prefix mapped. Like

<xs:schema targetNamespace="http://maps.trimet.org/maps/model/xml" 
    xmlns="http://maps.trimet.org/maps/model/xml"
    ....
    xmlns:msdata="http://yournamespace.com/foo">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜