На входе есть XML (указан в примере), который имеет узел <Type xsi:type="MyParameterType" MinLength="0" MaxLength="0" xmlns="
http://zzz.com/MyNamespace" />. Как добраться до его свойств в функции OPENXML?
DECLARE @DocHandle int
DECLARE @XmlDocument nvarchar(1000)
SET @XmlDocument = N'<ROOT>
<Customer CustomerID="VINET" ContactName="Paul Henriot">
<Order OrderID="10248" CustomerID="VINET" EmployeeID="5"
OrderDate="1996-07-04T00:00:00">
<OrderDetail ProductID="11" Quantity="12"/>
<OrderDetail ProductID="42" Quantity="10"/>
</Order>
<Type xsi:type="MyParameterType" MinLength="0" MaxLength="0" xmlns="
http://zzz.com/MyNamespace" />
</Customer>
<Customer CustomerID="LILAS" ContactName="Carlos Gonzlez">
<Order OrderID="10283" CustomerID="LILAS" EmployeeID="3"
OrderDate="1996-08-16T00:00:00">
<OrderDetail ProductID="72" Quantity="3"/>
</Order>
<Type xsi:type="MyParameterType" MinLength="0" MaxLength="0" xmlns="
http://zzz.com/MyNamespace" />
</Customer>
</ROOT>'
-- Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument,
???? '<ns xmlns:mpt="
urn:http://zzz.com/MyNamespace"/>'
SELECT * FROM OPENXML (@DocHandle, '/ROOT/Customer/......????', 3)
WITH
(
CustomerId varchar(10) '@CustomerID'
???? Получить доступ к свойствам <Type xsi:type="MyParameterType" MinLength="0" MaxLength="0" xmlns="
http://zzz.com/MyNamespace" />
)
EXEC sp_xml_removedocument @DocHandle
Здравствуйте, dinosaurx, Вы писали:
D>На входе есть XML (указан в примере), который имеет узел <Type xsi:type="MyParameterType" MinLength="0" MaxLength="0" xmlns="http://zzz.com/MyNamespace" />. Как добраться до его свойств в функции OPENXML?
D>DECLARE @DocHandle int
D>DECLARE @XmlDocument nvarchar(1000)
D>SET @XmlDocument = N'<ROOT>
D><Customer CustomerID="VINET" ContactName="Paul Henriot">
D> <Order OrderID="10248" CustomerID="VINET" EmployeeID="5"
D> OrderDate="1996-07-04T00:00:00">
D> <OrderDetail ProductID="11" Quantity="12"/>
D> <OrderDetail ProductID="42" Quantity="10"/>
D> </Order>
D> <Type xsi:type="MyParameterType" MinLength="0" MaxLength="0" xmlns="http://zzz.com/MyNamespace" />
D></Customer>
D><Customer CustomerID="LILAS" ContactName="Carlos Gonzlez">
D> <Order OrderID="10283" CustomerID="LILAS" EmployeeID="3"
D> OrderDate="1996-08-16T00:00:00">
D> <OrderDetail ProductID="72" Quantity="3"/>
D> </Order>
D> <Type xsi:type="MyParameterType" MinLength="0" MaxLength="0" xmlns="http://zzz.com/MyNamespace" />
D></Customer>
D></ROOT>'
D>-- Create an internal representation of the XML document.
D>EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument,
D>???? '<ns xmlns:mpt="urn:http://zzz.com/MyNamespace"/>'
D>SELECT * FROM OPENXML (@DocHandle, '/ROOT/Customer/......????', 3)
D> WITH
D> (
D> CustomerId varchar(10) '@CustomerID'
D> ???? Получить доступ к свойствам <Type xsi:type="MyParameterType" MinLength="0" MaxLength="0" xmlns="http://zzz.com/MyNamespace" />
D> )
D>EXEC sp_xml_removedocument @DocHandle
Вопрос снят ответ нашёл здесь
http://www.sql.ru/forum/646095/sp-xml-preparedocument-ne-ponimaet-moih-namespace-ov