XML Select

How do I do a select so that these items are at the top and bottom of my created XML?

Is there a way to pick up the top tag automatically?

<?xml version = "1.0" encoding = "UTF-8"?>

Who is Participating?
Chandan_GowdaConnect With a Mentor Commented:
To achieve your requirement. You have to use xpath query.

please follow the below link, It will clearly explain how to use xpath query to select xml elements from an xml
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
to verify that your xml has the declaration at the top (version and encoding) and the first node is "Document":
XDocument xdoc = XDocument.Load(@"c:\temp\test.xml");
            if (xdoc.Declaration != null && xdoc.Root.Name.LocalName == "Document")


Open in new window

lrbristerAuthor Commented:
Ok guys...both had valuable input.

Any problems with splitting points?
Meir RivkinFull stack Software EngineerCommented:
lrbristerAuthor Commented:
Both are valid answers and very useful.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.