Hi All,
I want to make a custom class in c#, which extends System.Xml.XmlN ode class
of BCL.
Now in custom class, I have implement abstract methods of XmlNode class
also. Now when I am trying to run the class it gives an error that
"System.Xml.Xml Node.XmlNode() is inaccessible due to its protection level".
This error comes because XmlNode has not any public constructor. I found
XmlNode has two constructor but both are private or friend (i dont know
exactly).
I also found one MSDN article where it says that "Never derive any class
directly from XmlNode" but its just recommendation.
( http://msdn.microsoft.com/library/de...-us/cpguide/ht
ml/cpconextendingd om.asp)
Though, Microsoft has derived some of BCL classes from base XmlNode, so why
we can not derive?
System.Object
System.Xml.XmlN ode
System.Xml.XmlA ttribute
System.Xml.XmlD ocument
System.Xml.XmlD ocumentFragment
System.Xml.XmlE ntity
System.Xml.XmlL inkedNode
System.Xml.XmlN otation
So i think there must be some way out of this....
So what to do to create a derived class from XmlNode?
I heard that many experts are giving their service in news groups. So please
help me out of this.
I have already derived few of my classes from XmlDocument, XmlElement,
XmlAttribute etc. So i dont want to derive from them but i want to derive
the class from XmlNode it self. Please help me to get the answer...
Thanks in Advance.
Thanking you,
Mahesh Devjibhai Dhola
"Empower yourself...." 5 2138
Unfortunately, you can not derive from System.Xml.XmlN ode, because
the two constructors defined are both internal.
I would like to know in which context you are coming across to be needing to
derive
a class from XmlNode, and what is it that you are trying to achieve?
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Mahesh Devjibhai Dhola" <md*****@hotmai l.com> wrote in message
news:eq******** ******@TK2MSFTN GP12.phx.gbl... Hi All, I want to make a custom class in c#, which extends System.Xml.XmlN ode class of BCL.
Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to run the class it gives an error that "System.Xml.Xml Node.XmlNode() is inaccessible due to its protection level".
This error comes because XmlNode has not any public constructor. I found XmlNode has two constructor but both are private or friend (i dont know exactly).
I also found one MSDN article where it says that "Never derive any class directly from XmlNode" but its just recommendation. (http://msdn.microsoft.com/library/de...-us/cpguide/ht ml/cpconextendingd om.asp)
Though, Microsoft has derived some of BCL classes from base XmlNode, so why we can not derive? System.Object System.Xml.XmlN ode System.Xml.XmlA ttribute System.Xml.XmlD ocument System.Xml.XmlD ocumentFragment System.Xml.XmlE ntity System.Xml.XmlL inkedNode System.Xml.XmlN otation
So i think there must be some way out of this....
So what to do to create a derived class from XmlNode? I heard that many experts are giving their service in news groups. So please help me out of this.
I have already derived few of my classes from XmlDocument, XmlElement, XmlAttribute etc. So i dont want to derive from them but i want to derive the class from XmlNode it self. Please help me to get the answer...
Thanks in Advance.
Thanking you, Mahesh Devjibhai Dhola "Empower yourself...."
Hi Dennis,
Thanking you very much for your reply...
I thought the same thing that i will not be able to derive class from it.
Is there any document which says about its constructors? So i could know...
What is the intention of microsoft not to make it derivable? If Microsoft do
not want to make it derivable then it should declare that class as sealed or
final, not abstract? what is the design aspect behind that?
My real intention is to make my own xml assembly, which in fact is wrapper
of all the System.Xml classes with my own added functionalities in each
classes. I want all those classes but it should be mine not Microsoft. So i
am deriving those classes from System.Xml and making my own custom classes
with the changed class name, and added my own functioanlities in addition to
available facilities of extended class from System.Xml
Can you give me some way?
Thanks in advance....
"Dennis Myrén" <de****@oslokb. no> wrote in message
news:If******** **********@news 2.e.nsc.no... Unfortunately, you can not derive from System.Xml.XmlN ode, because the two constructors defined are both internal.
I would like to know in which context you are coming across to be needing
to derive a class from XmlNode, and what is it that you are trying to achieve?
-- Regards, Dennis JD Myrén Oslo Kodebureau "Mahesh Devjibhai Dhola" <md*****@hotmai l.com> wrote in message news:eq******** ******@TK2MSFTN GP12.phx.gbl... Hi All, I want to make a custom class in c#, which extends System.Xml.XmlN ode class of BCL.
Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to run the class it gives an error that "System.Xml.Xml Node.XmlNode() is inaccessible due to its protection level".
This error comes because XmlNode has not any public constructor. I found XmlNode has two constructor but both are private or friend (i dont know exactly).
I also found one MSDN article where it says that "Never derive any class directly from XmlNode" but its just recommendation.
(http://msdn.microsoft.com/library/de...-us/cpguide/ht ml/cpconextendingd om.asp)
Though, Microsoft has derived some of BCL classes from base XmlNode, so why we can not derive? System.Object System.Xml.XmlN ode System.Xml.XmlA ttribute System.Xml.XmlD ocument System.Xml.XmlD ocumentFragment System.Xml.XmlE ntity System.Xml.XmlL inkedNode System.Xml.XmlN otation
So i think there must be some way out of this....
So what to do to create a derived class from XmlNode? I heard that many experts are giving their service in news groups. So please help me out of this.
I have already derived few of my classes from XmlDocument, XmlElement, XmlAttribute etc. So i dont want to derive from them but i want to
derive the class from XmlNode it self. Please help me to get the answer...
Thanks in Advance.
Thanking you, Mahesh Devjibhai Dhola "Empower yourself...."
Mahesh, Is there any document which says about its constructors? So i could know...
MSDN provides documentation on the .NET Framework SDK.
System.Xml.XmlN ode documentation can be found here: http://msdn.microsoft.com/library/de...classtopic.asp
Also, great software for viewing .NET assemblies is
Lutz Roeder's .NET Reflector.
You should download that. It is free and can be downloaded from here: http://www.aisto.com/roeder/dotnet/
What is the intention of microsoft not to make it derivable? If Microsoft do not want to make it derivable then it should declare that class as sealed or final, not abstract? what is the design aspect behind that?
The reason it is inheritable(not sealed) is it works as a base class
for a number of classes in the system.xml.dll,
including XmlDocument and XmlElement(indi rect via XmlLinkedNode).
I do not know though, why the constructurs are internal rather than
protected.
I guess they do now want anyone to derive XmlNode.
Can you give me some way?
Well, most of the core logic is provided by XmlElement i think.
Maybe you could write your own XmlNode and derive from XmlElement.
Otherwise, i am afraid i really do not have any good advice for you.
Other than, of course, create an actual wrapper not inherited from,
but rather utilizing XmlNode internally.
That will request a great deal of code though.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Mahesh Devjibhai Dhola" <md*****@hotmai l.com> wrote in message
news:uU******** ******@TK2MSFTN GP10.phx.gbl... Hi Dennis, Thanking you very much for your reply... I thought the same thing that i will not be able to derive class from it. Is there any document which says about its constructors? So i could know...
What is the intention of microsoft not to make it derivable? If Microsoft do not want to make it derivable then it should declare that class as sealed or final, not abstract? what is the design aspect behind that?
My real intention is to make my own xml assembly, which in fact is wrapper of all the System.Xml classes with my own added functionalities in each classes. I want all those classes but it should be mine not Microsoft. So i am deriving those classes from System.Xml and making my own custom classes with the changed class name, and added my own functioanlities in addition to available facilities of extended class from System.Xml
Can you give me some way?
Thanks in advance.... "Dennis Myrén" <de****@oslokb. no> wrote in message news:If******** **********@news 2.e.nsc.no... Unfortunately, you can not derive from System.Xml.XmlN ode, because the two constructors defined are both internal.
I would like to know in which context you are coming across to be needing to derive a class from XmlNode, and what is it that you are trying to achieve?
-- Regards, Dennis JD Myrén Oslo Kodebureau "Mahesh Devjibhai Dhola" <md*****@hotmai l.com> wrote in message news:eq******** ******@TK2MSFTN GP12.phx.gbl... > Hi All, > I want to make a custom class in c#, which extends System.Xml.XmlN ode > class > of BCL. > > Now in custom class, I have implement abstract methods of XmlNode class > also. Now when I am trying to run the class it gives an error that > "System.Xml.Xml Node.XmlNode() is inaccessible due to its protection > level". > > This error comes because XmlNode has not any public constructor. I > found > XmlNode has two constructor but both are private or friend (i dont know > exactly). > > I also found one MSDN article where it says that "Never derive any > class > directly from XmlNode" but its just recommendation. > (http://msdn.microsoft.com/library/de...-us/cpguide/ht > ml/cpconextendingd om.asp) > > Though, Microsoft has derived some of BCL classes from base XmlNode, so > why > we can not derive? > System.Object > System.Xml.XmlN ode > System.Xml.XmlA ttribute > System.Xml.XmlD ocument > System.Xml.XmlD ocumentFragment > System.Xml.XmlE ntity > System.Xml.XmlL inkedNode > System.Xml.XmlN otation > > So i think there must be some way out of this.... > > So what to do to create a derived class from XmlNode? > I heard that many experts are giving their service in news groups. So > please > help me out of this. > > I have already derived few of my classes from XmlDocument, XmlElement, > XmlAttribute etc. So i dont want to derive from them but i want to derive > the class from XmlNode it self. Please help me to get the answer... > > Thanks in Advance. > > Thanking you, > Mahesh Devjibhai Dhola > "Empower yourself...." > >
You may also look at the MONO project
which provides an open-source implementation of the entire (well, almost)
..NET Framework:
It can be downloaded from here: http://www.mono-project.com/downloads/
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Dennis Myrén" <de****@oslokb. no> wrote in message
news:a6******** **********@news 2.e.nsc.no... Mahesh,
Is there any document which says about its constructors? So i could know... MSDN provides documentation on the .NET Framework SDK. System.Xml.XmlN ode documentation can be found here: http://msdn.microsoft.com/library/de...classtopic.asp
Also, great software for viewing .NET assemblies is Lutz Roeder's .NET Reflector. You should download that. It is free and can be downloaded from here: http://www.aisto.com/roeder/dotnet/
What is the intention of microsoft not to make it derivable? If Microsoft do not want to make it derivable then it should declare that class as sealed or final, not abstract? what is the design aspect behind that? The reason it is inheritable(not sealed) is it works as a base class for a number of classes in the system.xml.dll, including XmlDocument and XmlElement(indi rect via XmlLinkedNode). I do not know though, why the constructurs are internal rather than protected. I guess they do now want anyone to derive XmlNode.
Can you give me some way? Well, most of the core logic is provided by XmlElement i think. Maybe you could write your own XmlNode and derive from XmlElement.
Otherwise, i am afraid i really do not have any good advice for you. Other than, of course, create an actual wrapper not inherited from, but rather utilizing XmlNode internally. That will request a great deal of code though.
-- Regards, Dennis JD Myrén Oslo Kodebureau "Mahesh Devjibhai Dhola" <md*****@hotmai l.com> wrote in message news:uU******** ******@TK2MSFTN GP10.phx.gbl... Hi Dennis, Thanking you very much for your reply... I thought the same thing that i will not be able to derive class from it. Is there any document which says about its constructors? So i could know...
What is the intention of microsoft not to make it derivable? If Microsoft do not want to make it derivable then it should declare that class as sealed or final, not abstract? what is the design aspect behind that?
My real intention is to make my own xml assembly, which in fact is wrapper of all the System.Xml classes with my own added functionalities in each classes. I want all those classes but it should be mine not Microsoft. So i am deriving those classes from System.Xml and making my own custom classes with the changed class name, and added my own functioanlities in addition to available facilities of extended class from System.Xml
Can you give me some way?
Thanks in advance.... "Dennis Myrén" <de****@oslokb. no> wrote in message news:If******** **********@news 2.e.nsc.no... Unfortunately, you can not derive from System.Xml.XmlN ode, because the two constructors defined are both internal.
I would like to know in which context you are coming across to be needing to derive a class from XmlNode, and what is it that you are trying to achieve?
-- Regards, Dennis JD Myrén Oslo Kodebureau "Mahesh Devjibhai Dhola" <md*****@hotmai l.com> wrote in message news:eq******** ******@TK2MSFTN GP12.phx.gbl... > Hi All, > I want to make a custom class in c#, which extends System.Xml.XmlN ode > class > of BCL. > > Now in custom class, I have implement abstract methods of XmlNode > class > also. Now when I am trying to run the class it gives an error that > "System.Xml.Xml Node.XmlNode() is inaccessible due to its protection > level". > > This error comes because XmlNode has not any public constructor. I > found > XmlNode has two constructor but both are private or friend (i dont > know > exactly). > > I also found one MSDN article where it says that "Never derive any > class > directly from XmlNode" but its just recommendation. > (http://msdn.microsoft.com/library/de...-us/cpguide/ht > ml/cpconextendingd om.asp) > > Though, Microsoft has derived some of BCL classes from base XmlNode, > so > why > we can not derive? > System.Object > System.Xml.XmlN ode > System.Xml.XmlA ttribute > System.Xml.XmlD ocument > System.Xml.XmlD ocumentFragment > System.Xml.XmlE ntity > System.Xml.XmlL inkedNode > System.Xml.XmlN otation > > So i think there must be some way out of this.... > > So what to do to create a derived class from XmlNode? > I heard that many experts are giving their service in news groups. So > please > help me out of this. > > I have already derived few of my classes from XmlDocument, XmlElement, > XmlAttribute etc. So i dont want to derive from them but i want to derive > the class from XmlNode it self. Please help me to get the answer... > > Thanks in Advance. > > Thanking you, > Mahesh Devjibhai Dhola > "Empower yourself...." > >
Thanks a lot Dennis,
1. I read already that MSDN documentation but there is nothing about
XmlNode's constructor. Though i found in dotnet247 site, in which they wrote
that it has 2 private constructor, but i dont believe that it will be
private. http://www.dotnet247.com/247referenc...Node/__members
I will see it using the .Net Reflector you have mentioned.
Thanks for it.
2. I got your point about the reason not to make it sealed...inheri table
3. I will try using XmlElement. and i will see also Mono's source. I think
this is the last option...
Thanking you very much, Dennis for quick and exact answers....
Mahesh
"Dennis Myrén" <de****@oslokb. no> wrote in message
news:a6******** **********@news 2.e.nsc.no... Mahesh,
Is there any document which says about its constructors? So i could
know... MSDN provides documentation on the .NET Framework SDK. System.Xml.XmlN ode documentation can be found here: http://msdn.microsoft.com/library/de...classtopic.asp Also, great software for viewing .NET assemblies is Lutz Roeder's .NET Reflector. You should download that. It is free and can be downloaded from here: http://www.aisto.com/roeder/dotnet/
What is the intention of microsoft not to make it derivable? If Microsoft do not want to make it derivable then it should declare that class as sealed or final, not abstract? what is the design aspect behind that? The reason it is inheritable(not sealed) is it works as a base class for a number of classes in the system.xml.dll, including XmlDocument and XmlElement(indi rect via XmlLinkedNode). I do not know though, why the constructurs are internal rather than protected. I guess they do now want anyone to derive XmlNode.
Can you give me some way? Well, most of the core logic is provided by XmlElement i think. Maybe you could write your own XmlNode and derive from XmlElement.
Otherwise, i am afraid i really do not have any good advice for you. Other than, of course, create an actual wrapper not inherited from, but rather utilizing XmlNode internally. That will request a great deal of code though.
-- Regards, Dennis JD Myrén Oslo Kodebureau "Mahesh Devjibhai Dhola" <md*****@hotmai l.com> wrote in message news:uU******** ******@TK2MSFTN GP10.phx.gbl... Hi Dennis, Thanking you very much for your reply... I thought the same thing that i will not be able to derive class from
it. Is there any document which says about its constructors? So i could know...
What is the intention of microsoft not to make it derivable? If
Microsoft do not want to make it derivable then it should declare that class as
sealed or final, not abstract? what is the design aspect behind that?
My real intention is to make my own xml assembly, which in fact is
wrapper of all the System.Xml classes with my own added functionalities in each classes. I want all those classes but it should be mine not Microsoft.
So i am deriving those classes from System.Xml and making my own custom
classes with the changed class name, and added my own functioanlities in
addition to available facilities of extended class from System.Xml
Can you give me some way?
Thanks in advance.... "Dennis Myrén" <de****@oslokb. no> wrote in message news:If******** **********@news 2.e.nsc.no... Unfortunately, you can not derive from System.Xml.XmlN ode, because the two constructors defined are both internal.
I would like to know in which context you are coming across to be
needing to derive a class from XmlNode, and what is it that you are trying to achieve?
-- Regards, Dennis JD Myrén Oslo Kodebureau "Mahesh Devjibhai Dhola" <md*****@hotmai l.com> wrote in message news:eq******** ******@TK2MSFTN GP12.phx.gbl... > Hi All, > I want to make a custom class in c#, which extends System.Xml.XmlN ode > class > of BCL. > > Now in custom class, I have implement abstract methods of XmlNode
class > also. Now when I am trying to run the class it gives an error that > "System.Xml.Xml Node.XmlNode() is inaccessible due to its protection > level". > > This error comes because XmlNode has not any public constructor. I > found > XmlNode has two constructor but both are private or friend (i dont
know > exactly). > > I also found one MSDN article where it says that "Never derive any > class > directly from XmlNode" but its just recommendation. >
(http://msdn.microsoft.com/library/de...-us/cpguide/ht > ml/cpconextendingd om.asp) > > Though, Microsoft has derived some of BCL classes from base XmlNode,
so > why > we can not derive? > System.Object > System.Xml.XmlN ode > System.Xml.XmlA ttribute > System.Xml.XmlD ocument > System.Xml.XmlD ocumentFragment > System.Xml.XmlE ntity > System.Xml.XmlL inkedNode > System.Xml.XmlN otation > > So i think there must be some way out of this.... > > So what to do to create a derived class from XmlNode? > I heard that many experts are giving their service in news groups. So > please > help me out of this. > > I have already derived few of my classes from XmlDocument,
XmlElement, > XmlAttribute etc. So i dont want to derive from them but i want to derive > the class from XmlNode it self. Please help me to get the answer... > > Thanks in Advance. > > Thanking you, > Mahesh Devjibhai Dhola > "Empower yourself...." > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JustSomeGuy |
last post by:
I need to write an new class derived from the list class.
This class stores data in the list to the disk if an object
that is added to the list is over 1K in size.
What methods of the std stl list class must Ioverride in order for this
to work?
|
by: Julian |
last post by:
I would like to have output from my program to be written to cout as well as
a file. (actually, i want several other output options but this should
explain my problem in the simplest way). I have seen commercial programs
print output to the screen as well as to a log file.
depending on the user and other situations, i might want to turn off one of
the outputs or maybe even both outputs.
so, i want a single line with operator << function...
|
by: Bonj |
last post by:
Hello
Can anyone assist with the following class hierarcy problem?
I have a series of window classes, the object model currently being as such:
Window
/ | \
/ | \
MDIClientWindow | TreeViewWindow
WndProcWindow
/ \
|
by: Microsoft News |
last post by:
Hi all.
Does id() xpath function work in System.XML? I have built dtd, schema, xdr
for a simple xml which includes attributes definded as ID and IDREFS.
Validation is occurring properly for all the types of metadata, but the id()
function applied to the IDREFS attribute allways returns nothing.
I have tried it from xslt and using the XmlNode.selectnodes or
XPathNavigator.Select
nada zilch
|
by: Mahesh Devjibhai Dhola |
last post by:
Hi All,
I want to make a custom class in c#, which extends System.Xml.XmlNode class
of BCL.
Now in custom class, I have implement abstract methods of XmlNode class
also. Now when I am trying to run the class it gives an error that
"System.Xml.XmlNode.XmlNode() is inaccessible due to its protection level".
This error comes because XmlNode has not any public constructor. I found
XmlNode has two constructor but both are private or friend...
| |
by: hex |
last post by:
Hi
I make a class "MyClass" and this clas implements the Interface ICloneable.
I want when I instance an object from MyClass and I call obj.Clone() it
returns an object of MyClass type.
for example:
public class MyClasss : ICloneable
{
public void A();
|
by: erin.sebastian |
last post by:
Hello Everyone,
This is my first attempt at coding using an abstract class and i am
getting an error i can't figure out. Here is the back ground.
I have a project that contains an abstract class, it's namespace is
CIG.Intranet.Commons.User and it has 2 methods in it
public abstract getPropertiesHash (string userName) and
public abstract getPropertiesXml (string userName) adn the class name
is called
CPUser.cs
|
by: John Wilhelm |
last post by:
I'm having a problem in by VB.net 2005 application. When i try to get a node
from my app.config file the node come back with "nothing". The xmldocment
loads OK, but I can't retrive a node. The app.config file is listed below
and the code is listed below that, the line with "-->>" is where i try to
get the node. Can anyone see where I'm going wrong.
A dump of the xmlDocument is listed below the code.
Note: "MyKey" is set to "Reports"
|
by: SpaceMarine |
last post by:
hello,
i am working on a web application w/ UserControls. some of my controls
use the same functionality (an Event they all raise) so it seemed
sensible to place them into a custom base class, and have my
UserControls inherit it.
problem is, when i do this the im no longer able to raise the event in
deriving UserControls. it fails to compile, saying:
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |