StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


12»»

XML to BOExpand / Collapse
Author
Message
Posted 08/23/2006 1:05:23 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 12:47:59 AM
Posts: 622, Visits: 19,141
I need to import data from a number of XML documents, I looked through the SF namespaces for a function to do this but didn't find anything. I want to makes sure I am not missing it before I do it by hand like I used to do with a reader. Essentially I am looking for VFP's 'cursortoxml'. Do you have something like that I have missed?
Post #2402
Posted 08/23/2006 1:11:49 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
Give this a shot:

Dim loTable As New Data.DataTable()

loTable.ReadXml("C:\MyXmlFile.xml")

Post #2404
Posted 08/23/2006 1:12:43 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
You can do this straight into a business object also by using the CopyDataFrom method.  Use the code I posted previously, then you can load that data table into the business object through the CopyDataFrom method.
Post #2405
Posted 08/23/2006 1:16:08 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 12:47:59 AM
Posts: 622, Visits: 19,141
nice...... ty
Post #2407
Posted 08/23/2006 3:18:36 PM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 12:47:59 AM
Posts: 622, Visits: 19,141
"DataTable does not support schema inference from XML." is what I get when I try your code.

I tried a few difference XML documents.
Post #2414
Posted 08/23/2006 3:36:04 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 10:38:53 PM
Posts: 2,683, Visits: 1,883
You can only read the XML file if it was written to the file using the business object's table.  When the table writes it's data to disk, there is an overload that allows you to tell it that you want to write the schema to file as well.  If you write the schema, then you can read the file and schema back in.


www.bungie.net
Post #2417
Posted 08/23/2006 3:38:10 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 4:58:13 AM
Posts: 4,379, Visits: 4,421
You can get it to work...I have done this on a number of occasions.  First, look at the ReadXmlSchema method on the DataTable.  Second, reverse engineer the WriteXml on the DataTable which has support for the schema.
Post #2418
Posted 08/24/2006 10:43:52 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
Microsoft XSD Inference 1.0
The Microsoft XSD Inference utility is used to create an XML Schema definition language (XSD) schema from an XML instance document. When provided with wellformed XML file, the utility generates an XSD that can be used to validate that XML file. You can also refine the XSD generated by providing the tool more wellformed XML files. The download contains the core library, simple command line utility and the source code.

Package is attached



  Post Attachments 
xsdinference.zip (25 views, 246.79 KB)
Post #2470
Posted 08/25/2006 10:24:59 AM


Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 12:47:59 AM
Posts: 622, Visits: 19,141
Me.OrdersBO.CopyDataFrom(importedorder_datatable)

I get an error because CopyDataFrom thinks the table name is 2 parameters due to the underscore, it works fine if I remove it.

Bug? or does vb.net just not like underscores in tablenames?

I haven't had problems with underscores anywhere else, I generally have always used an underscore in any dynamic table name just as a personal convention, it helps me to identify them as dynamic.

Also CopyDataFrom clears the contents of the current BO, is there something like AppendDataFrom? If not I can do it manually easy enough.

Thanks
Post #2472