Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Database / XML / Reporting Topics include: ADO.NET, SQL, XML structures and schemas, Crystal Reports, and other reporting tools

Enjoy an ad free experience by logging in. Not a member yet? Register.
Go Back  Xtreme .NET Talk > > > Co÷rdinates after XML to dataset


Reply
 
Thread Tools Display Modes
  #1  
Old 06-16-2014, 10:08 AM
Lexus Lexus is offline
Newcomer
 
Join Date: Apr 2008
Posts: 2
Lexus is on a distinguished road
Default Co÷rdinates after XML to dataset



In my sample XML the object is "ZB". That "ZB" has two points, "AAD" and "AAG". Both points have co÷rdinates, devided by the "|" character. This is a fixed format, I have to deal with it.

Because in our software, we use the data in a dataset. So we convert the XML tot a dataset with the command:
Code:
Dim myDS As DataSet
Dim fsReadXml As New System.IO.FileStream(myXMLFile, System.IO.FileMode.Open)
myDS.ReadXml(fsReadXml)
After that, I have 4 tables in my dataset:
  • ZB
  • AAE
  • AAG
  • point

Automaticly there are relations and hidden id's added. After that, I connect 2 datagrids with this code. One datagrid with all objects and the second grid shows me the co÷rdinates of the selected object in datagrid 1:
Code:
            Dim myBS As New BindingSource
            myBS.DataSource = myDS

            DataGridView1.DataSource = myBS
            DataGridView1.DataMember = "ZB"

            DataGridView2.DataSource = myBS
            DataGridView2.DataMember = "ZB.ZB_AAE.AAE_point"
So far so good, everything works fine!

I can databind labels or other textboxes to the point, after clicking a "ZB" object. Its with this code:
Code:
            TextBox1.DataBindings.Clear()
            TextBox1.DataBindings.Add(New Binding("text", myBS, "ZB.ZB_AAG.AAG_point.pos"))
What do I want?
I want the objects and co÷rdinates in one datagrid. So I want to create a view, adding a custom column, and see the results back in a datagrid.

I tried the following. All commented lines I tried. I can't find the proper way to build a expression so the co÷rdinates were shown:
Code:
Dim Test As DataColumn = myDS.Tables("ZB").Columns.Add("test", GetType(String))
Test.Expression = "ZB.ZB_AAE.AAE_point"
        'Test.Expression = "Child(ZB.ZB_AAE).point"
        'Test.Expression = "Child(ZB_AAE).point"
        'Test.Expression = "Child(point)"
        'Test.Expression = "Child(pos)"
        'Test.Expression = "ZB_AAE.point"
        'Test.Expression = "ZB.ZB_AAE.point.pos"
        'Test.Expression = "point"
        'Test.Expression = "point.pos"
        'Test.Expression = "Parent.ZB_AAE.AAE_point.pos"
        'Test.Expression = "Parent(ZB_AAE).AAE_point"
        'Test.Expression = "Parent.ZB"
        'Test.Expression = "ZB_AAE.AAE_point.pos"
        'Test.Expression = "Child.ZB_AAE.point.pos"
You can use this XML to test:
Code:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<!-- File Header -->
<DATA xmlns:nl= "http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="file:EN13508.xsd" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:gml="http://www.opengis.net/gml">
<ZB>
<AAA>AAA</AAA>
<AAD>1</AAD>
<AAE>
<gml:point srsName="Netherlands-RD" srsDimension="2">
<gml:pos>123|456</gml:pos>
</gml:point>
</AAE>
<AAF>2</AAF>
<AAG>
<gml:point srsName="Netherlands-RD" srsDimension="2">
<gml:pos>234|567</gml:pos>
</gml:point>
</AAG>
</ZB>
<ZB>
<AAA>AAA</AAA>
<AAD>3</AAD>
<AAE>
<gml:point srsName="Netherlands-RD" srsDimension="2">
<gml:pos>345|678</gml:pos>
</gml:point>
</AAE>
<AAF>4</AAF>
<AAG>
<gml:point srsName="Netherlands-RD" srsDimension="2">
<gml:pos>456|789</gml:pos>
</gml:point>
</AAG>
</ZB>
</DATA>

Last edited by Lexus; 06-16-2014 at 10:27 AM. Reason: Layout issues through XML text
Reply With Quote
Reply

Bookmarks

Tags
databinding, datagrid, dataset, expression, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ImportRow from one dataSet to table of another dataset ga_gandhi Database / XML / Reporting 0 03-24-2009 11:31 PM
What is the Most Efficient Way to copy a table in a dataset to another dataset gprabaka General 1 10-03-2006 02:46 PM
Dataset BindingContext problem (can not add new row to dataset correctly) sercanparlak Database / XML / Reporting 2 05-03-2006 12:20 AM
Updating Dataset and updating dataset to database mcerk Database / XML / Reporting 1 12-12-2004 06:04 AM
how to use dataset Danychris Database / XML / Reporting 2 12-22-2003 12:40 PM

Advertisement:







Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset
 
Co÷rdinates after XML to dataset
Co÷rdinates after XML to dataset