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
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
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
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
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
Maybe following will help you:
as mentioned above:
following implementation:
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:
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
- above and
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
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
the XML has a different structure and we can get the values from the Descriptor attribute:
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:
@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