XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
dee katzSubject: Producing a treelike structure - How Now Brown Cow?
Author: dee katz
Date: 10 Jan 2006 06:28 PM
How can get a tree-like xml document structure (see attachment) from a SELECT statement that looks like this:

SELECT
XMLELEMENT( NAME "client",
XMLATTRIBUTES(t.record_id, t.system_id, t.odbid, t.date_added, t.date_updated),
XMLELEMENT( NAME "first_name", t.first_name),
XMLELEMENT( NAME "last_name", t.last_name),
XMLELEMENT( NAME "mi_initial", t.mi_initial),
XMLELEMENT( NAME "soc_sec_no", t.soc_sec_no),
XMLELEMENT( NAME "dynamic_content",
XMLELEMENT( NAME "svpprofgender", XMLATTRIBUTES(t.date_added, t.date_effective), t.svpprofgender),
XMLELEMENT( NAME "svpprofdob", XMLATTRIBUTES(t.date_added, t.date_effective), t.svpprofdob),
XMLELEMENT( NAME "svpprofrace", XMLATTRIBUTES(t.date_added, t.date_effective), t.svpprofrace)))
FROM ServicePoint.DBO.tblrawclients t
WHERE clientndx BETWEEN 1 and 12000

Is there a way that I can include the <records></records> information on the select statement itself. So far I've been running the query and copy and pasting the result to a template with <?xml version="1.0"?><records></records> already filled in (i.e. I pasted my data between the 2 records tags. There has to be an easier way of doing this instead of copying and pasting. Please help. I have to create 160 xml doc files base on this query. I am using SS6 Professional Edition. Thanks.


DocumentTestClient.xml
Sample XML document

Postnext
Tony LavinioSubject: Producing a treelike structure - How Now Brown Cow?
Author: Tony Lavinio
Date: 11 Jan 2006 10:11 AM
There are a couple of ways to handle this.

First, you could save the definition and use it as input to XSLT
or XQuery, which would wrap the results in your chosen tag. By
the way, this can be run from the command line, using StylusXslt.exe,
so you could completely automate this and run it from a batch file
or command-line 'for' loop.

Or, you could try the DDXQ XQuery processor, which underneath the
covers will still access the data in a relational manner, but which
on the surface will parse and execute XQuery.

Postnext
dee katzSubject: Producing a treelike structure - How Now Brown Cow?
Author: dee katz
Date: 11 Jan 2006 10:54 AM
I am not familiar with either method but at this point I will try anything. But can you tell me which of the two methods would be the easier approach?

Posttop
Tony LavinioSubject: Producing a treelike structure - How Now Brown Cow?
Author: Tony Lavinio
Date: 11 Jan 2006 11:29 AM
"Easier" is a relative term. To answer that, I'd have to know you
quite a bit better :)

This may help; it's a tutorial on SQL/XML and XQuery.

http://www.stylusstudio.com/sqlxml_tutorial.html

You also might try looking at a couple of the videos for SQL/XML
and/or XQuery at http://www.stylusstudio.com/xml_videos.html to
see what the difference in difficulty, based on what you already
know, is.

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.