title: Is there any way write representation class inherited from xmlelement for specific xmlelement? (Or what is the best way?)
body: <p>I'm tring to write a class which is inherited from xmlelement and this class going to specify a specific node in XML.</p>
  <p>XML file like this</p>
  <pre><code>&lt;Data id=&quot;01&quot;&gt;
    &lt;Obj class=&quot;class1&quot; dist=&quot;dist1&quot;&gt;
          &lt;parameter name=&quot;Measurement&quot;&gt;1min&lt;/parameter &gt;
          &lt;parameter name=&quot;mt&quot;&gt;0&lt;/parameter &gt;
    &lt;/Obj &gt;
    &lt;Obj class=&quot;class2&quot; dist=&quot;dist2&quot;&gt;
          &lt;parameter name=&quot;Interval&quot;&gt;0&lt;/parameter &gt;
          &lt;parameter name=&quot;Th&quot;&gt;6&lt;/parameter &gt;
    &lt;/Obj &gt;
  &lt;/Data&gt;
  </code></pre>
  <p>And my representation like this</p>
  <pre><code>class CDataObject : XmlElement
  {
       ...
        protected internal CDataObject(string prefix, string localName = &quot;Obj&quot;, string? namespaceURI, XmlDocument doc) : base(prefix, localName, namespaceURI, doc){}
       ...
        public static CDataObject findObject(XmlDocument doc,string objClass, string objDist)
      {
       ...
       return doc.DocumentElement.SelectSingleNode(xpath) as CDataObject;// this is return null
      }  
       ...
  }
  </code></pre>
  <p>But I could not get directly XmlElement as CDataObject.(For exemple  findObject function) My node name is constant( &quot;Obj&quot; node). Only attribute(class and dist) values mutable. I know, parent class cannot cast to derived class. So I couldn't beat this, is there any advice for me.</p>
  <p>PS: I already represent xml file with xmldocument inhetance and I can access, manipulate any node.  But I could not represent specific xmlelement with inheritance.</p>