473,378 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Converting form "{X=12, Y=34}" to a Point

I'm using an xml schema (XSD) that has a point data in it, so when I'm saving
the schema (from memory with values) to an XML file, the point value is saved
in the form of: "{X=12, Y=34}" And that is very good.
Also when I'm loading the XML file with the schema to a DataSet, this
"{X=12, Y=34}" is converted nicely to a point.

I wish to do this same conversion from "{X=12, Y=34}" string pattern to a
point in memory (without XML schema), but I can't find how to.
The Point does not have the Parse method.
I did find the PointConverter.ConvertFrom("12, 34"), but its using a
different string format.

Is there a built in direct way to convert string in the form of "{X=12,
Y=34}" to a Point ?
-----
Thanks
Sharon
Nov 28 '06 #1
4 2131
I have the same problem with PointF.
Actually, the problem with PointF is event worse because there isn't any
equivalent for the PointConverter.

--
Thanks
Sharon
Nov 28 '06 #2
Sorry for the above empty post (-:

I have the same problem with PointF.
Actually, the problem with PointF is event worse because there isn't any
equivalent for the PointConverter.

--
Thanks
Sharon
Nov 28 '06 #3

You could parse it either with Regex or manual string manipulation.
Regex should work fine for this:

(X|Y)=(\d+)

BTW, I wouldn't sondier this "very good" XML or even acceptable if you
have control over the schema. XML should break up the data into all
it's constituent parts so once you've parsed out the XML you don't
have to do any additional parsing/converting/anything. So if you have

<point>{X=12, Y=34}</point>

You'd be a lot better off with

<point x="12" y="34" />

HTH,

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Tue, 28 Nov 2006 03:16:02 -0800, Sharon <Sh*****@newsgroups.nospam>
wrote:
>I'm using an xml schema (XSD) that has a point data in it, so when I'm saving
the schema (from memory with values) to an XML file, the point value is saved
in the form of: "{X=12, Y=34}" And that is very good.
Also when I'm loading the XML file with the schema to a DataSet, this
"{X=12, Y=34}" is converted nicely to a point.

I wish to do this same conversion from "{X=12, Y=34}" string pattern to a
point in memory (without XML schema), but I can't find how to.
The Point does not have the Parse method.
I did find the PointConverter.ConvertFrom("12, 34"), but its using a
different string format.

Is there a built in direct way to convert string in the form of "{X=12,
Y=34}" to a Point ?
-----
Thanks
Sharon
Nov 28 '06 #4
On Tue, 28 Nov 2006 03:16:02 -0800, Sharon <Sh*****@newsgroups.nospam>
wrote:
>I'm using an xml schema (XSD) that has a point data in it, so when I'm saving
the schema (from memory with values) to an XML file, the point value is saved
in the form of: "{X=12, Y=34}" And that is very good.
Also when I'm loading the XML file with the schema to a DataSet, this
"{X=12, Y=34}" is converted nicely to a point.

I wish to do this same conversion from "{X=12, Y=34}" string pattern to a
point in memory (without XML schema), but I can't find how to.
The Point does not have the Parse method.
I did find the PointConverter.ConvertFrom("12, 34"), but its using a
different string format.

Is there a built in direct way to convert string in the form of "{X=12,
Y=34}" to a Point ?
Can't you just convert it manually, just by getting rid of the bits
you don't need? This isn't pretty.. but should work..

string s = "{X=12, Y=34}";
s=s.Replace("{","").Replace("}","").Replace("X="," ").Replace("Y=","");

Then you end up with a string in your required "13,34" format.

Nov 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: L-Soft list server at N.C.T.E. (1.8d) | last post by:
Your message dated Tue, 31 Aug 2004 10:29:34 +0100 with subject "Re: Your document" has been submitted to the moderator of the NEWS list: Seán Dower <sdower@NCTE.IE>.
3
by: Nikola | last post by:
Hi all, I have a problem converting datetime to integer (and than back to datetime). Depending whether the time is AM or PM, same date is converted to two different integer representations,...
1
by: DrTebi | last post by:
Hello, I have the following problem: I used to "encode" my email address within links, in order to avoid (most) email spiders. So I had a link like this: <a...
99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
38
by: Jack Klein | last post by:
Many people, including me, like having hard copy books at hand, along with electronic editions. When I first heard of this book several months ago, I pre-ordered a copy. It arrived from...
3
by: Reney | last post by:
I am using Access Database in my program. The column in the table that I am going to use has date/time value with Medium Time selected. (HH:mm). The program is recording a clock in time to this...
5
by: rocknbil | last post by:
Hello everyone! I'm new here but have been programming for the web in various languages for 15 years or so. I'm certainly no "expert" but can keep myself out of trouble (or in it?) most of the time....
2
by: slinky | last post by:
I'm getting a error when I open my . aspx in my browser... line 34: da.Fill(ds, "Assets") Here's the error and my entire code for this .aspx.vb is below that ... I need some clues as to what is...
6
by: nadeaupn | last post by:
Trying to convert "1.12" to double : Dim MyDouble as double MyDouble = cdbl("1.2") I obtain the following error message : "La conversion de la chaîne "1.2" en type 'Double' n'est pas...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.