Solved

XML Select

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I need help making a collection from a class in VB.Net 3 27
SQL Query stumper 3 37
Error running stored procedure 11 18
MSDN Licensing query 5 53
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

895 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now