Solved

XML Select

Posted on 2011-03-01
5
285 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
  • 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

679 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