我正在使用http://www.freeformatter.com/xml-validator-xsd.html来验证我的 XML 文件。收到以下消息
“Cvc-elt.1.a:找不到元素‘MatchedShareReport’的声明。‘2’行,‘21’列。”
这是架构
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.k12345.com/Data/k12345.xsd" targetNamespace="http://www.k12345.com/Data/k12345.xsd" elementFormDefault="qualified">
<xsd:element name="MatchedShareReport">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="FileHeader" type="tns:FileHeader" />
<xsd:element name="UsageDescription" type="tns:UsageDescription" />
<xsd:element name="UsageList" type="tns:UsageList" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="FileHeader">
<xsd:sequence>
<xsd:element name="FileId" type="xsd:string" />
<xsd:element name="FileParentId" type="xsd:string" />
<xsd:element name="FileSender" type="xsd:string" />
<xsd:element name="FileReceiver" type="xsd:string" />
<xsd:element name="FileDSPName" type="xsd:string" />
<xsd:element name="FileDescription" type="xsd:string" />
<xsd:element name="FileGroupId" type="xsd:string" />
<xsd:element name="FileGroupDescription" type="xsd:string" />
<xsd:element name="FileTimeStamp" type="xsd:dateTime" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="UsageDescription">
<xsd:sequence>
<xsd:element name="FilePeriod">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="StartDate" type="xsd:date" />
<xsd:element name="EndDate" type="xsd:date" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="UsageList">
<xsd:sequence>
<xsd:element name="Usage" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RecordingDetails" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RecordingTitle" type="xsd:string" />
<xsd:element name="RecordingVersionTitle" type="xsd:string" minOccurs="0" />
<xsd:element name="RecordingDisplayArtist" type="xsd:string" />
<xsd:element name="RecordingISRC" type="xsd:string" minOccurs="0" />
<xsd:element name="RecordingDSPId" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="WorkDetails" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="WorkPrimaryTitle" type="xsd:string" />
<xsd:element name="WorkISWC" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkK12345Id" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkSTIMStatus" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkDisputeStatus" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkLastAmendedDate" type="xsd:date" />
<xsd:element name="WorkI123Ids">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="WorkI123Id" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="WorkWriterList">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="WorkWriter" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="WriterName" type="xsd:string" />
<xsd:element name="WriterIPINumber" type="xsd:string" />
<xsd:element name="WriterK12345MechanicalPerc" type="xsd:string" minOccurs="0" />
<xsd:element name="WriterK12345PerformingPerc" type="xsd:string" minOccurs="0" />
<xsd:element name="WriterSocietyCodePerformance" type="xsd:string" minOccurs="0" />
<xsd:element name="WriterSocietyCodeMechanical" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UsageDetails" minOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="UsageTerritory" type="xsd:string" />
<xsd:element name="UsageCommercialModelType" type="xsd:string" />
<xsd:element name="UsageType" type="xsd:string" />
<xsd:element name="UsageDistributionChannelType" type="xsd:string" />
<xsd:element name="UsageCurrency" type="xsd:string" minOccurs="0" />
<xsd:element name="UsageValue" type="xsd:decimal" nillable="true" />
<xsd:element name="UsageQuantity" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MWRUsageList">
<xsd:sequence>
<xsd:element name="Usage" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RecordingDetails" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RecordingTitle" type="xsd:string" />
<xsd:element name="RecordingVersionTitle" type="xsd:string" minOccurs="0" />
<xsd:element name="RecordingDisplayArtist" type="xsd:string" />
<xsd:element name="RecordingISRC" type="xsd:string" minOccurs="0" />
<xsd:element name="RecordingDSPId" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="WorkDetails" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="WorkPrimaryTitle" type="xsd:string" />
<xsd:element name="WorkISWC" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkK12345Id" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkSTIMStatus" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkDisputeStatus" type="xsd:string" minOccurs="0" />
<xsd:element name="WorkLastAmendedDate" type="xsd:date" />
<xsd:element name="WorkI123Ids">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="WorkI123Id" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="WorkWriterList">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="WorkWriter" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="WriterName" type="xsd:string" />
<xsd:element name="WriterIPINumber" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="UsageDetails" minOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="UsageTerritory" type="xsd:string" />
<xsd:element name="UsageCommercialModelType" type="xsd:string" />
<xsd:element name="UsageType" type="xsd:string" />
<xsd:element name="UsageDistributionChannelType" type="xsd:string" />
<xsd:element name="UsageCurrency" type="xsd:string" minOccurs="0" />
<xsd:element name="UsageValue" type="xsd:decimal" nillable="true" />
<xsd:element name="UsageQuantity" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
我正在使用的测试 XML 文件是
<?xml version="1.0" encoding="UTF-8" ?>
<MatchedShareReport>
<FileHeader>
<FileId>FileID123</FileId>
<FileParentId></FileParentId>
<FileSender>FileSender</FileSender>
<FileReceiver>FileReceiver</FileReceiver>
<FileDSPName>FileDSPName</FileDSPName>
<FileDescription>FileDescriptionFileDescription</FileDescription>
<FileGroupId></FileGroupId>
<FileGroupDescription></FileGroupDescription>
<FileTimeStamp>2013-06-28T10:51:37</FileTimeStamp>
</FileHeader>
<UsageDescription>
<FilePeriod>
<StartDate>2013-04-01</StartDate>
<EndDate>2013-04-30</EndDate>
</FilePeriod>
</UsageDescription>
<UsageList>
<Usage>
<WorkDetails>
<WorkPrimaryTitle>WorkPrimaryTitle123</WorkPrimaryTitle>
<WorkISWC>T9053880867</WorkISWC>
<WorkK12345Id></WorkK12345Id>
<WorkSTIMStatus>1</WorkSTIMStatus>
<WorkDisputeStatus>N</WorkDisputeStatus>
<WorkLastAmendedDate>2013-06-28</WorkLastAmendedDate>
<WorkI123Ids>
<WorkI123Id>6192912</WorkI123Id>
<WorkI123Id>6192913</WorkI123Id>
<WorkI123Id>6192914</WorkI123Id>
<WorkI123Id>6192915</WorkI123Id>
<WorkI123Id>6192916</WorkI123Id>
<WorkI123Id>6192917</WorkI123Id>
</WorkI123Ids>
<WorkWriterList>
<WorkWriter>
<WriterName>LNAME, FNAME</WriterName>
<WriterIPINumber>261210876</WriterIPINumber>
<WriterK12345MechanicalPerc>052</WriterK12345MechanicalPerc>
<WriterK12345PerformingPerc>099</WriterK12345PerformingPerc>
<WriterSocietyCodePerformance>0220</WriterSocietyCodePerformance>
<WriterSocietyCodeMechanical>416545</WriterSocietyCodeMechanical>
</WorkWriter>
<WorkWriter>
<WriterName>LNAME, FNAME</WriterName>
<WriterIPINumber>261221610484</WriterIPINumber>
<WriterK12345MechanicalPerc>052</WriterK12345MechanicalPerc>
<WriterK12345PerformingPerc>099</WriterK12345PerformingPerc>
<WriterSocietyCodePerformance>665</WriterSocietyCodePerformance>
<WriterSocietyCodeMechanical>11321</WriterSocietyCodeMechanical>
</WorkWriter>
</WorkWriterList>
</WorkDetails>
<UsageDetails>
<UsageTerritory>GB</UsageTerritory>
<UsageCommercialModelType>Premium</UsageCommercialModelType>
<UsageType>OnDemandStream</UsageType>
<UsageDistributionChannelType>Internet</UsageDistributionChannelType>
<UsageCurrency>GBP</UsageCurrency>
<UsageValue>0.00</UsageValue>
<UsageQuantity>128</UsageQuantity>
</UsageDetails>
</Usage>
</UsageList>
</MatchedShareReport>
如果有人可以提供帮助,我将不胜感激,因为我已经被困了一段时间。谢谢!