Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2004

Tip: Looking for answers? Try searching our database.

Problem in deriving class from XmlNode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mahesh Devjibhai Dhola - 15 Oct 2004 08:38 GMT
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 (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/default.asp?url=/library/en-us/cpguide/ht
ml/cpconextendingdom.asp)

Though, Microsoft has derived some of BCL classes from base XmlNode, so why
we can not derive?
System.Object
  System.Xml.XmlNode
     System.Xml.XmlAttribute
     System.Xml.XmlDocument
     System.Xml.XmlDocumentFragment
     System.Xml.XmlEntity
     System.Xml.XmlLinkedNode
     System.Xml.XmlNotation

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...."
Cowboy (Gregory A. Beamer) - MVP - 15 Oct 2004 19:05 GMT
The class is internal, so it appears you will have to compile your code into
the System.XML assembly, which is not going to happen. Not sure if you can
implement the System.Xml namespace as your namepace and get around this, but
I would bet no.

I do not understand the need for a custom node, as you would be very likely
to end up with non W3C standard XML.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

> Hi All,
> I want to make a custom class in c#, which extends System.Xml.XmlNode class
[quoted text clipped - 39 lines]
> Mahesh Devjibhai Dhola
> "Empower yourself...."

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.