我手上只有Visual C#源文件,我要做的就是将它们转换为XSD:s。
C#代码如下所示,还有更多的.cs文件,这只是其中之一。如您在代码中看到的,有很多参考。
namespace Schemas {
using Microsoft.XLANGs.BaseTypes;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.BizTalk.Schema.Compiler", "3.0.1.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[SchemaType(SchemaTypeEnum.Document)]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"Invoice", @"DespatchDocumentReference", @"ReceiptDocumentReference", @"LineItemCountNumeric", @"TaxPointDate", @"AdditionalDocumentReference", @"RequisitionistDocumentReference", @"InitialInvoiceDocumentReference"})]
[Microsoft.XLANGs.BaseTypes.SchemaReference(@"Schemas.common.UBL_CoreComponentParameters_1_0", typeof(global::Schemas.common.UBL_CoreComponentParameters_1_0))]
[Microsoft.XLANGs.BaseTypes.SchemaReference(@"Schemas.common.UBL_CommonBasicComponents_1_0", typeof(global::Schemas.common.UBL_CommonBasicComponents_1_0))]
[Microsoft.XLANGs.BaseTypes.SchemaReference(@"Schemas.common.SFTI_CommonAggregateComponents_1_0", typeof(global::Schemas.common.SFTI_CommonAggregateComponents_1_0))]
[Microsoft.XLANGs.BaseTypes.SchemaReference(@"Schemas.common.UBL_UnspecializedDatatypes_1_0", typeof(global::Schemas.common.UBL_UnspecializedDatatypes_1_0))]
[Microsoft.XLANGs.BaseTypes.SchemaReference(@"Schemas.common.UBL_SpecializedDatatypes_1_0", typeof(global::Schemas.common.UBL_SpecializedDatatypes_1_0))]
[Microsoft.XLANGs.BaseTypes.SchemaReference(@"Schemas.codelist.UBL_CodeList_CurrencyCode_1_0", typeof(global::Schemas.codelist.UBL_CodeList_CurrencyCode_1_0))]
public sealed class SFTI_BasicInvoice_1_0 : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
[System.NonSerializedAttribute()]
private const string _strSchema = @"<?xml version=""1.0"" encoding=""utf-16""?>
<xsd:schema xmlns:sdt=""urn:oasis:names:tc:ubl:SpecializedDatatypes:1:0"" xmlns:cur=""urn:oasis:names:tc:ubl:codelist:CurrencyCode:1:0"" xmlns:udt=""urn:oasis:names:tc:ubl:UnspecializedDatatypes:1:0"" xmlns:b=""http://schemas.microsoft.com/BizTalk/2003"" xmlns=""urn:sfti:documents:BasicInvoice:1:0"" xmlns:cac=""urn:sfti:CommonAggregateComponents:1:0"" xmlns:cbc=""urn:oasis:names:tc:ubl:CommonBasicComponents:1:0"" xmlns:ccts=""urn:oasis:names:tc:ubl:CoreComponentParameters:1:0"" attributeFormDefault=""unqualified"" elementFormDefault=""qualified"" targetNamespace=""urn:sfti:documents:BasicInvoice:1:0"" version=""1:0"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<xsd:import schemaLocation=""Schemas.common.UBL_CoreComponentParameters_1_0"" namespace=""urn:oasis:names:tc:ubl:CoreComponentParameters:1:0"" />
<xsd:import schemaLocation=""Schemas.common.UBL_CommonBasicComponents_1_0"" namespace=""urn:oasis:names:tc:ubl:CommonBasicComponents:1:0"" />
<xsd:import schemaLocation=""Schemas.common.SFTI_CommonAggregateComponents_1_0"" namespace=""urn:sfti:CommonAggregateComponents:1:0"" />
<xsd:import schemaLocation=""Schemas.common.UBL_UnspecializedDatatypes_1_0"" namespace=""urn:oasis:names:tc:ubl:UnspecializedDatatypes:1:0"" />
<xsd:import schemaLocation=""Schemas.common.UBL_SpecializedDatatypes_1_0"" namespace=""urn:oasis:names:tc:ubl:SpecializedDatatypes:1:0"" />
<xsd:import schemaLocation=""Schemas.codelist.UBL_CodeList_CurrencyCode_1_0"" namespace=""urn:oasis:names:tc:ubl:codelist:CurrencyCode:1:0"" />
<xsd:annotation>
<xsd:appinfo>
<references xmlns=""http://schemas.microsoft.com/BizTalk/2003"">
<reference targetNamespace=""urn:sfti:CommonAggregateComponents:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:CommonAggregateComponents:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:LineStatusCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:PaymentMeansCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:CoreComponentTypes:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:CoreComponentParameters:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:ChannelCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:UnspecializedDatatypes:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:AllowanceChargeReasonCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:LongitudeDirectionCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:CountryIdentificationCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:ChipCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:CurrencyCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:DocumentStatusCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:SpecializedDatatypes:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:SubstitutionStatusCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:codelist:LatitudeDirectionCode:1:0"" />
<reference targetNamespace=""urn:oasis:names:tc:ubl:CommonBasicComponents:1:0"" />
</references>
</xsd:appinfo>
</xsd:annotation>
<xsd:element name=""someSFTIInvoiceType"" type=""SFTIInvoiceType"" />
<xsd:complexType name=""SFTIInvoiceType"">
<xsd:sequence>
<xsd:element name=""ID"" type=""cac:SFTISimpleIdentifierType"" />
<xsd:element ref=""cbc:IssueDate"" />
<xsd:element name=""InvoiceTypeCode"" type=""udt:CodeType"" />
<xsd:element minOccurs=""0"" ref=""cbc:Note"" />
<xsd:element minOccurs=""0"" ref=""TaxPointDate"" />
<xsd:element minOccurs=""0"" name=""InvoiceCurrencyCode"" type=""cur:CurrencyCodeType"" />
<xsd:element minOccurs=""0"" name=""TaxCurrencyCode"" type=""cur:CurrencyCodeType"" />
<xsd:element ref=""LineItemCountNumeric"" />
<xsd:element minOccurs=""0"" maxOccurs=""unbounded"" ref=""AdditionalDocumentReference"" />
<xsd:element ref=""cac:BuyerParty"" />
<xsd:element ref=""cac:SellerParty"" />
<xsd:element minOccurs=""0"" ref=""cac:Delivery"" />
<xsd:element minOccurs=""0"" maxOccurs=""3"" ref=""cac:PaymentMeans"" />
<xsd:element minOccurs=""0"" ref=""cac:PaymentTerms"" />
<xsd:element minOccurs=""0"" maxOccurs=""unbounded"" name=""AllowanceCharge"" type=""cac:SFTIAllowanceChargeType"" />
<xsd:element minOccurs=""0"" ref=""cac:ExchangeRate"" />
<xsd:element minOccurs=""0"" maxOccurs=""unbounded"" ref=""cac:TaxTotal"" />
<xsd:element ref=""cac:LegalTotal"" />
<xsd:element maxOccurs=""unbounded"" ref=""cac:InvoiceLine"" />
<xsd:element maxOccurs=""2"" ref=""RequisitionistDocumentReference"" />
<xsd:element minOccurs=""0"" maxOccurs=""unbounded"" ref=""InitialInvoiceDocumentReference"" />
<xsd:element minOccurs=""0"" ref=""cac:DeliveryTerms"" />
<xsd:element minOccurs=""0"" name=""InvoicingPeriod"" type=""cac:SFTIPeriodType"" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name=""Invoice"" type=""SFTIInvoiceType"" />
<xsd:element name=""DespatchDocumentReference"" type=""cac:SFTIDocumentReferenceType"" />
<xsd:element name=""ReceiptDocumentReference"" type=""cac:SFTIDocumentReferenceType"" />
<xsd:element name=""LineItemCountNumeric"" type=""LineItemCountNumericType"" />
<xsd:element name=""TaxPointDate"" type=""TaxPointDateType"" />
<xsd:complexType name=""LineItemCountNumericType"">
<xsd:simpleContent>
<xsd:extension base=""udt:NumericType"" />
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name=""TaxPointDateType"">
<xsd:simpleContent>
<xsd:extension base=""udt:DateType"" />
</xsd:simpleContent>
</xsd:complexType>
<xsd:element name=""AdditionalDocumentReference"" type=""cac:SFTIDocumentReferenceType"" />
<xsd:element name=""RequisitionistDocumentReference"" type=""cac:SFTIDocumentReferenceType"" />
<xsd:element name=""InitialInvoiceDocumentReference"" type=""cac:SFTIDocumentReferenceType"" />
</xsd:schema>";
public SFTI_BasicInvoice_1_0() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [8];
_RootElements[0] = "Invoice";
_RootElements[1] = "DespatchDocumentReference";
_RootElements[2] = "ReceiptDocumentReference";
_RootElements[3] = "LineItemCountNumeric";
_RootElements[4] = "TaxPointDate";
_RootElements[5] = "AdditionalDocumentReference";
_RootElements[6] = "RequisitionistDocumentReference";
_RootElements[7] = "InitialInvoiceDocumentReference";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
[Schema(@"urn:sfti:documents:BasicInvoice:1:0",@"Invoice")]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"Invoice"})]
public sealed class Invoice : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
public Invoice() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [1];
_RootElements[0] = "Invoice";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
}
[Schema(@"urn:sfti:documents:BasicInvoice:1:0",@"DespatchDocumentReference")]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"DespatchDocumentReference"})]
public sealed class DespatchDocumentReference : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
public DespatchDocumentReference() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [1];
_RootElements[0] = "DespatchDocumentReference";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
}
[Schema(@"urn:sfti:documents:BasicInvoice:1:0",@"ReceiptDocumentReference")]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"ReceiptDocumentReference"})]
public sealed class ReceiptDocumentReference : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
public ReceiptDocumentReference() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [1];
_RootElements[0] = "ReceiptDocumentReference";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
}
[Schema(@"urn:sfti:documents:BasicInvoice:1:0",@"LineItemCountNumeric")]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"LineItemCountNumeric"})]
public sealed class LineItemCountNumeric : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
public LineItemCountNumeric() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [1];
_RootElements[0] = "LineItemCountNumeric";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
}
[Schema(@"urn:sfti:documents:BasicInvoice:1:0",@"TaxPointDate")]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"TaxPointDate"})]
public sealed class TaxPointDate : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
public TaxPointDate() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [1];
_RootElements[0] = "TaxPointDate";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
}
[Schema(@"urn:sfti:documents:BasicInvoice:1:0",@"AdditionalDocumentReference")]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"AdditionalDocumentReference"})]
public sealed class AdditionalDocumentReference : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
public AdditionalDocumentReference() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [1];
_RootElements[0] = "AdditionalDocumentReference";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
}
[Schema(@"urn:sfti:documents:BasicInvoice:1:0",@"RequisitionistDocumentReference")]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"RequisitionistDocumentReference"})]
public sealed class RequisitionistDocumentReference : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
public RequisitionistDocumentReference() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [1];
_RootElements[0] = "RequisitionistDocumentReference";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
}
[Schema(@"urn:sfti:documents:BasicInvoice:1:0",@"InitialInvoiceDocumentReference")]
[System.SerializableAttribute()]
[SchemaRoots(new string[] {@"InitialInvoiceDocumentReference"})]
public sealed class InitialInvoiceDocumentReference : Microsoft.XLANGs.BaseTypes.SchemaBase {
[System.NonSerializedAttribute()]
private static object _rawSchema;
public InitialInvoiceDocumentReference() {
}
public override string XmlContent {
get {
return _strSchema;
}
}
public override string[] RootNodes {
get {
string[] _RootElements = new string [1];
_RootElements[0] = "InitialInvoiceDocumentReference";
return _RootElements;
}
}
protected override object RawSchema {
get {
return _rawSchema;
}
set {
_rawSchema = value;
}
}
}
}
}
我测试过的是创建一个新项目并收集项目中的所有.cs文件。生成项目并获取DLL。我尝试使用Visual Studio 2015的开发人员命令提示符调用xsd.exe文件,以使用以下命令将.cs文件转换为xsd。
xsd IFS.Generate.XSD.dll
我还通过以下指南对Visual Studio进行了测试 (“ How to create a XSD schema from a class?”)
但是,所有解决方案都没有用,因为我一直在Visual Studio和CMD中都收到此消息(“警告:由于未找到合适的类型而无法生成模式。”),尽管我已经为每个复杂对象都添加了类型类型。您可以在我提供的.cs代码中看到它。
有人知道是否有免费的在线转换工具吗?我无法在网上找到任何东西,或者别人是否有另一个绝妙的主意。
先谢谢了。