How Can I Read Tag from XML response

Hi Team
I am sharing my code here from that i wanted to search
eighteen_or_older,=YES
Sponsorship_USA,=No
Future_Sponsorship=No
job profile=…
skills=…
If tag not found throw exception can anyboady help me out guys please

Main.xaml (12.7 KB)

here is my code

Cross References:

where it was answered with the hint on handling the XML namespaces by:

And the request for sample XML data:

I have share my code there can you check that,That will provide api response

Main.xmal file is there

<?xml version="1.0" encoding="utf-16"?>kamath_harish@hotmail.comR150379TrueBasic SVNVX09wZW5fSm9iX1JlcXVpc2l0aW9uX091dGJvdW5kOkN1c2h3YWtlXzg3NiM=TrueTrue__ReferenceID0

We asked for the XML Data as Text file and not for the XAML, as from theXAML we cannot get the details / specifics of the XML Data. However we shared you an initial starter help for the XML extraction approach. Also the question to the extraction details (e.g. which fields…) was unanswered so far.

With such details we can give you more individually help

API reponse.txt (16.8 KB)
U can refer this not before one that one is wrong

Hi Team
I am sharing my code here from that i wanted to search
eighteen_or_older,=YES
Sponsorship_USA,=No
Future_Sponsorship=No
job profile=…
skills=…
If tag not found throw exception can anyboady help me out guys please refer final txt file and help me out

As mentioned in the link:

grafik
grafik

Retrieval example:
grafik

variation:
grafik

can you tell how can i read that tag specifically

what is meant with specifically?

when respecting the structure part and using the XNamespace Varaible and the element local name we can retrieve the value for the particular element

that response from postman sir actually refer my code and output i am pasting here


Maybe following will help you:

as mentioned above:

following implementation:
grafik

xnsDefault = xDoc.Root.Name.Namespace
Log message:

xDoc.Root.Element(xnsDefault + "Report_Entry").Element(xnsDefault + "Date_Applied" ).Value

will create following output and demonstrate the value retrieval for a specific xml element:
grafik

Summary:
The topic: How Can I Read Tag from XML response
is understood as

  • how the values from the response XML can be extracted

We introduced to you:

  • handling of XML Namesspaces for your XML case
  • sample retrieval demo
    • above and
      grafik

So based on this you can continue and implement the more detail value extraction

The question:

we can defensive check if the tag is present with the following apporach
grafik

Fazit: we do see your general question as answered and ideally this topic can be closed by you:


I have try this approach but i do not get proper values for tag eitheen_or_older,FutureSponseship,USASponarship i am sharing here screenshot
as deserialized xml output for this tag we have descriptor also

xmlOutput.Root.Element(xdefault + “Report_Entry”).Element(xdefault + “Date_Applied”).Value

xmlOutput.Root.Element(xdefault + “Report_Entry”).Element(xdefault + “Sponsorship_USA” ).Value

xmlOutput.Root.Element(xdefault + “Report_Entry”).Element(xdefault + “Future_Sponsorship” ).Value
Output
image

the XML has a different structure and we can get the values from the Descriptor attribute:

grafik

xDoc.Root.Element(xnsDefault + "Report_Entry").Element(xnsDefault + "eighteen_or_older").Attribute(xnsDefault + "Descriptor").Value

A defensive check if the Descriptor attribute is occuring or not we can do:

1 Like

@ppr i will check that as of now i am trying somhing else which
Out_XML.Root.Element(XDefault + “Report_Entry”).Element(XDefault + “Sponsorship_USA” ).FirstAttribute.Value
is its right let me know