?
Solved

Variable name starting with number

Posted on 2008-10-07
4
Medium Priority
?
244 Views
Last Modified: 2013-12-17
I have an XMLRPC server response with a structure. This structure contains a variable which starts with a number at the beginning (for example, <name> 3stooges </name><value><String>John</String></value>).

When i try to declare the variable with 'legal' syntax (for exaple, threeStuges), the XMLRPC library (CookComputing library at XML-PRC.net) throws an exception saying that it can't find the variable with exact name as is in the XMLRPC response.

My experience is that to properly receive the XMLRPC response, i need to define EXACT structure of the response on the VB .Net (on VS2005). I had several XMLRPC calls properly working when i define exact structures. However, this particular structure is throwing exception as i can not define a variable that starts with a number.

How do i get around this issue of defining a variable (string) that starts with a number. Any help will be greatly appreciated.
0
Comment
Question by:my_Qn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Expert Comment

by:ladarling
ID: 22662900
You will most likely need to investigate and request help from the XML source provider. None of the mainstream programming languages will allow you to begin a variable name with a number literal. (C++, C#, VB, Java, among others), as I am sure you already know.
Having a transaction that requires an illegally formed structure variable pretty much 'breaks' support for those languages. If the provider wants to expose their data to the programming world at large, they need to change it to respect naming rules.
 
0
 

Author Comment

by:my_Qn
ID: 22663614
Thanks.

Its not going to be feasible to change the XMLRPC service provider as this service is used by several VC++ 6.0 applications successfully. To my surprise, VC++ 6.0 did allow me to declare the CString to begin with a number...

0
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22670714
if i look at your xml returned from your XMLRPC
<name> 3stooges </name><value><String>John</String></value>
3stooges is not a variable
the variable was name and 3stooges was the value of name

if we have a property as defined below
public string name
{
   get { return m_Name; }
   set { m_Name = value; }
}

when we serliaze the  C# object to XML and that class contains the above given property then it will be serialized as below
<ClassName><name>Value what is assigned to name</name></ClassName>
0
 

Accepted Solution

by:
my_Qn earned 0 total points
ID: 22670872
Thanks. But the 3stooges IS the variable name.

I figured a way to get around this problem. CookComputing XMLRPC library (www.xml-rpc.net) gives an solution for such issues. It has a built-in XmlRpcResponseStruct that can be used to receive any type of response from the server. We can programatically parse this struct with key and get the value of the parameter.

Its syntax appears as follows

Dim threeStooges as String = myXmlRpcResponseStruct.Items("3stooges")

This dumps the value of 3stooges from the xmlrpc server response in to the variable threeStooges.

It took a lot of trail and error investgation, but now things work as expected.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question