我有一個(有點)緊急這裏的問題:(XML到XSD的轉換
我有翻譯的XSD文件的XML。當我試圖導入/使用SUP XSD文件,我收到一個「執行錯誤」:
"Cannot resolve namespace URI for qualified name: sap:label"
兩個,其中automaticaly創建(由SAP的XML和http://www.freeformatter.com/的XSD),所以我還挺需要一些指導,XML和XSD:d
這裏是XML:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
xmlns:gp="http://www.sap.com/Protocols/SAPData/GenericPlayer"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sap="http://www.sap.com/Protocols/SAPData">
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema Namespace="Z_SERVICE_BANK_V3"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Bank" sap:content-version="1">
<Key>
<PropertyRef Name="bankCountry"/>
<PropertyRef Name="bankID"/>
</Key>
<Property Name="bankCountry" Type="Edm.String" Nullable="false" MaxLength="3" sap:label="Bank Country" sap:filterable="false"/>
<Property Name="bankID" Type="Edm.String" Nullable="false" MaxLength="15" sap:label="Bank Key" sap:filterable="false"/>
<Property Name="bankName" Type="Edm.String" MaxLength="60" sap:label="Bank name" sap:filterable="false"/>
<Property Name="region" Type="Edm.String" MaxLength="3" sap:label="Region" sap:filterable="false"/>
<Property Name="street" Type="Edm.String" MaxLength="35" sap:label="Street" sap:filterable="false"/>
<Property Name="city" Type="Edm.String" MaxLength="35" sap:label="City" sap:filterable="false"/>
</EntityType>
<EntityContainer Name="Z_SERVICE_BANK_V3" m:IsDefaultEntityContainer="true">
<EntitySet Name="BankCollection" EntityType="Z_SERVICE_BANK_V3.Bank" sap:content-version="1"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
這裏是XSD:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/ado/2008/09/edm">
<xs:element name="Schema">
<xs:complexType>
<xs:sequence>
<xs:element name="EntityType">
<xs:complexType>
<xs:sequence>
<xs:element name="Key">
<xs:complexType>
<xs:sequence>
<xs:element name="PropertyRef" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="Name" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Property" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="Name" use="optional"/>
<xs:attribute type="xs:string" name="Type" use="optional"/>
<xs:attribute type="xs:string" name="Nullable" use="optional"/>
<xs:attribute type="xs:byte" name="MaxLength" use="optional"/>
<xs:attribute xmlns:sap="http://www.sap.com/Protocols/SAPData" ref="sap:label"/>
<xs:attribute xmlns:sap="http://www.sap.com/Protocols/SAPData" ref="sap:filterable"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="Name"/>
<xs:attribute xmlns:sap="http://www.sap.com/Protocols/SAPData" ref="sap:content-version"/>
</xs:complexType>
</xs:element>
<xs:element name="EntityContainer">
<xs:complexType>
<xs:sequence>
<xs:element name="EntitySet">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="Name"/>
<xs:attribute type="xs:string" name="EntityType"/>
<xs:attribute xmlns:sap="http://www.sap.com/Protocols/SAPData" ref="sap:content-version"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="Name"/>
<xs:attribute xmlns:met="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" ref="met:IsDefaultEntityContainer"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="Namespace"/>
</xs:complexType>
</xs:element>
</xs:schema>
任何想法?
非常感謝你:)
我用同一個網站http://www.freeformatter.com/來「驗證」這兩個文件。我收到同樣的錯誤,但我不明白:D Src-resolve.4.2:解決組件'sap:label'錯誤。它被檢測到'sap:label'Is In Namespace'http://www.sap.com/Protocols/SAPData',但是來自該命名空間的組件不能從架構文檔'null'引用。如果這是不正確的命名空間,可能是'sap:label'的前綴需要更改。如果這是正確的命名空間,那麼適當的'import'標籤應該被添加爲'null'。 – user2595314