Solved

XML Select

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

743 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

10 Experts available now in Live!

Get 1:1 Help Now