2014-01-22 3 views
0

Я получил эту XSD (упрощенный):Недопустимый xml. «Недопустимый контент был обнаружен Начиная с Элементом»

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns:ns0="https://MDR.Employees.Schemas.MDREmployeePropertySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1" elementFormDefault="qualified" targetNamespace="http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:annotation> 
    <xs:appinfo> 
     <b:imports xmlns:b="http://schemas.microsoft.com/BizTalk/2003"> 
     <b:namespace prefix="ns0" uri="https://MDR.Employees.Schemas.MDREmployeePropertySchema" location=".\mdremployeepropertyschema.xsd" /> 
     </b:imports> 
    </xs:appinfo> 
    </xs:annotation> 
    <xs:element name="Employees"> 
    <xs:annotation> 
     <xs:appinfo> 
     <b:properties> 
      <b:property name="ns0:HeromaRefId" xpath="/*[local-name()='Employees' and namespace-uri()='http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1']/*[local-name()='Employee' and namespace-uri()='http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1']/*[local-name()='ID' and namespace-uri()='http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1']" /> 
     </b:properties> 
     </xs:appinfo> 
    </xs:annotation> 
    <xs:complexType> 
     <xs:sequence> 
     <xs:element name="Employee"> 
     </xs:element> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema> 

И этот XML пример (упрощенный), который является форматом, который клиент будет посылать мне:

<?xml version="1.0" encoding="utf-16"?> 
<ns0:Employees xmlns:ns0="http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <Employee> 

    </Employee> 
</ns0:Employees> 

xml не проверяет XSD. Что я могу изменить в XSD, чтобы проверить xml?

ответ

1

Используйте XSD следующий XSD ..XML будет проверен на этом XSD

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns:ns0="https://MDR.Employees.Schemas.MDREmployeePropertySchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1" elementFormDefault="unqualified" targetNamespace="http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:annotation> 
    <xs:appinfo> 
     <b:imports xmlns:b="http://schemas.microsoft.com/BizTalk/2003"> 
     <b:namespace prefix="ns0" uri="https://MDR.Employees.Schemas.MDREmployeePropertySchema" location=".\mdremployeepropertyschema.xsd" /> 
     </b:imports> 
    </xs:appinfo> 
    </xs:annotation> 
    <xs:element name="Employees"> 
    <xs:annotation> 
     <xs:appinfo> 
     <b:properties> 
      <b:property name="ns0:HeromaRefId" xpath="/*[local-name()='Employees' and namespace-uri()='http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1']/*[local-name()='Employee' and namespace-uri()='http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1']/*[local-name()='ID' and namespace-uri()='http://schemas.customer.com/MdrEntitymodel/EmployeeExternalV1']" /> 
     </b:properties> 
     </xs:appinfo> 
    </xs:annotation> 
    <xs:complexType> 
     <xs:sequence> 
     <xs:element name="Employee"> 
     </xs:element> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema> 

Просто измените elementFormDefault = "квалифицированный" в elementFormDefault = "неквалифицированный". Это будет работать.

Смежные вопросы