2012-03-26 46 views
2

嗨我有一個XSD文件,解釋我必須使用的必填字段。如何在C#.Net中使用XSD文件構建XML

使用該XSD模式,我必須建立和XML請求並路由到第三方服務提供者,一旦我的XML請求被驗證,系統(第三方)將返回一個響應,並且我必須再次讀取該XML迴應並執行其餘的邏輯實現。

我不知道哪裏使用該XSD

任何一個可以點我到正確的地方,或者提供某種形式的例子,我可以使用使用來構建XML XSD

這裏開始構建XML是使用<xs:element name="RxHistoryRequest"> 我要建立使用XML 0和

我的XSD

<?xml version="1.0" encoding="utf-8"?> 
    <xs:schema xmlns="http://www.ncpdp.org/schema/SCRIPT" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.ncpdp.org/schema/SCRIPT" elementFormDefault="qualified"> 
     <!-- Message --> 
     <xs:element name="Message" type="MessageType"/> 
<xs:element name="RxHistoryRequest"> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:annotation> 
        <xs:documentation>UIH-020</xs:documentation> 
        <xs:documentation>UIH-030-1</xs:documentation> 
        <xs:documentation>PVD-P2</xs:documentation> 
       </xs:annotation> 
       <xs:element ref="RxReferenceNumber" minOccurs="0"/> 
       <!--UIH.2.1--> 
       <xs:element ref="PrescriberOrderNumber" minOccurs="0"/> 
       <!--UIH.3.1--> 
       <xs:element name="Pharmacy" type="OptionalPharmacyType" minOccurs="0"> 
        <xs:annotation> 
         <xs:documentation>PVD-P2</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--PVD--> 
       <xs:element name="Prescriber" type="OptionalPrescriberType"> 
        <xs:annotation> 
         <xs:documentation>PVD-PC</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--PVD--> 
       <xs:element name="Patient" type="HistoryRequestPatientType"> 
        <xs:annotation> 
         <xs:documentation>PTT</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--PTT--> 
       <xs:element name="BenefitsCoordination" type="BenefitsCoordinationRequestType" maxOccurs="3"> 
        <xs:annotation> 
         <xs:documentation>COO</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--COO--> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
    <xs:element name="RxHistoryResponse"> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:annotation> 
        <xs:documentation>UIH-020</xs:documentation> 
        <xs:documentation>UIH-030-1</xs:documentation> 
        <xs:documentation>PVD-P2</xs:documentation> 
       </xs:annotation> 
       <xs:element ref="RxReferenceNumber" minOccurs="0"/> 
       <!--UIH.2.1--> 
       <xs:element ref="PrescriberOrderNumber" minOccurs="0"/> 
       <!--UIH.3.1--> 
       <xs:element name="Response" type="HistoryResponseType"> 
        <xs:annotation> 
         <xs:documentation>RES</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--RES--> 
       <xs:element name="Pharmacy" type="OptionalPharmacyType" minOccurs="0"> 
        <xs:annotation> 
         <xs:documentation>PVD-P2</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--PVD--> 
       <xs:element name="Prescriber" type="HistoryPrescriberType"> 
        <xs:annotation> 
         <xs:documentation>PVD-PC</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--PVD--> 
       <xs:element name="Patient" type="HistoryResponsePatientType"> 
        <xs:annotation> 
         <xs:documentation>PTT</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--PTT--> 
       <xs:element name="BenefitsCoordination" type="BenefitsCoordinationResponseType" maxOccurs="3"> 
        <xs:annotation> 
         <xs:documentation>COO</xs:documentation> 
        </xs:annotation> 
       </xs:element> 
       <!--COO--> 
       <xs:choice minOccurs="0"> 
        <xs:element name="MedicationDispensed" type="HistoryDispensedMedicationType" maxOccurs="300"> 
         <xs:annotation> 
          <xs:documentation>DRU-D</xs:documentation> 
         </xs:annotation> 
        </xs:element> 
        <!--DRU--> 
        <xs:element name="MedicationPrescribed" type="HistoryPrescribedMedicationType" maxOccurs="300"> 
         <xs:annotation> 
          <xs:documentation>DRU-P</xs:documentation> 
         </xs:annotation> 
        </xs:element> 
        <!--DRU--> 
       </xs:choice> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
. 
. 
. 
. 
.. 
. 
continues 

的一部分 我必須閱讀回覆

謝謝你的時間幫助我。

回答

0

您可以使用可以從該xsd中提取樣本xml的程序。例如 Stylus Studio

如果你給我的XSD我可以做一個樣本XML爲你

+0

這應該動態地對網絡上最多每個用戶請求發生,我必須建立與特定的用戶值的新XML請求和發送請求 – HaBo 2012-03-26 21:47:17