I try to extract data from an XML with multiple subnodes. The first part (the ParentLineItems) works. But I have no Idea how to get the child nodes (TextModules of the ParentLineItems and ChildLineItems that have again TextModules).
The database version is 11.2.
CREATE TABLE d
(
thexml XMLTYPE
);
DECLARE
x XMLTYPE
:= xmltype (
'<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.test.com/2016/04/quots/types">
<s:Body>
<GetLatestPricesAndTextsForOutdatedLineItemsResponse xmlns="http://www.test.com/2016/04/quots/webcrmintegrationservice">
<GetLatestPricesAndTextsForOutdatedLineItemsResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:Acknowledge>Success</a:Acknowledge>
<a:Message/>
<a:WebCrmLineItemPricesAndTexts>
<a:WebCrmLineItemPricesAndTextsItem>
<a:ParentLineItem>
<a:WebCrmLineItemNumber>12312321321</a:WebCrmLineItemNumber>
<a:QuotsLineItemNumber>{7213C65A-2DAD-423F-8F57-55A51CCA0734}</a:QuotsLineItemNumber>
<a:SalesPrice>2</a:SalesPrice>
<a:CostPrice>1</a:CostPrice>
<a:TextModules>
<a:TextModule>
<a:LanguageCode>EN</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
<a:TextModule>
<a:LanguageCode>DE</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
</a:TextModules>
</a:ParentLineItem>
<a:ChildLineItems>
<a:LineItemPricesAndTexts>
<a:WebCrmLineItemNumber/>
<a:QuotsLineItemNumber>{101DA7DF-BF51-4E29-B592-2BA4249E77D5}</a:QuotsLineItemNumber>
<a:SalesPrice>2212</a:SalesPrice>
<a:CostPrice>112</a:CostPrice>
<a:TextModules>
<a:TextModule>
<a:LanguageCode>EN</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
<a:TextModule>
<a:LanguageCode>DE</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
</a:TextModules>
</a:LineItemPricesAndTexts>
<a:LineItemPricesAndTexts>
<a:WebCrmLineItemNumber/>
<a:QuotsLineItemNumber>{366C5519-C3E2-42C5-AA54-28CA8BD4C139}</a:QuotsLineItemNumber>
<a:SalesPrice>2222</a:SalesPrice>
<a:CostPrice>112</a:CostPrice>
<a:TextModules>
<a:TextModule>
<a:LanguageCode>EN</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
<a:TextModule>
<a:LanguageCode>DE</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
</a:TextModules>
</a:LineItemPricesAndTexts>
</a:ChildLineItems>
</a:WebCrmLineItemPricesAndTextsItem>
<a:WebCrmLineItemPricesAndTextsItem>
<a:ParentLineItem>
<a:WebCrmLineItemNumber>22322323212</a:WebCrmLineItemNumber>
<a:QuotsLineItemNumber>{EC3FF93B-C1AA-47D1-AF56-B55F50C7AE02}</a:QuotsLineItemNumber>
<a:SalesPrice>22</a:SalesPrice>
<a:CostPrice>100</a:CostPrice>
<a:TextModules>
<a:TextModule>
<a:LanguageCode>EN</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
<a:TextModule>
<a:LanguageCode>DE</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
</a:TextModules>
</a:ParentLineItem>
<a:ChildLineItems>
<a:LineItemPricesAndTexts>
<a:WebCrmLineItemNumber/>
<a:QuotsLineItemNumber>{91EC9915-C277-498A-A7B3-0D085174C458}</a:QuotsLineItemNumber>
<a:SalesPrice>22222</a:SalesPrice>
<a:CostPrice>1111</a:CostPrice>
<a:TextModules>
<a:TextModule>
<a:LanguageCode>EN</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
<a:TextModule>
<a:LanguageCode>DE</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
</a:TextModules>
</a:LineItemPricesAndTexts>
<a:LineItemPricesAndTexts>
<a:WebCrmLineItemNumber/>
<a:QuotsLineItemNumber>{FFD1B32B-03FA-42D8-9FB8-9F708137CE5A}</a:QuotsLineItemNumber>
<a:SalesPrice>12222</a:SalesPrice>
<a:CostPrice>1123</a:CostPrice>
<a:TextModules>
<a:TextModule>
<a:LanguageCode>EN</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
<a:TextModule>
<a:LanguageCode>DE</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
</a:TextModules>
</a:LineItemPricesAndTexts>
<a:LineItemPricesAndTexts>
<a:WebCrmLineItemNumber/>
<a:QuotsLineItemNumber>{7E05459D-F9FE-4258-8D1B-EC242476EB74}</a:QuotsLineItemNumber>
<a:SalesPrice>555555</a:SalesPrice>
<a:CostPrice>555</a:CostPrice>
<a:TextModules>
<a:TextModule>
<a:LanguageCode>EN</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
<a:TextModule>
<a:LanguageCode>DE</a:LanguageCode>
<a:ShortText>S</a:ShortText>
<a:LongText>L</a:LongText>
</a:TextModule>
</a:TextModules>
</a:LineItemPricesAndTexts>
</a:ChildLineItems>
</a:WebCrmLineItemPricesAndTextsItem>
</a:WebCrmLineItemPricesAndTexts>
</GetLatestPricesAndTextsForOutdatedLineItemsResult>
</GetLatestPricesAndTextsForOutdatedLineItemsResponse>
</s:Body>
</s:Envelope>' );
BEGIN
INSERT INTO d
VALUES (x);
END;
/
SELECT COUNT (*)
FROM d;