Здравствуйте!
Помогите разобраться с XML.
есть следующий шаблон XML - описание Exchange WSDL
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Body>
<CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
SendMeetingInvitations="SendToAllAndSaveCopy" >
<SavedItemFolderId>
<t:DistinguishedFolderId Id="calendar"/>
</SavedItemFolderId>
<Items>
<t:CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<Subject>
</Subject>
<Body BodyType="Text">Plan the agenda for next weeks meeting.</Body>
<ReminderIsSet>true</ReminderIsSet>
<ReminderMinutesBeforeStart>60</ReminderMinutesBeforeStart>
<Start>2013-01-22T16:00:00</Start>
<End>2013-01-22T17:00:00</End>
<IsAllDayEvent>false</IsAllDayEvent>
<LegacyFreeBusyStatus>Busy</LegacyFreeBusyStatus>
<RequiredAttendees>
<Attendee>
<Mailbox>
<EmailAddress></EmailAddress>
</Mailbox>
</Attendee>
</RequiredAttendees>
</t:CalendarItem >
</Items>
</CreateItem>
</soap:Body>
</soap:Envelope>'
есть необходимоть добавлять в него динамически в элементы, например задать <Subject>
Проблема в том, что сложные namespace в XML мне пока не позволяют правильно определить описание .modify
DECLARE @XML XML
SET @XML='<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Body>
<CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
SendMeetingInvitations="SendToAllAndSaveCopy" >
<SavedItemFolderId>
<t:DistinguishedFolderId Id="calendar"/>
</SavedItemFolderId>
<Items>
<t:CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
<Subject>
</Subject>
<Body BodyType="Text">Plan the agenda for next weeks meeting.</Body>
<ReminderIsSet>true</ReminderIsSet>
<ReminderMinutesBeforeStart>60</ReminderMinutesBeforeStart>
<Start>2013-01-22T16:00:00</Start>
<End>2013-01-22T17:00:00</End>
<IsAllDayEvent>false</IsAllDayEvent>
<LegacyFreeBusyStatus>Busy</LegacyFreeBusyStatus>
<RequiredAttendees>
<Attendee>
<Mailbox>
<EmailAddress>roman.burdiuzha@life.com.ua</EmailAddress>
</Mailbox>
</Attendee>
</RequiredAttendees>
</t:CalendarItem >
--</Items>
</CreateItem>
</soap:Body>
</soap:Envelope>'
SELECT @XML
SET @XML.modify('
declare namespace soap="http://schemas.xmlsoap.org/soap/envelope/";
declare namespace t="http://schemas.microsoft.com/exchange/services/2006/types";
declare namespace xsd="http://www.w3.org/2001/XMLSchema";
declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance";
insert <Subject>Objectives for the probation period</Subject>
as first into (/soap:Envelope/soap:Body/t:CreateItem/Items/CalendarItem)[1]')
SELECT @XML
К сожалению, не отрабатывает.
Т.к. есть дополнительные определения namespace в :
<CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
SendMeetingInvitations="SendToAllAndSaveCopy" >
и
<t:CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
Подскажите, как правильно определить дополнительные пространства имен в операторе .modify ?
Спасибо.