473,663 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Convert .NET type to XSD type

2 New Member
Hi,

I am creating schema programatically and I would need a method to convert .NET type to XSD type so that I could pass on the type string to XMLQualifiedNam e class.

For example, I would need "string" for "System.Str ing" , "time" for "System.DateTim e"

Is there any utility existing for doing this ?

thanks
skt
Jul 5 '07 #1
3 1837
Dököll
2,364 Recognized Expert Top Contributor
Hi,

I am creating schema programatically and I would need a method to convert .NET type to XSD type so that I could pass on the type string to XMLQualifiedNam e class.

For example, I would need "string" for "System.Str ing" , "time" for "System.DateTim e"

Is there any utility existing for doing this ?

thanks
skt
I hope I understood you right, skt05001!

Have a look here: http://www.w3schools.com/schema/schema_dtypes_date.asp
Jul 5 '07 #2
skt05001
2 New Member
I hope I understood you right, skt05001!

Have a look here: http://www.w3schools.com/schema/schema_dtypes_date.asp
This document only explains about the valid schema for datetime. But my question is about the mapping between .NET type to XSD type. I need a function something like this :


public string nettype2xsdtype (Type nettype)
{
}

If I give 'System.String' type, I should get "string" - if I give "System.DateTim e" type, I should get 'time'....

Is there any way to do this ?

thx
Jul 5 '07 #3
Dököll
2,364 Recognized Expert Top Contributor
This document only explains about the valid schema for datetime. But my question is about the mapping between .NET type to XSD type. I need a function something like this :

Expand|Select|Wrap|Line Numbers
  1. public string nettype2xsdtype(Type nettype)
  2. {
  3. }
  4.  
If I give 'System.String' type, I should get "string" - if I give "System.DateTim e" type, I should get 'time'....

Is there any way to do this ?

thx
My apologies, I missed that. I thought you needed help with a schema. I will forward to the .NET forum for better help there.

In a bit!
Jul 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

19
7271
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below. Specifically, I have a problem with this portion in the WHERE clause: DATEADD(Day,tblMyEventTableName.ReminderDays, @DateNow) Between CONVERT(smalldatetime,str(DATEPART(Month, @DateNow)+1) + '/' + str(DATEPART(Day, tblMyEventTableName.TaskDateTime)) + '/'...
1
5653
by: phancey | last post by:
I am trying to invoke a web service method dynamically. I have created a generic function that takes a method name, string of parameters and calls the web method using System.Reflection: MethodInfo mi = proxyInstance.GetType().GetMethod(methodName); object paramsArray = (object)methodParams.ToArray(typeof(object)); object result = mi.Invoke(proxyInstance, paramsArray); where methodParams is an array of parameters where the value...
4
3619
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is of the type the object is instantiated with. In my test program I have Option<std::string> and Option<long>. Here's the code for OptionBase and Option along with a small helper function. In the code are comments describing my problem, look closely...
4
17675
by: Ken Varn | last post by:
I have an unknown numeric Type object passed into a function. I want to run a conversion on a string to convert the string to that Type object and return an object of that type. Is there some way to do a generic cast or conversion on the type? Here is sort of what I want to do: object MyFunc(Type T, String Str) { object o;
7
30775
by: Jim Bancroft | last post by:
Hi everyone, A basic one here, I think. I haven't found the pattern yet, but sometimes when I cast a variable to another type using the "C" style cast operator the compiler refuses to play along. It says it's an invalid cast. However, if I use the Convert.ToInt32() method (for example) things will work. At least, that's how it appears to me. Could someone explain when to use old-style parenthesized casts vs. the Convert() methods?
3
8737
by: mrajanikrishna | last post by:
Hi Friends, I am accepting a number from the user entered in a textbox. I want to assign to a variable in my code and assignt this to that variable. double num1 = (double)txtNum1.text; this produced an error
7
16672
by: groups | last post by:
This is my first foray into writing a generic method and maybe I've bitten off more than I can chew. My intent is to have a generic method that accepts a value name and that value will be returned from the source. My first attempt was as follows; (please ignore that error handling is not present in this example) public T GetValue<T(string objName) { T results;
19
14781
by: tshad | last post by:
I have a value in my sql table set to tinyint (can't set to bit). I am trying to move it into a boolean field in my program and have tried: isTrue = (int)dbReader and isTrue = Convert.ToBoolean((int)dbReader)
9
17534
by: Marco Nef | last post by:
Hi there I'm looking for a template class that converts the template argument to a string, so something like the following should work: Convert<float>::Get() == "float"; Convert<3>::Get() == "3"; Convert<HelloWorld>::Get() == "HelloWorld"; The reason I need this is that in our design every class of a certain
0
10753
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
8436
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8771
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5657
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.