我们从供应商那里获得了一套模式,(我们也提醒他们注意错误) 当我尝试使用xjc生成Java类时,它失败并出现以下错误
C:\Users\...>"C:\Program Files (x86)\Java\jdk1.7.0_80\bin\xjc.exe" -d output ICSv1.01.xsd
解析架构......
[错误] s4s-elt-invalid-content.1:' ICSBatchV01'的内容是 无效。元素'断言'无效,错位或过于频繁发生。 文件的第77行:/ C:/ Users /.../ ICSv1.01.xsd
[错误] s4s-elt-invalid-content.1:' ICSDocBody'的内容是 无效。元素'断言'无效,错位或过于频繁发生。 文件的第215行:/ C:/ Users /.../ ICSv1.01.xsd
无法解析架构。
我也尝试过java 8,以及最新最好的jaxb(java dist之外)
然而,它确实与Altova的xmlspy软件配合使用,但试图避免供应商锁定/非标准内容。
我在这里搜索了一些网页(主要是在这里)
这是标题。
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2015 rel. 4 sp1 (x64) (http://www.altova.com) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:msg01="urn:cccc:tech:xsd:ics.msg01.001" xmlns:msg02="urn:cccc:tech:xsd:ics.msg02.001" xmlns:msg03="urn:cccc:tech:xsd:ics.msg03.001" xmlns:msg04="urn:cccc:tech:xsd:ics.msg04.001" xmlns:msg05="urn:cccc:tech:xsd:ics.msg05.001" xmlns:msg06="urn:cccc:tech:xsd:ics.msg06.001" xmlns:msg07="urn:cccc:tech:xsd:ics.msg07.001" xmlns:msg08="urn:cccc:tech:xsd:ics.msg08.001" xmlns:msg09="urn:cccc:tech:xsd:ics.msg09.001" xmlns:msg11="urn:cccc:tech:xsd:ics.msg11.001" xmlns:msg12="urn:cccc:tech:xsd:ics.msg12.001" xmlns:msg13="urn:cccc:tech:xsd:ics.msg13.001" xmlns:msg14="urn:cccc:tech:xsd:ics.msg14.001" xmlns:msq01="urn:cccc:tech:xsd:ics.msq01.001" xmlns:msq02="urn:cccc:tech:xsd:ics.msq02.001" xmlns:msq03="urn:cccc:tech:xsd:ics.msq03.001" xmlns:msq04="urn:cccc:tech:xsd:ics.msq04.001" xmlns:msq05="urn:cccc:tech:xsd:ics.msq05.001" xmlns:msf01="urn:cccc:tech:xsd:ics.msf01.001" xmlns:msf02="urn:cccc:tech:xsd:ics.msf02.001" xmlns:msf03="urn:cccc:tech:xsd:ics.msf03.001" xmlns:msf04="urn:cccc:tech:xsd:ics.msf04.001" xmlns:mss01="urn:cccc:tech:xsd:ics.mss01.001" xmlns:mss02="urn:cccc:tech:xsd:ics.mss02.001" xmlns:mss03="urn:cccc:tech:xsd:ics.mss03.001" xmlns:mss04="urn:cccc:tech:xsd:ics.mss04.001" xmlns:msp01="urn:cccc:tech:xsd:ics.msp01.001" xmlns:msp02="urn:cccc:tech:xsd:ics.msp02.001" xmlns:msp03="urn:cccc:tech:xsd:ics.msp03.001" xmlns:msp04="urn:cccc:tech:xsd:ics.msp04.001" xmlns:doc="urn:cccc:tech:xsd:ics.doc.001" xmlns="urn:cccc:tech:xsd:ics.doc.001" targetNamespace="urn:cccc:tech:xsd:ics.doc.001" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1">
以下是相关摘录 从第44行开始到第77行结束(xjc转换报告了第一个错误)
<xs:complexType name="ICSBatchV01">
<xs:sequence>
<xs:element name="DocHdr" type="ICSDocumentHeader"/>
<xs:element name="DocBody" type="ICSDocBody"/>
</xs:sequence>
<xs:assert test="
(doc:DocHdr/doc:DocTyp='MSG01' and (count(doc:DocBody/msg01:MSG01PmtSubm) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG02' and (count(doc:DocBody/msg02:MSG02PmtSubmAckNak) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG03' and (count(doc:DocBody/msg03:MSG03TSetRejection) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG04' and (count(doc:DocBody/msg04:MSG04LocalBankHoliday) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG05' and (count(doc:DocBody/msg05:MSG05BeneficiaryFraudNotn) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG06' and (count(doc:DocBody/msg06:MSG06PmtRequest) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG07' and (count(doc:DocBody/msg07:MSG07PmtResponse) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG08' and (count(doc:DocBody/msg08:MSG08PmtResponseAckNak) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG09' and (count(doc:DocBody/msg09:MSG09PmtResponseItemRejection) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG11' and (count(doc:DocBody/msg11:MSG11SettlementPreventedNotn) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG12' and (count(doc:DocBody/msg12:MSG12DefaultPmtResponseNotn) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG13' and (count(doc:DocBody/msg13:MSG13PmtNotn) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSG14' and (count(doc:DocBody/msg14:MSG14PmtFrdStsUp) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSQ01' and (count(doc:DocBody/msq01:MSQ01QueryMessage) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSQ02' and (count(doc:DocBody/msq02:MSQ02QuerySubmAckNak) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSQ03' and (count(doc:DocBody/msq03:MSQ03QueryRejection) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSQ04' and (count(doc:DocBody/msq04:MSQ04QueryNotn) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSQ05' and (count(doc:DocBody/msq05:MSQ05QuerySettlementPrevented) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSF01' and (count(doc:DocBody/msf01:MSF01FrdSetUnset) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSF02' and (count(doc:DocBody/msf02:MSF02FraudItemSubmAckNak) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSF03' and (count(doc:DocBody/msf03:MSF03FraudItemRejection) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSF04' and (count(doc:DocBody/msf04:MSF04FrdSetUnsetNotn) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSS01' and (count(doc:DocBody/mss01:MSS01StopChq) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSS02' and (count(doc:DocBody/mss02:MSS02StopChqAckNak) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSS03' and (count(doc:DocBody/mss03:MSS03StopChqRejection) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSS04' and (count(doc:DocBody/mss04:MSS04StopChq ) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSP01' and (count(doc:DocBody/msp01:MSP01PrevPd) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSP02' and (count(doc:DocBody/msp02:MSP02PrevPdAckNak) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSP03' and (count(doc:DocBody/msp03:MSP03PrevPdRejection) = xs:integer(doc:DocHdr/doc:NbOfTxs))) or
(doc:DocHdr/doc:DocTyp='MSP04' and (count(doc:DocBody/msp04:MSP04PrevPd) = xs:integer(doc:DocHdr/doc:NbOfTxs)))
">
<xs:annotation>
<xs:documentation>MIG 10.1 NbOfTxs (MWR030): count of messages in document</xs:documentation>
<xs:documentation>MIG 10.1 DocTyp: code identifying the document content</xs:documentation>
</xs:annotation>
</xs:assert>
</xs:complexType>
答案 0 :(得分:4)
viewModel.Skleps = viewModel.Sklep_has_Miejsces.Where(i => i.MiejsceID == id.Value).Select(s => s.Sklep);
需要XSD 1.1,JAXB only supports XSD 1.0, not XSD 1.1。
xs:assert
,编写一个简单的XSLT转换
剥离xs:assert
验证,以便您仍然可以生成
类。 (请参阅下面的XSLT。)根据需要,可以选择实施xs:assert
检查
在Java代码中手动。 要剥离xs:assert
的XSLT:
xs:assert