Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / November 2005

Tip: Looking for answers? Try searching our database.

App Architecture ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
prefersgolfing - 28 Nov 2005 16:07 GMT
I am creating two services. One downloads XML streams from WebSphere MQ into
a SQL2K database, the other uploads XML Streams into Websphere MQ from
SQL2K. The upload service polls SQL2K every couple of minutes for uploads.
If there are uploads I create an ADO Dataset that I must convert to an XML
stream. The Dataset and the XML stream have different schemas, just to
clarify my dilema. I'm seeking input on the best way to convert ADO Datasets
to XML streams and vice versa, baring in mind their schemas are different. I
did a POC and "hard coded" each field to it's element. Surely, there's
another way. I have several of these to do and most have well over 100
fields. It would be nice to iterate through either the .xsd or the empty
.xml, and fill the .xml, utilizing a .xml based map, with the fields in the
ADO dataset. I am comfortable with the Document and Schema Object Models.
Any recommendations would be welcomed. Thanks in advance for your time.
DC - 30 Nov 2005 22:53 GMT
You can extract an XmlDocument from the DataSet, and can then apply an XSL
transform on it.
And of course, you can do the converse, too.  examples:
http://samples.gotdotnet.com/quickstart/howto/doc/Xml/LoadXmlDocument.aspx

Have you tried this?

If you want to avoid the dataset and XSL on the DB-to-MQ path, there is an
FOR XML support in SQL2000, which allows you to extract whatever shape of
XML you like from a query.  You can do something like this:

     System.Xml.XmlTextReader xtr= null;
     System.Xml.XmlDocument doc= null;
     System.Data.SqlClient.SqlConnection dbconn= null;
     try {
       dbconn= GetDbConn();
       System.Data.SqlClient.SqlCommand cmd= new
System.Data.SqlClient.SqlCommand(strSQL, dbconn);
       cmd.Connection.Open();

       xtr = (System.Xml.XmlTextReader) cmd.ExecuteXmlReader();
       //xtr.WhitespaceHandling = System.Xml.WhitespaceHandling.None;
       doc = new System.Xml.XmlDocument();
       doc.Load(xtr);
       //do whatever you like here
     }
     ....

The FOR XML EXPLICIT can do basically what you describe here:
> It would be nice to iterate through either the .xsd or the empty .xml, and
> fill the .xml, utilizing a .xml based map, with the fields in the ADO
> dataset.

...but it is being done by SQL Server. The query strings can get pretty
ugly, though. See here for some help and examples:
http://www.topxml.com/sql/for_xml_explicit.asp

Regardless how you get it, once you have the XmlDocument you can transform,
serialize, whatever.

-D

>I am creating two services. One downloads XML streams from WebSphere MQ
>into a SQL2K database, the other uploads XML Streams into Websphere MQ from
[quoted text clipped - 10 lines]
>Models. Any recommendations would be welcomed. Thanks in advance for your
>time.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.