﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Creating and Binding a BO to an XML file...</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 17:44:58 GMT</lastBuildDate><ttl>20</ttl><item><title>Creating and Binding a BO to an XML file...</title><link>http://forum.strataframe.net/FindPost3566.aspx</link><description>I'm sorry I didnt see anything in the documentation that talks about how to create and ultimately bind a BO to an XML file.  I looked at the XMLDataSourceSample and I saw that you did it, I just dont understand how to get to that point.  I'm assuming you cant use the Business Object Mapper to map to the xml file and create the partial class.&lt;br&gt;
&lt;br&gt;
Could you maybe help me get a jump start on how to do this?&lt;br&gt;
&lt;br&gt;
Thanks</description><pubDate>Fri, 13 Oct 2006 16:05:29 GMT</pubDate><dc:creator>StarkMike</dc:creator></item><item><title>RE: Creating and Binding a BO to an XML file...</title><link>http://forum.strataframe.net/FindPost3588.aspx</link><description>That is an excellent question, Mike...&lt;/P&gt;&lt;P&gt;I would venture to say that you would want to copy the data from the XML file into SQL Server and run the query :D&lt;/P&gt;&lt;P&gt;No, really, you'll probably need to use some of the objects within the System.Xml.XPath namespace (in the System.Xml.dll assembly) or maybe figure out how to use XQuery... however I have never used either of those technologies, so I wouldn't know where to start, though you might Google XQuery or XPath and see what sort of info you can find on it.&lt;/P&gt;&lt;P&gt;The XPath namespace has some objects you can use to create an XML cursor, so if worst comes to worst, you could cursor through the records to find the one that you want, but I'm pretty sure XQuery supports XML indexes, so it should be lots faster.</description><pubDate>Fri, 13 Oct 2006 16:05:29 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Creating and Binding a BO to an XML file...</title><link>http://forum.strataframe.net/FindPost3581.aspx</link><description>Thanks. Me.CurrentDataTable.ReadXML() didnt work but I was able to take most of the code from the XMLDatasource example and make it work.&lt;br&gt;
&lt;br&gt;
Another question...what if I wanted to create a FillByEmployeeID method? how would I query the XML document to only return the records I want? &lt;br&gt;
&lt;br&gt;
Here's the code I used for my basic Fill method:&lt;br&gt;
&lt;br&gt;
[code]&lt;br&gt;
    Public Sub FillAll()&lt;br&gt;
        '-- Establish Locals&lt;br&gt;
        Dim loDS As New DataSet&lt;br&gt;
        Dim lcFile As String = MicroFour.StrataFrame.Strings.StringBasics.AddBS(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location))&lt;br&gt;
&lt;br&gt;
        lcFile &amp;= "test.xml"&lt;br&gt;
&lt;br&gt;
        '-- Load the XML file&lt;br&gt;
        loDS.ReadXml(lcFile)&lt;br&gt;
&lt;br&gt;
        '-- Move the data into the business object&lt;br&gt;
        Me.CopyDataFrom(loDS.Tables(0), MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable)&lt;br&gt;
&lt;br&gt;
        '-- Clean Up&lt;br&gt;
        loDS.Dispose()&lt;br&gt;
    End Sub&lt;br&gt;
[/code]</description><pubDate>Fri, 13 Oct 2006 14:22:30 GMT</pubDate><dc:creator>StarkMike</dc:creator></item><item><title>RE: Creating and Binding a BO to an XML file...</title><link>http://forum.strataframe.net/FindPost3576.aspx</link><description>You will need to write Fill methods that end up calling Me.CurrentDataTable.ReadXml() to bring the xml file in and you will need to overwrite the Save() method to save the data to the XML file using Me.CurrentDataTable.WriteXml() and then Me.CurrentDataTable.AcceptChanges().</description><pubDate>Fri, 13 Oct 2006 13:37:02 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Creating and Binding a BO to an XML file...</title><link>http://forum.strataframe.net/FindPost3575.aspx</link><description>Ok, now that I have my BO created what would I need to change to redirect it to look at the xml file instead of the SQL Server?</description><pubDate>Fri, 13 Oct 2006 13:24:08 GMT</pubDate><dc:creator>StarkMike</dc:creator></item><item><title>RE: Creating and Binding a BO to an XML file...</title><link>http://forum.strataframe.net/FindPost3574.aspx</link><description>Yes, that will work as well... you could even create the structure on a local instance of SQL Server express rather than on one of your dev servers... doesn't matter.</description><pubDate>Fri, 13 Oct 2006 13:18:05 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Creating and Binding a BO to an XML file...</title><link>http://forum.strataframe.net/FindPost3573.aspx</link><description>We didnt purchase the DDT... does that mean we are out of luck? What if I initially create the table in SQL Server to get the BO Mapper to create the partial class and then some how redirect the BO to the xml&amp;nbsp;file instead of SQL Server</description><pubDate>Fri, 13 Oct 2006 13:16:00 GMT</pubDate><dc:creator>StarkMike</dc:creator></item><item><title>RE: Creating and Binding a BO to an XML file...</title><link>http://forum.strataframe.net/FindPost3571.aspx</link><description>You have to use the DDT and create a "dummy" profile with a "dummy" database and a "dummy" tables that has the structure of the XML file.&amp;nbsp; That's how you get the BOMapper to create the partial class for you.</description><pubDate>Fri, 13 Oct 2006 13:12:50 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>