如何从其他程序集/模式引用MSH_25_GLO_DEF模式

时间:2013-03-13 23:23:57

标签: biztalk biztalk-2010 btahl7 biztalk-schemas

我使用BTAHL7V2X架构(MSH_25_GLO_DEF等)构建了一个程序集。

在另一个程序集中,我需要创建一个模式,其中一个元素的类型为MSH_25_GLO_DEF。

在我的BTAHL7V2XCommon程序集中,我有:

<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://microsoft.com/HealthCare/HL7/2X" targetNamespace="http://microsoft.com/HealthCare/HL7/2X" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo root_reference="MSH_25_GLO_DEF" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="MSH_25_GLO_DEF">
  ...

在我的其他程序集中,我有一个看起来像这样的架构:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://mycompany.com/Custom/HL7/2X" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://microsoft.com/HealthCare/HL7/2X" targetNamespace="http://mycompany.com/Custom/HL7/2X" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import schemaLocation="BTAHL7Schemas.MSH_25_GLO_DEF" namespace="http://mycompany.com/Custom/HL7/2X"/>
  <xs:include schemaLocation="ORU_R01_23_GLO_DEF.xsd" />
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo standards_version="HL7.DBVersion.1_5" document_type="HL7 2X Schema" version="2.0.0104.0.2.0" root_reference="ORU_R01_23_GLO_DEF" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
      <b:references>
        <b:reference targetNamespace="http://mycompany.com/Custom/HL7/2X/2.3/ORU/DataTypes" />
        <b:reference targetNamespace="http://microsoft.com/HealthCare/HL7/2X" />
        <b:reference targetNamespace="http://mycompany.com/Custom/HL7/2X/2.3/ORU/Segments" />
        <b:reference targetNamespace="http://mycompany.com/Custom/HL7/2X/2.3/ORU/Tables" />
      </b:references>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="ORU_R01_23_ALL">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="1" name="MSH_25_GLO_DEF" type="ns0:MSH_25_GLO_DEF" />
        <xs:element minOccurs="1" maxOccurs="1" ref="ORU_R01_23_GLO_DEF" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

我添加了对包含MSH标头的BTAHL7V2X程序集的引用,如果我在对象浏览器中查看引用的程序集,我可以看到MSH_25_GLO_DEF但是我总是收到一条错误,指出“http://microsoft.com/HealthCare/HL7/2X:MSH_25_GLO_DEF不是当我查看我的架构时声明了。

我也尝试将导入引用更改为include:

<xs:include schemaLocation="BTAHL7Schemas.MSH_25_GLO_DEF" /> 

但在查看架构时遇到不同的错误:

The targetNamespace 'http://microsoft.com/HealthCare/HL7/2X' of included/redefined schema should be the same as the targetNamespace 'http://mycompany.com/Custom/HL7/2X' of the including schema. 

是否有正确的方法在另一个程序集中引用BizTalk架构?

1 个答案:

答案 0 :(得分:0)

检查一下: http://social.msdn.microsoft.com/Forums/en-US/biztalkgeneral/thread/d40d2c15-5c91-45c9-877d-2559802d1b1e

希望有所帮助

<xs:schema ... targetNamespace="http://mycompany.com/Custom/HL7/2X">
        <xs:import schemaLocation="BTAHL7Schemas.MSH_25_GLO_DEF" namespace="http://microsoft.com/HealthCare/HL7/2X"/>
    <b:schemaInfo ... root_reference="ORU_R01_23_ALL" ... />