473,386 Members | 1,621 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,386 software developers and data experts.

"'System' denotes a 'namespace' where a 'class' was expected"

I've got two projects, both reference system, system.data and system.xml and
both include the using System.Xml.Serialization and using System at the top
of the file.

Both also include the XmlElementAttribute attribute on some properties as
defined below, but on one project I get the error "'System' denotes a
'namespace' where a 'class' was expected" and the other project I don't.
There highlights the word System on
System.Xml.Schema.XmlSchemaForm.Unqualified and I can't figure out why as
System.Xml.Schema.XmlSchemaForm.Unqualified is an enum, not a namespace.

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
Oct 31 '07 #1
5 3271
Hi Jeremy,

How do you use it? E.g. this works fine:

public class AClass
{
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]

int worksFine;
....
}

Regards, Alex
[TechBlog] http://devkids.blogspot.com

JI've got two projects, both reference system, system.data and
Jsystem.xml and both include the using System.Xml.Serialization and
Jusing System at the top of the file.
J>
JBoth also include the XmlElementAttribute attribute on some
Jproperties as defined below, but on one project I get the error
J"'System' denotes a 'namespace' where a 'class' was expected" and the
Jother project I don't. There highlights the word System on
JSystem.Xml.Schema.XmlSchemaForm.Unqualified and I can't figure out
Jwhy as System.Xml.Schema.XmlSchemaForm.Unqualified is an enum, not a
Jnamespace.
J>
J[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.
JXmlSchemaForm.Unqualified)]
J>

Oct 31 '07 #2
This is a copy past of the code that gets the error:

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string Client_Name;

And this is a copy past of the code that compiles file:

[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string GivenName;

Strange hey? I can't find a difference between the two. This is VS 2003
btw.

"Alex Meleta" <am*****@gmail.comwrote in message
news:15**************************@msnews.microsoft .com...
Hi Jeremy,

How do you use it? E.g. this works fine:

public class AClass
{
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Unqualified)]
int worksFine;
...
}

Regards, Alex
[TechBlog] http://devkids.blogspot.com

JI've got two projects, both reference system, system.data and
Jsystem.xml and both include the using System.Xml.Serialization and
Jusing System at the top of the file.
JJBoth also include the XmlElementAttribute attribute on some
Jproperties as defined below, but on one project I get the error
J"'System' denotes a 'namespace' where a 'class' was expected" and the
Jother project I don't. There highlights the word System on
JSystem.Xml.Schema.XmlSchemaForm.Unqualified and I can't figure out
Jwhy as System.Xml.Schema.XmlSchemaForm.Unqualified is an enum, not a
Jnamespace.
JJ>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.
JXmlSchemaForm.Unqualified)]
J>


Oct 31 '07 #3
Figured it out, its because I had a property called System. I guess I'll
have to rename the property
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.XmlSchemaForm.Unqualified)]

public string System;

"Alex Meleta" <am*****@gmail.comwrote in message
news:15**************************@msnews.microsoft .com...
Hi Jeremy,

How do you use it? E.g. this works fine:

public class AClass
{
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Unqualified)]
int worksFine;
...
}

Regards, Alex
[TechBlog] http://devkids.blogspot.com

JI've got two projects, both reference system, system.data and
Jsystem.xml and both include the using System.Xml.Serialization and
Jusing System at the top of the file.
JJBoth also include the XmlElementAttribute attribute on some
Jproperties as defined below, but on one project I get the error
J"'System' denotes a 'namespace' where a 'class' was expected" and the
Jother project I don't. There highlights the word System on
JSystem.Xml.Schema.XmlSchemaForm.Unqualified and I can't figure out
Jwhy as System.Xml.Schema.XmlSchemaForm.Unqualified is an enum, not a
Jnamespace.
JJ>
[System.Xml.Serialization.XmlElementAttribute(Form= System.Xml.Schema.
JXmlSchemaForm.Unqualified)]
J>


Oct 31 '07 #4
For reference, theoretically you *can* use some tricks (alias, global
namespace, etc) to allow you to have properties called System etc -
but I really, really don't recommend it. Just mentioning for
completeness.

Marc
Nov 2 '07 #5
"Marc Gravell" <ma**********@gmail.comwrote in message
news:Op**************@TK2MSFTNGP02.phx.gbl...
For reference, theoretically you *can* use some tricks (alias, global
namespace, etc) to allow you to have properties called System etc - but I
really, really don't recommend it. Just mentioning for completeness.
Many years ago, when we were first moving our app to .NET, we had a lot of
discussion about what we would do with our "System". We've had this thing
we call a System for close to 20 years and the natural name would be System
but, that caused a lot of consternation. We finally decided to go ahead and
call it System and, we have no regrets. We didn't have to tell our
installed base that "Systems" are now called "Whatevers" and it doesn't
cause as much pain as we feared.

The biggest problem didn't come up until we converted to V2.0 of the
Framework and changed our string resources to use the resource editor in VS
2005, the code generated by the resource editor sticks a "using System;" in
our namespace which causes a collision. If they would just change that to
"using global::System;", life would be good.

I wouldn't say I recommend it but, if it makes sense for you, do it! It
will work, which is a fine testament to the namespace design of the .NET
environment.
Nov 2 '07 #6

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

Similar topics

2
by: Jacek Dziedzic | last post by:
Is it valid to use a "using namespace foo" (as opposed to using foo::bar which I'm sure is legal) within a class declaration? My compiler rejects it, but I've been told it's valid. Can anyone...
3
by: janek | last post by:
I have a question: what differences are between: namespace Mary { int r = 5 ; char m ;
2
by: Pete Hearn | last post by:
Hi For some reason, I cannot type "Using System.Web.Mail" in my ASP.Net app using intellisense. The dot after System offers me Web which I select, then another dot after Web does not put up...
0
by: maxim mat | last post by:
Hi I need to build client for web service. But when I'm using Visual Studio .NET to add Web Reference, I get error: "Custom tool error: Unable to import WebService/Schema. Unable to import...
0
by: kevin_g_frey | last post by:
Hello We have an internal tool that generates a series of .NET class wrappers for accessing our database entities. One of our database entities is called "System" so our correspond __gc class is...
14
by: Ronald S. Cook | last post by:
I'm just curious how you would handle this. In the cable industry, Comcast is referred to as an "MSO" (multiple systems operator) meaning they own many cable systems. Therefore a solution must be...
4
by: Peter Kanurer | last post by:
Assume I add in VisualCSharp 2005 References to Oracle.DataAccess AND System.Data.OracleClient to an application. Does this cause problems or can they co-exist in one application ?
0
by: Schadrach | last post by:
I'm having a strange problem, I have a small executable that runs a backup for a some data nightly, and as of September 22, 2007 it has ceased to function with the following error: Unhandled...
2
by: shalong | last post by:
Hi all, VS 2008 is complaining that HttpWebRequest class is not in System.Net namespace I have referenced System.Net and have coded "using System.Net" I think its a setup problem rather than a...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.