promoting "type" attribute from XMLSchema-instance as a property f
- From: asanford <asanford2000_at_hotmail.com@xxxxxxxxxxxxxxxxx>
- Date: Thu, 13 Apr 2006 13:13:03 -0700
In Biztalk 2006, I have a message schema which defines two complex types, one
derived from the other. The schema defines one element of the base complex
type. Here is that schema:
--------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="poly"
targetNamespace="http://BiztalkTest1.PolyEvents"
elementFormDefault="qualified"
xmlns="http://BiztalkTest1.PolyEvents"
xmlns:mstns="http://BiztalkTest1.PolyEvents"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="EventBase">
<xs:sequence>
<xs:element name="Description" type="xs:string"/>
<xs:element name="EventTime" type="xs:dateTime"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LocatedEvent">
<xs:complexContent>
<xs:extension base="EventBase">
<xs:sequence>
<xs:element name="LocationID" type="xs:integer"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="TheEvent" type="EventBase" />
</xs:schema>
--------------------------------------------------
I can create XML instance documents that contain either one element of the
base complex type, as follows:
------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<ns0:TheEvent xmlns:ns0="http://BiztalkTest1.PolyEvents">
<ns0:Description>poly base event 1</ns0:Description>
<ns0:EventTime>1999-05-31T13:20:00.000-05:00</ns0:EventTime>
</ns0:TheEvent>
------------------------------------------------------
or a can utilize http://www.w3.org/2001/XMLSchema-instance's "type"
attribute to create an XML instance document that contains one element of the
derived complex type, as follows:
------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<ns0:TheEvent xmlns:ns0="http://BiztalkTest1.PolyEvents"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="ns0:LocatedEvent">
<ns0:Description>poly located event 1</ns0:Description>
<ns0:EventTime>1999-05-31T13:20:00.000-05:00</ns0:EventTime>
<ns0:LocationID>123</ns0:LocationID>
</ns0:TheEvent>
------------------------------------------------------
In some cases, I want to be able to configure an orchestration's receive
shape to only activate the orchestration if the type is the derived complex
type ("LocatedEvent" type.) I think the only way I can do this is to promote
the schema-instance "type" attribute as a property field. I tried to do this
by creating a property field (called "ns0:MyEventType") and then hand-editing
the XPath to be the following:
----------------------------------------------------------------
/*[local-name()='TheEvent' and
namespace-uri()='http://BiztalkTest1.PolyEvents']/@*[local-name()='type' and
namespace-uri()='http://www.w3.org/2001/XMLSchema-instance']
---------------------------------------------------------------
This results in the editor dialog to return an error "Some promoted
properties may be invalid. Do you wish to continue? The following promoted
properties may contain invalid XPaths: ns0:MyEventType". I don't understand
why this doesn't work, because this XPath works fine in a c# winforms test
app I wrote (using XmlDocument.SelectNodes().) Any ideas? I'm sure I could
add extra attributes to my schema that I then restrict to fixed values in the
derived types, but that seems to duplicate XMLSchema-instance functionality.
I know I could create different message types for each complex type I want to
receive, and then use the std. message type routing, but in many cases I have
orchestrations that will want to receive many different message types, and it
seems cumbersome and a maintenance headache to keep adding different port
operations and receive shapes for each message type.
Any ideas? Thanks!
.
- Follow-Ups:
- RE: promoting "type" attribute from XMLSchema-instance as a property f
- From: "WenJun Zhang[msft]"
- RE: promoting "type" attribute from XMLSchema-instance as a property f
- Prev by Date: Re: BAS - Could not load type 'Microsoft.BizTalk.KwTpm.Global'
- Next by Date: RE: BizTalk Accelerator For SWIFT
- Previous by thread: Re: WSE 3.0 Adapter for Biztalk 2006?
- Next by thread: RE: promoting "type" attribute from XMLSchema-instance as a property f
- Index(es):
Relevant Pages
|