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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1123)
- Stylus Studio Technical Forum (13809)
-> + WebService Connect (6)
-> - WebService conection problems (1)
-> + Could not detect EDI dialect a... (3)
-> + I am a bookkeeper not a progra... (2)
-> + fatal error (4)
-> - Saxon linebreak (1)
-> + task scheduler (2)
-> - Number of Elements in Grid vie... (1)
-> + Compile Java (2)
-> + What happened to the EDI Wizar... (15)
-> + setting Transformer for java b... (3)
-> + XML Schema Documentation Gener... (3)
-> + EANCOM xsd-files (4)
-> + Failure of CDATA converting pr... (4)
-> + XML File created from text fil... (3)
-> + After purchase AND activation ... (2)
-> + XQuery Format of XML code snip... (4)
-> + Error during conversion (9)
-> - testing for empty nodes (1)
-> + edi converter - java fails (10)
-> + ddtek:serialize (3)
-> - File explorer view (1)
-> - Java Extension Functions (1)
-> + err:FODC0004 (18)
-> - Removing Attributes when Null (1)
-> + CDATA preservation (6)
-> + Help converting xml report to ... (2)
-> + Converting text to XML issue (3)
-> - example not working (1)
-> + XML Editing (2)
-> + Multiple EDI messages within s... (5)
-> + Mapping RDBMS and XML Schema t... (2)
-> + MySQL Database importing (2)
-> + XSD validation using XSV fails... (3)
-> + Is this really well-formed? (3)
-> + HL7 EDI to XML problems -'ORU_... (11)
-> + How do I modify the Xquery to ... (2)
-> + XML mapping difficulty (3)
-> + XLST Conversion (2)
-> + HTML TO XSL Conversion (2)
-> - Convert an EBCDIC file to XML (1)
-> + License Manager still indicate... (4)
-> + Still sometimes getting beat b... (2)
-> + What versions of MySQL are sup... (5)
-> - External XSLT processor proble... (1)
-> + DDEE0082 Erro Internal system ... (6)
-> + Calling function from .NET C# (2)
-> + Stylus studio projects bound t... (3)
-> + Report Designer mistakenly gen... (3)
-> + Choose Nodes in pipelines (3)
-> + Custom external processor and ... (2)
-> + predefined (4)
-> + translate function in java (2)
-> + XMLPipeline trouble in Linux (7)
-> + Converting Custom EDI Message ... (2)
-> + tab delimetered file with vari... (2)
-> + XML validation with XSD (2)
-> + Missing documentation: SSL_Cer... (2)
-> + Parse Xcel input file which is... (2)
-> + XML Publisher post processors (2)
-> + Alignment of table items in XM... (2)
-> + XML to PDF using XML Publisher (2)
-> + Blurry Background image / Vect... (4)
-> + URIResolver error on command l... (2)
-> + stylus studio - the (3)
-> + problem with omit from output ... (3)
-> + Maximum XML File Size and Out ... (4)
-> + 64-bit version of Stylus Studi... (2)
-> + Generate xml schema from edi s... (3)
-> + License disabled (6)
-> + Stylus is not recognizing save... (5)
-> + WINE / CrossOver (3)
-> + Problem with FOP plugin (SS200... (5)
-> - XML diff engine - how to ignor... (1)
-> + How to configure Xerces J (2)
-> + Configuring xerces-2_9_1 (4)
-> + Release license to use stylus ... (5)
-> + Sorting Repeater row (3)
-> - Browse for Pipeline Input (1)
-> + Stylus 2010 and Win 7 problem ... (6)
-> + Cannot set XSLT source files w... (3)
-> - Simple TXT to HTML Convertor! ... (1)
-> + Invoking XSLT and FOP Processe... (2)
-> - Add Node and Pattern for Mutlp... (1)
-> - How to get xsl:message output ... (1)
-> + WSDL for Cvent Web Service (5)
-> - newbie question: IS there a "f... (1)
-> + Windows 7 64-bit Java. Stylus ... (3)
-> + Stylus Studio Enterprise crash... (2)
-> - XML to Access or SQL? Newbie N... (1)
-> - xml to flat file mapping using... (1)
-> + Missing Document Wizards (2)
-> - XSLT mapping and (1)
-> + Citrix Softgrid package proble... (2)
-> - xsl:import dropping the attrib... (1)
-> + XSLT mapping between schemas (5)
-> + Modifying/Creating existing CA... (9)
-> - Creating XML Sample Stream fro... (1)
-> - Integer to hex (1)
-> - Opening from and then Saving t... (1)
-- Previous [301-320] [321-340] [341-360] Next
+ Website Feedback (243)
+ XSLT Help and Discussion (7447)
+ XQuery Help and Discussion (1861)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (361)
+ Stylus Studio Announcements (113)
Topic  
Postnext
dean katzSubject: How to create SQL/XML
Author: dean katz
Date: 03 Aug 2005 06:17 PM
I am very new to XML, XSD as well as stylus studio. I have a table that was created using MSAccess 2002. This table is already upsized to our SQL server. I now have to transfer the contents of this table to an outside party but before I do that they want me to validate the records in the table against the schema created by them. Some of the fields in my table is defined as elements in the schema but there a few which are defined as attributes. How do I even begin to aproach the task of transfering from a table format to XML format that matches the consultant's schema?

sample:
table 'clients' has these fields
record_id
add_date
edit_date
lname
fname
gender
dob

according to the schema record_id, add_date and edit_date are attributes
whereas lname, fname, gender and dob are elements.

how do I create the SQL/XML that will get record_id, add_date and edit_date as attributes and lname, fname, gender and dob as elements? please help.

Postnext
Tony LavinioSubject: How to create SQL/XML
Author: Tony Lavinio
Date: 03 Aug 2005 10:58 PM
Here is a step-by-step video tutorial on how to do exactly that. http://www.stylusstudio.com/videos/dbtoxml1/dbtoxml1.html

Postnext
dean katzSubject: How to create SQL/XML
Author: dean katz
Date: 04 Aug 2005 11:21 AM
Thank you for the pointer. I started on that page to create an SQL/XML query below. But somehow kept getting an error message. What is wrong with my SELECT statement? Thank you in advance for your help.

SELECT
XMLELEMENT(name "row",
XMLATTRIBUTES("record_id",t.record_id),
XMLATTRIBUTES("system_id",t.system_id),
XMLATTRIBUTES("odbid",t.odbid),
XMLATTRIBUTES("date_added",t.date_added),
XMLATTRIBUTES("date_updated",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 "ethnic",t.ethnic),
XMLELEMENT(name "gender",t.gender),
XMLELEMENT(name "dob",t.dob)
)
FROM SPSQL.dbo.clients t

Postnext
Ivan PedruzziSubject: How to create SQL/XML
Author: Ivan Pedruzzi
Date: 04 Aug 2005 12:03 PM
XMLATTRIBUTES has a different syntax from XMLELEMENT. Change your query to

SELECT
XMLELEMENT(name "row",
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 "ethnic",t.ethnic),
XMLELEMENT(name "gender",t.gender),
XMLELEMENT(name "dob",t.dob)
)
FROM SPSQL.dbo.clients t


Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
dean katzSubject: How to create SQL/XML
Author: dean katz
Date: 04 Aug 2005 12:10 PM
aaaaah. i c. thank you!

