Solved

XML Select

Posted on 2011-03-01
5
287 Views
Last Modified: 2012-05-11
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"?>
<Document>

</Document>
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
Chandan_Gowda earned 250 total points
ID: 35007531
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
http://support.microsoft.com/kb/308333
0
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 250 total points
ID: 35008000
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

0
 

Author Comment

by:lrbrister
ID: 35017112
Ok guys...both had valuable input.

Any problems with splitting points?
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 35017136
0
 

Author Closing Comment

by:lrbrister
ID: 35028526
Both are valid answers and very useful.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question