Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

XQuery Basics

I want to visually see where the following 8 items below exists:

XQuery returns sequences like:                                                      Examples:
1- Atomic values; sequence can include atomic val.                   1.  Is this like number 3?  
2- Complex values (XML nodes).                                                    2. Are nodes <root>, <a> etc?
3- Element,                                                                                         3. Are a, b, c, d elements?
4- Attribute,                                                                                        4. I guess none given here.??
5- Text,                                                                                                5. I guess none given here.??
6- Processing instruction,                                                                6. n/a ??
7- Comment, or                                                                                 7. n/a ??
8- Document,                                                                                     8. n/a ??

In the following example:
DECLARE @x AS XML;
SET @x=N'
<root>
<a>1<c>3</c><d>4</d></a>
<b>2</b>
</root>';
SELECT
@x.query('*') AS Complete_Sequence, 
@x.query('data(*)') AS Complete_Data,
@x.query('data(root/a/c)') AS Element_c_Data;

Complete_Sequence                                Complete_Data     Element_c_Data
<root><a>1<c>3</c><d>4</d></a><b>2</b></root>       1342            3

Open in new window


I have plenty of links to read through. After reading the links, the above items are questions I have. There will be a follow up question requesting a better example so I could see all of the 8 items listed above.
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial