Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6468039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:51:10+00:00 2026-05-25T05:51:10+00:00

Could you help Dim ScriptDOC As XDocument ScriptDOC = XDocument.Parse(e.Result) Dim Result = From

  • 0

Could you help

Dim ScriptDOC As XDocument
    ScriptDOC = XDocument.Parse(e.Result)

Dim Result = From ele In XElement.Parse(ScriptDOC.ToString).Elements("HANDERDETAILS")
If IsNothing(Result.Descendants("RESULT")) = False Then status = Result.Descendants("RESULT").Value

If LCase(status) = "ok" Then
    If IsNothing(Result.Descendants("BRANCHID")) = False Then BranchID = Result.Descendants("BRANCHID").Value

End If

From converter I got this code:

XDocument ScriptDOC = default(XDocument);
string status = "";

ScriptDOC = XDocument.Parse(e.Result);

dynamic Result = from ele in XElement.Parse(ScriptDOC.ToString).Elements("HANDERDETAILS");
if ((Result.Descendants("RESULT") == null) == false)
    status = Result.Descendants("RESULT").Value;

if (Strings.LCase(status) == "ok") {
    if ((Result.Descendants("BRANCHID") == null) == false)
        BranchID = Result.Descendants("BRANCHID").Value;
}

which is not good.

This is my xml:

<AAAAA>
  <HANDERDETAILS>
    <RESULT>OK</RESULT>
    <BRANCHID>4</BRANCHID>
    <HANDLERID>1</HANDLERID>
    <HANDLERNAME>some Admin</HANDLERNAME>
    <BRANCHNAME>Asome New</BRANCHNAME>
  </HANDERDETAILS>
</AAAAA>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T05:51:10+00:00Added an answer on May 25, 2026 at 5:51 am

    What converter did you use? It looks like it could be improved significantly. You do want to watch out for cases where you are recieving a collection but were expecting a single object which your original code does not appear to be handling.

    XDocument ScriptDOC = XDocument.Parse(e.Result); 
    
    var Result = ScriptDOC.Element("AAAAA").Element("HANDERDETAILS");
    if (Result.Element("RESULT") != null)
    {
        Status = Result.Element("RESULT").Value;
        if (Status.ToLower() == "ok")
            if (Result.Element("BRANCHID") != null)
                BranchID = Result.Element("BRANCHID").Value;
    }
    

    You also want to watch out for namespaces. In VB, you can declare them as an Import in your class, but in C#, you have to specify them explicitly in your code.

    XNamespace ns = "http://www.someuri";
    var Result = ScriptDOC.Elements(ns + "HANDERDETAILS");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder if someone could help me figure out how to parse a string
What could help me in helping writing highly compact(least byte code count) programs in
I hope someone could help me on this. I want to add a month
I wonder if you could help me with something I've been thinking about. Say
Just wondering if you could help wanting to produce an activity stream in Java,
I wonder if anyone could help me with a problem I've been having. I
Do you think jquery could help me get the following script work faster? Thanks!
Wondered if someone could help me write a MySQL query. I noticed in my
Is there something available that could help me convert a XSD into SQL relational
Hi guys wonder if you guys could help me I'm trying to compile a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.