2012-03-26 66 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