Multiple for loops implementation in XQuery - xquery

Below is my sample XML
<catalog>
<book>
<author>Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
<storeno>123</storeno>
</book>
<book>
<author>Ralls, Kim</author>
<title>Rain Fantasy</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former</description>
<storeno>123</storeno>
</book>
<book>
<author>zxcv</author>
<title>Maeve</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology</description>
<storeno>123</storeno>
</book>
<book>
<author>zxcv</author>
<title>Legacy</title>
<genre>Fiction</genre>
<price>5.95</price>
<publish_date>2001-03-10</publish_date>
<description>In post-apocalypse</description>
<storeno>123</storeno>
</book>
<book>
<author>Corets, Eva</author>
<title>The</title>
<genre>Fiction</genre>
<price>5.95</price>
<publish_date>2001-09-10</publish_date>
<description>The two daughters</description>
<storeno>123</storeno>
</book>
<book>
<author>Horror</author>
<title>Horror</title>
<genre>Horror</genre>
<price>4.95</price>
<publish_date>2000-09-02</publish_date>
<description>When abc meets xyz</description>
<storeno>123</storeno>
</book>
<book>
<author>Knorr, Stefan</author>
<title>Creepy Crawlies</title>
<genre>Horror</genre>
<price>4.95</price>
<publish_date>2000-12-06</publish_date>
<description>An anthology of horror stories about roaches,
centipedes, scorpions and other insects.</description>
<storeno>123</storeno>
</book>
<book>
<author>O'Brien, Tim</author>
<title>kids ganes</title>
<genre>story</genre>
<price>36.95</price>
<publish_date>2000-12-09</publish_date>
<description>Microsoft's .NET initiative is explored in
detail in this deep programmer's reference.</description>
<storeno>123</storeno>
</book>
<book>
<author>O'Brien, Tim</author>
<title>MSXML3: A Comprehensive Guide</title>
<genre>computer</genre>
<price>36.95</price>
<publish_date>2000-12-01</publish_date>
<description>The abc</description>
<storeno>123</storeno>
</book>
<book>
<author>Galos, Mike</author>
<title>Visual Studio 7: A Comprehensive Guide</title>
<genre>story</genre>
<price>49.95</price>
<publish_date>2001-04-16</publish_date>
<description>Microsoft Visual Studio</description>
<storeno>123</storeno>
</book>
</catalog>
and I need an XQuery that returns
<titles>
need the first instance of the title where the genre is “Fantasy”
need all the titles concatenated where the genre is “Computer”
need all the titles concatenated where the genre is “Fiction”
need the first instance of the title where the genre is “Story”
</ titles >
example:( Rain Fantasy, XML Developer's Guide………………, Legacy……………….., kids ganes)
Note: the case can be ignored in the above for comparison.
Here is what we are trying
<Titles>
let $fan := $catalog /book[genre = ‘Fantasy’][1]/title
let $stry := $catalog /book[genre = ‘Story’][1]/title
for $comp in $catalog /book[genre ='Computer']/title
return concat($comp, “”)
for $fict in $catalog /book[genre ='Fiction']/title
return concat($fict, “”)
concat($fan, $comp, $fict, $stry)
</Titles>
we are facing issues in multiple for loops implementation.
Any help is really appreciated.
Thanks in advance

From the question and the comments you seem to want something like this:
<Titles>
{
for $genre in distinct-values($catalog/book/genre)
let $books := $catalog/book[genre=$genre]
let $retval := if($genre=("Fantasy","Story")) then $books[1]/title else $books/title
return data($retval)
}
</Titles>
With your input, the result this gives is:
<Titles>XML Developer's Guide Rain Fantasy Legacy The Horror Creepy Crawlies kids ganes Visual Studio 7: A Comprehensive Guide MSXML3: A Comprehensive Guide</Titles>
My gut tells me you probably don't want the data() part though. Without it you get:
<Titles>
<title>XML Developer's Guide</title>
<title>Rain Fantasy</title>
<title>Legacy</title>
<title>The</title>
<title>Horror</title>
<title>Creepy Crawlies</title>
<title>kids ganes</title>
<title>Visual Studio 7: A Comprehensive Guide</title>
<title>MSXML3: A Comprehensive Guide</title>
</Titles>

Related

Remove or filter XML nodes by Xpaths from file in R

I have very very large complex xml files (look like this https://github.com/HL7/C-CDA-Examples/blob/master/General/Parent%20Document%20Replace%20Relationship/CCD%20Parent%20Document%20Replace%20(C-CDAR2.1).xml ) to process but only need attributes and values at particular XPaths (nodes). By removing unneeded nodes, processing time may be cut, filtering out fluff before detailed processing.
So far I have tried using: xml_remove
xmlfile <- paste0(dir,"xmlFiles/",filelist[k])
file<-read_xml(xmlfile)
file<-xml_ns_strip(file)
for(counx in 1:nrow(xpathTable)){
xr <- xml_find_all(file, xpath =paste0('/',toString(xpathTable$xpaths[counx])) )
xml_remove(xr, free = TRUE)
file<-file
}
This works well for removing few nodes but crashes as the numbers go up (>100)
Below show a kind of example of what I want to get too
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
<ISBN>
<Random>12354</Random>
</ISBN>
</book>
<book category="web">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
<book category="web">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<ISBN>
<Random>12345</Random>
</ISBN>
<price>39.95</price>
</book>
</bookstore>
Filter by XPaths
/bookstore/book/title
/bookstore/book/year
/bookstore/book/ISBN/Random
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<year>2005</year>
</book>
<book category="children">
<title lang="en">Harry Potter</title>
<year>2005</year>
<ISBN>
<Random>12354</Random>
</ISBN>
</book>
<book category="web">
<title lang="en">XQuery Kick Start</title>
<year>2003</year>
</book>
<book category="web">
<title lang="en">Learning XML</title>
<year>2003</year>
<ISBN>
<Random>12345</Random>
</ISBN>
</book>
</bookstore>
Looks like an XQuery job, e.g. you could recreate your document like this
<bookstore>{
for $book in /bookstore/*
return <book category="{$book/#category}">
{$book/title}
{$book/year}
{$book/ISBN}
</book>
}</bookstore>
Using the book example to get the result below it. You can test this online here using XQuery as an option https://www.videlibri.de/cgi-bin/xidelcgi
There might be ways to run XQuery from R but I would rather do it in a pre-processing step from the command line using a tool like xidel.
All elements could be looked up in a single XPath 1.0 expression valid for many languages:
/bookstore/book/descendant::*[name()="title" or name()="year" or name()="Random"]
Equivalent/similar expressions:
/bookstore/book/title | /bookstore/book/year | /bookstore/book/ISBN/Random
//book/#category | //book/year | //ISBN/Random
To filter out elements:
//book/*[not(name()="title" or name()="year" or name()="ISBN" or name()="Random")]
For XMLs with namespaces, local-name() can be used instead of name() if namespace handling is not used.
For the given example and elements and testing on command line:
echo 'cat /bookstore/book/descendant::*[name()="title" or name()="year" or name()="Random"]' | xmllint --shell test.xml
Result:
/ > cat /bookstore/book/descendant::*[name()="title" or name()="year" or name()="Random"]
-------
<title lang="en">Everyday Italian</title>
-------
<year>2005</year>
-------
<title lang="en">Harry Potter</title>
-------
<year>2005</year>
-------
<Random>12354</Random>
-------
<title lang="en">XQuery Kick Start</title>
-------
<year>2003</year>
-------
<title lang="en">Learning XML</title>
-------
<year>2003</year>
-------
<Random>12345</Random>
/ >
For the mentioned R crash, worth looking here.

How to count elements with two "restrictions"?

My XML looks something like this :
<books>
<book id="b1">
<title>Set theory and the continuum problem</title>
<category>Mathematics</category>
<location>
<area>hall1</area>
<case>1</case>
<shelf>2</shelf>
</location>
<description>A lucid, elegant, and complete survey of set theory.</description>
<history>
<borrowed by="m4"/>
<borrowed by="m2" until="2018-04-05"/>
</history>
</book>
<book id="b2">
<title>Computational Complexity</title>
<isbn>978-0201-530-827</isbn>
<category>Computer Science</category>
<location>
<area>hall1</area>
<case>3</case>
<shelf>3</shelf>
</location>
<description>.</description>
</book>
<book id="b3">
<title>To mock a mockingbird</title>
<isbn>1-292-09761-2</isbn>
<category>Logic</category>
<category>Mathematics</category>
<location>
<area>hall1</area>
<case>1</case>
<shelf>3</shelf>
</location>
<description>.</description>
</book>
</books>
Is it possible to count how many books are there with elements area='hall1' and case='1'?
I tried this:
count(//books/book[location/area='hall1'])
but i do not know how to include case='1' "restriction" also
This should work:
count(//books/book[location/area='hall1'][location/case='1'])
** ADDITIONAL QUESTION **
Is it possible to list all book's titles which have area='hall1' and case='1'?
for $bb in //books/book[location/area='hall1'][location/case='1']
let $n := //books/book/title
return <book>$n</book>

Map the next node of input XML into previous node of XML schema

I have an source and destination schema like following
Source Schema:
<Root>
<STDS>
<COD>
<NAM>
<AGE>
</STDS>
</Root>
Destination Schema::
<Root>
<Students>
<Code100>
<Name>
<Age>
<Code50>
<Name>
<Age>
</Code50>
</Code100>
</Students>
</Root>
In the source input, STDS is unbounded. Node COD can have three values 100, 200 and 50. So any STDS node having the COD value = 50, should be added to the STDS with COD value = 100 prior to the current STDS node.
I have an input like.
<Root>
<STDS>
<COD>200</COD>
<NAM>ABC</NAM>
<AGE>20</AGE>
</STDS>
<STDS>
<COD>100</COD>
<NAM>XYZ</NAM>
<AGE>21</AGE>
</STDS>
<STDS>
<COD>50</COD>
<NAM>JJJ</NAM>
<AGE>22</AGE>
</STDS>
<STDS>
<COD>200</COD>
<NAM>JKL</NAM>
<AGE>23</AGE>
</STDS>
<STDS>
<COD>100</COD>
<NAM>MMM</NAM>
<AGE>24</AGE>
</STDS>
<STDS>
<COD>50</COD>
<NAM>NNN</NAM>
<AGE>25</AGE>
</STDS>
</STDS>
<STDS>
<COD>50</COD>
<NAM>LLL</NAM>
<AGE>26</AGE>
</STDS>
</Root>
I need an output like following
<Root>
<Students>
<Code200>
<Name>ABC</Name>
<Age>20</Age>
</Code200>
<Code100>
<Name>XYZ</Name>
<Age>21</Age>
<Code50>
<Name>JJJ</Name>
<Age>22</Age>
</Code50>
</Code100>
<Name>XYZ</Name>
<Age>21</Age>
</Code100>
<Code200>
<Name>JKL</Name>
<Age>23</Age>
</Code200>
</Code100>
<Name>MMM</Name>
<Age>24</Age>
<Code50>
<Name>NNN</Name>
<Age>24</Age>
</Code50>
<Code50>
<Name>LLL</Name>
<Age>25</Age>
</Code50>
</Code100>
</Students>
</Root>
I want to achieve this in BizTalk mapper without using custom XSLT.
All you need to do is
Link <COD> to <Code50>, <Code100> etc.. through an Equal Functoid that tests for 50, 100, etc.
Depending on the composition of the Schemas, you may also have to like <STDS> to <CodeXXX> through Looping Functoids.
Just like the other questions, which you should also switch back to Functoids, this can be done with Functoids only, you just have to try some combinations.

Parse XML based on attributes and text values of related nodes

I have used the XML package to parse both HTML and XML before, and have a rudimentary grasp of xPath. However I've been asked to consider XML data where the important bits are determined by a combination of text and attributes of the elements themselves, as well as those in related nodes. I've never done that. For example
[updated example, slightly more expansive]
<Catalogue>
<Bookstore id="ID910705541">
<location>foo bar</location>
<books>
<book category="A" id="1">
<title>Alpha</title>
<author ref="1">Matthew</author>
<author>Mark</author>
<author>Luke</author>
<author ref="2">John</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="B" id="10">
<title>Beta</title>
<author ref="1">Huey</author>
<author>Duey</author>
<author>Louie</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="D" id="100">
<title>Gamma</title>
<author ref="1">Tweedle Dee</author>
<author ref="2">Tweedle Dum</author>
<year>2005</year>
<price>29.99</price>
</book>
</books>
</Bookstore>
<Bookstore id="ID910700051">
<location>foo</location>
<books>
<book category="A" id="1">
<title>Happy</title>
<author>Dopey</author>
<author>Bashful</author>
<author>Doc</author>
<author ref="1">Grumpy</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="B" id="10">
<title>Ni</title>
<author ref="1">John</author>
<author ref="2">Paul</author>
<author ref="3">George</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="D" id="100">
<title>San</title>
<author ref="1">Ringo</author>
<year>2005</year>
<price>29.99</price>
</book>
</books>
</Bookstore>
<Bookstore id="ID910715717">
<location>bar</location>
<books>
<book category="A" id="1">
<title>Un</title>
<author ref="1">Winkin</author>
<author>Blinkin</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="B" id="10">
<title>Deux</title>
<author>Nod</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="D" id="100">
<title>Trois</title>
<author>Manny</author>
<author>Moe</author>
<year>2005</year>
<price>29.99</price>
</book>
</books>
</Bookstore>
</Catalogue>
I would like to extract all author names where:
1) the location element has a text value that contains "NY"
2) the author element does NOT contain a "ref" attribute; that is where ref is not present in the author tag
I will ultimately need to concatenate the extracted authors together within a given bookstore, so that my resulting data frame is one row per store. I'd like to preserve the bookstore id as an additional field in my data frame so that I can uniqely reference each store.
Since only the first bokstore is in NY, results from this simple example would look something like:
1 Jane Smith John Doe Karl Pearson William Gosset
If another bookstore contained "NY" in its location, it would comprise the second row, and so forth.
Am I asking too much of R to parser under these convoluted conditions?
require(XML)
xdata <- xmlParse(apptext)
xpathSApply(xdata,'//*/location[text()[contains(.,"NY")]]/following-sibling::books/.//author[not(#ref)]')
#[[1]]
#<author>Jane Smith</author>
#[[2]]
#<author>John Doe</author>
#[[3]]
#<author>Karl Pearson</author>
#[[4]]
#<author>William Gosset</author>
Breakdown:
Get all locations containing 'NY'
//*/location[text()[contains(.,"NY")]]
Get the books sibling of these nodes
/following-sibling::books
from these notes get all authors without a ref attribute
/.//author[not(#ref)]
Use xmlValue if you want the text:
> xpathSApply(xdata,'//*/location[text()[contains(.,"NY")]]/following-sibling::books/.//author[not(#ref)]',xmlValue)
[1] "Jane Smith" "John Doe" "Karl Pearson" "William Gosset"
UPDATE:
child.nodes <- xpathSApply(xdata,'//*/location[text()[contains(.,"NY")]]/following-sibling::books/.//author[not(#ref)]')
ans.func<-function(x){
xpathSApply(x,'.//ancestor::bookstore[#id]/#id')
}
sapply(child.nodes,ans.func)
# id id id id
#"1" "1" "1" "1"
UPDATE 2:
With your changed data
xdata <- '<Catalogue>
<Bookstore id="ID910705541">
<location>foo bar</location>
<books>
<book category="A" id="1">
<title>Alpha</title>
<author ref="1">Matthew</author>
<author>Mark</author>
<author>Luke</author>
<author ref="2">John</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="B" id="10">
<title>Beta</title>
<author ref="1">Huey</author>
<author>Duey</author>
<author>Louie</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="D" id="100">
<title>Gamma</title>
<author ref="1">Tweedle Dee</author>
<author ref="2">Tweedle Dum</author>
<year>2005</year>
<price>29.99</price>
</book>
</books>
</Bookstore>
<Bookstore id="ID910700051">
<location>foo</location>
<books>
<book category="A" id="1">
<title>Happy</title>
<author>Dopey</author>
<author>Bashful</author>
<author>Doc</author>
<author ref="1">Grumpy</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="B" id="10">
<title>Ni</title>
<author ref="1">John</author>
<author ref="2">Paul</author>
<author ref="3">George</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="D" id="100">
<title>San</title>
<author ref="1">Ringo</author>
<year>2005</year>
<price>29.99</price>
</book>
</books>
</Bookstore>
<Bookstore id="ID910715717">
<location>bar</location>
<books>
<book category="A" id="1">
<title>Un</title>
<author ref="1">Winkin</author>
<author>Blinkin</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="B" id="10">
<title>Deux</title>
<author>Nod</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="D" id="100">
<title>Trois</title>
<author>Manny</author>
<author>Moe</author>
<year>2005</year>
<price>29.99</price>
</book>
</books>
</Bookstore>
</Catalogue>'
Note previously you had bookstore now Bookstore. NY is gone so I have used foo
require(XML)
xdata <- xmlParse(xdata)
child.nodes <- getNodeSet(xdata,'//*/location[text()[contains(.,"foo")]]/following-sibling::books/.//author[not(#ref)]')
ans.func<-function(x){
xpathSApply(x,'.//ancestor::Bookstore[#id]/#id')
}
sapply(child.nodes,ans.func)
# id id id id id
#"ID910705541" "ID910705541" "ID910705541" "ID910705541" "ID910700051"
# id id
#"ID910700051" "ID910700051"
xpathSApply(xdata,'//*/location[text()[contains(.,"foo")]]/following-sibling::books/.//author[not(#ref)]',xmlValue)
# [1] "Mark" "Luke" "Duey" "Louie" "Dopey" "Bashful" "Doc"

Need to use yatra.com API in my website

asalamualikum , I need to used yatra.com api on my website which is an asp.net website.I have got a word document from yatra(air integration document). Yatra api is xml based , air integration document shows format of xml requests and responses but I haven't used xml in webservices and have no idea but I have concept of xml but have used xml only to read and write files on local system.Now I have a problem I dont know how to use xml in webservices and how to recieve response from api and display it on my page or sent request to api..If any one can help me I will be very thankful to him......If you could give me ne url or a video where user have used some api(xml based) for integration. Help will be strongly appreciated.If anyone can give me sample code for below request and resonse.
Sample request to yatra api:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<OTA_AirLowFareSearchRQ EchoToken="0" SequenceNmbr="0" TransactionIdentifier="0" AvailableFlightsOnly="" DirectFlightsOnly="" xmlns="http://www.opentravel.org/OTA/2003/05">
<POS xmlns="http://www.opentravel.org/OTA/2003/05">
<Source AgentSine="" PseudoCityCode="NPCK" TerminalID="1">
<RequestorID ID="AFFILIATE"/>
</Source>
<YatraRequests>
<YatraRequest AffiliateID="EASTBOUND"/>
</YatraRequests>
</POS>
<TravelerInfoSummary>
<AirTravelerAvail>
<PassengerTypeQuantity Code="ADT" Quantity="1"/>
<PassengerTypeQuantity Code="CHD" Quantity="1"/>
<PassengerTypeQuantity Code="INF" Quantity="1"/>
</AirTravelerAvail>
</TravelerInfoSummary>
<SpecificFlightInfo>
<Airline Code=""/>
</SpecificFlightInfo>
<OriginDestinationInformation>
<DepartureDateTime>2011-09-11T00:00:00</DepartureDateTime>
<OriginLocation CodeContext="IATA" LocationCode="DEL">DEL</OriginLocation>
<DestinationLocation CodeContext="IATA" LocationCode="BOM">BOM</DestinationLocation>
</OriginDestinationInformation>
<TravelPreferences>
<VendorPref Code="SG"/>
<VendorPref Code="DN"/>
<CabinPref Cabin=""/>
</TravelPreferences>
</OTA_AirLowFareSearchRQ>
</soapenv:Body>
</soapenv:Envelope>
Sample Response from yatra api
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<OTA_AirLowFareSearchRS Version="2.001" xmlns="http://www.opentravel.org/OTA/2003/05">
<PricedItineraries>
<PricedItinerary CompositeFlightNumber="S2101" CountCompositeFlightNumber="1" OriginDestinationRPH="0" SequenceNumber="1" SupplierSystem="Amadeus">
<AirItinerary SupplierSystem="Amadeus">
<OriginDestinationOptions>
<OriginDestinationOption Duration="01:55:00" FromCache="true" SupplierSystem="Amadeus">
<FlightSegment ArrivalDateTime="2007-11-11T08:55:00" DepartureDateTime="2007-11-11T07:00:00" E_TicketEligibility="Eligible" FlightNumber="101" RPH="1" ResBookDesigCode="O">
<BookingClassAvail RPH="1" ResBookDesigCode="O" ResBookDesigQuantity="4"/>
<DepartureAirport LocationCode="DEL"/>
<ArrivalAirport LocationCode="BOM"/>
<Equipment AirEquipType="737"/>
<MarketingAirline Code="S2"/>
</FlightSegment>
<FormData>
<FareInformationIDs>
<FareInformationID BaseFare="1825" Code="" FareCode="UGOSAVE" FareID="0" PTCID="1" Quantity="">0</FareInformationID>
</FareInformationIDs>
</FormData>
</OriginDestinationOption>
</OriginDestinationOptions>
</AirItinerary>
<AirItineraryPricingInfo>
<ItinTotalFare>
<BaseFare Amount="1875" CurrencyCode="INR"/>
<Taxes>
<Tax Amount="1575" CurrencyCode="INR" TaxCode="TTL"/>
</Taxes>
<TotalFare Amount="3461.63" CurrencyCode="INR"/>
<ServiceTax Amount="11.63" Currency="INR" Description="Service Tax" ServiceTaxCode="ST" ServiceTaxRate="0.0062"/>
</ItinTotalFare>
<PTC_FareBreakdowns>
<PTC_FareBreakdown>
<PassengerTypeQuantity Code="ADT" Quantity="1"/>
<FareBasisCodes>
<FareBasisCode>OSASAS</FareBasisCode>
</FareBasisCodes>
<PassengerFare>
<BaseFare Amount="1875" CurrencyCode="INR"/>
<Taxes>
<Tax Amount="1575" CurrencyCode="INR" TaxCode="TTL"/>
</Taxes>
<TotalFare Amount="3450" CurrencyCode="INR"/>
</PassengerFare>
</PTC_FareBreakdown>
</PTC_FareBreakdowns>
<FareInfos>
<FareInfo>
<FareReference>OSASAS</FareReference>
<FilingAirline Code="ZZ"/>
<DepartureAirport LocationCode="DEL"/>
<ArrivalAirport LocationCode="BOM"/>
</FareInfo>
</FareInfos>
</AirItineraryPricingInfo>
<TicketingInfo DeliveryMethod="EMAIL" TicketTimeLimit="" TicketType="eTicket" TicketingStatus="" eTicketNumber="">
<TicketAdvisory Language="English"/>
</TicketingInfo>
</PricedItinerary>
</PricedItineraries>
</OTA_AirLowFareSearchRS>
</soapenv:Body>
</soapenv:Envelope>
You no need to worry about creating the xml or consuming the xml, if you are using C sharp side use WCF or any tool to create client by using Yatra.com wsdl.
Now treat evrthing as object oriented it will be responsibility of your C sharp client stubs to generate XML. you just need to map the values in stubs.

Resources