Postnext
dean katzSubject: How to create SQL/XML
Author: dean katz
Date: 24 Aug 2005 06:08 PM
Originally Posted: 04 Aug 2005 02:12 PM
Here's more question...<br> <br> The schema that am using to validate my XML document have an element called dynamic_content. This element holds info about gender, birthdate, weight, height etc. I don't have a field in my table that corresponds to this dynamic_content element. But I have fields on my table that carries info on gender and birthdate. How should I change the SQL/XML syntax to include the gender and birthdate field and still stick to the schema? GOd, I really hope I am making sense. Felt like I am learning to swim as I was drowning!

Postnext
Ivan PedruzziSubject: How to create SQL/XML
Author: Ivan Pedruzzi
Date: 04 Aug 2005 06:30 PM
Create the dynamic_content elemen and then bind the columns you like as children


SELECT
XMLELEMENT(name "row",
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 "ethnic",t.ethnic),

XMLELEMENT(name "dynamic_content"
XMLELEMENT(name "gender",t.gender),
XMLELEMENT(name "birthdate",t.birthdate)),

XMLELEMENT(name "dob",t.dob)
)
FROM SPSQL.dbo.clients t

Postnext
dean katzSubject: How to create SQL/XML
Author: dean katz
Date: 24 Aug 2005 06:07 PM
another question:
i have a table 'clubs' with these fields: club_id, clubname, clubtype, yearform.

i also have another table that list the members of each club. members table have these fields: member_id, member_name, date_join, member_rank, and member_position. in the schema, members is listed as element of clubs. how would I craft the SQL/XML ststement to include all element inside clubs and members. is it possible to create a SELECT statement within another Select statement like in t-sql like this:

SELECT
XMLELEMENT(name "clubs,
XMLELEMENT(name "club_id", t.club_id),
XMLELEMENT(name "club_name", t.club_name),
SELECT
XMLELEMENT(name "members",
XMLELEMENT(name "member_name", t.member_name),
XMLELEMENT(name "member_id", t.memberid),
XMLELEMENT(name "date_join", t.date_join)
))
FROM ClubDB.dbo.tblmembers

)
FROM ClubDB.dbo.tblclubs

I get an incorrect syntax when I try to run this. Please help.

Posttop
Ivan PedruzziSubject: How to create SQL/XML
Author: Ivan Pedruzzi
Date: 24 Aug 2005 11:01 PM
The question has been already answered, see the following post

http://www.stylusstudio.com/SSDN/default.asp?action=9&read=3742&fid=46#10720


Ivan Pedruzzi
Stylus Studio Team

   
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-2011 All Rights Reserved.