473,772 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2 tiny questions

Simple questions that have just been kickin my butt!

Question 1:
Here's the code:

XmlNode node1;
XmlAttribute attribute1;
node1 = this.xmlDoc.Doc umentElement[sectionName];
attribute1 = node1.Attribute s.GetNamedItem( attributeName);

And here's the error:

Cannot implicitly convert type 'string' to 'System.Xml.Xml Attribute'
Question 2:
How do you add those nice comments to a class that get pulled up in
Intellisense?

Thank you,
Sueffel
Nov 16 '05 #1
7 1021
Just for some depth, here's the entire function:

public string GetConfigAttrib ute(string sectionName, string attributeName,
bool createIfNotFoun d)
{
XmlNode node1;
XmlAttribute attribute1;
node1 = this.xmlDoc.Doc umentElement[sectionName];
attribute1 = node1.Attribute s.GetNamedItem( attributeName);
if ((attribute1 == null) && createIfNotFoun d)
{
attribute1 = this.xmlDoc.Cre ateAttribute(at tributeName);
node1.Attribute s.Append(attrib ute1);
this.xmlDoc.Sav e(this.configFi leName);
}
if (attribute1 != null)
{
return attribute1.Valu e;
}
return "";
}

Thanks again,
Sueffel
Nov 16 '05 #2
"Sueffel" <so*****@somewh ere.com> wrote in news:eWtlPx0HEH A.3748
@tk2msftngp13.p hx.gbl:
Question 1:
Here's the code:

XmlNode node1;
XmlAttribute attribute1;
node1 = this.xmlDoc.Doc umentElement[sectionName];
attribute1 = node1.Attribute s.GetNamedItem( attributeName);

And here's the error:

Cannot implicitly convert type 'string' to 'System.Xml.Xml Attribute'
Assuming that the variables like 'sectionName' and so forth are defined
correctly, I get a different error - cannot convert XmlNode to
XmlAttribute. This is expected and you can simply cast the XmlAttribute to
an XmlNode, or define attribute1 as an XmlNode to start with.
Question 2:
How do you add those nice comments to a class that get pulled up in
Intellisense?


Comment the class and functions with /// comments - it will automatically
provide popups.

-mdb
Nov 16 '05 #3
I ended up finding my original source for this sucker, and feel kinda
stupid. Here's the function as it should look:

public string GetConfigAttrib ute(string sectionName, string attributeName,
bool createIfNotFoun d)
{
XmlNode sectionNode = this.xmlDoc.Doc umentElement[sectionName];
XmlAttribute attr = sectionNode.Att ributes[attributeName];
if (attr == null)
{
if (createIfNotFou nd)
{
attr = this.xmlDoc.Cre ateAttribute(at tributeName);
sectionNode.Att ributes.Append( attr);
this.xmlDoc.Sav e(this.configFi leName);
}
}
return (attr == null) ? "" : attr.Value;
}

As for the second question, here's what I have:

/// <summary>
/// Gets the specified Attribute
/// </summary>
/// <param name="sectionNa me">Name of section</param>
/// <param name="attribute Name">name of attribute</param>
/// <param name="createIfN otFound">Create section if it doesn't
exist</param>
/// <returns></returns>

The XML document did make, but I still don't have that info in the
Intellisense window. That's the only reason I'm doing this in C#, otherwise
I'd do it in my native VB.NET.

Otherwise, I just need to figure out why I'm havingmy other error, and I can
re-release this sucker. Funny how finickey things can be.

Thanks again,
Suefffel
Nov 16 '05 #4
Lemme try to be claer, after reading my posts, I think I'm not speaking of
the correct things. basically, when you type String s = New String(
When you type the ( the little box pops up and gives a description of the
peramiters. That's what I'm after.

Thanks again,
Sueffel
Nov 16 '05 #5
Sueffel <so*****@somewh ere.com> wrote:
The XML document did make, but I still don't have that info in the
Intellisense window. That's the only reason I'm doing this in C#, otherwise
I'd do it in my native VB.NET.


To use XML documentation within other solutions, you need to have the
..xml file in the same location as the assembly, and it must have
*exactly* the same name as the assembly itself, but with .xml instead
of .dll at the end. Within the same solution, I *think* it should come
up anyway, even if you don't build the .xml file.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6
Sueffel,
Make sure you have specified the XML Documentation File parameter in the
project Configuration Build properties with the correct xml file name. This
will build the documentation file to be used in other projects. This needs
to be specified for both release and debug builds.

Ron Allen
"Sueffel" <so*****@somewh ere.com> wrote in message
news:uN******** ******@TK2MSFTN GP12.phx.gbl...
I ended up finding my original source for this sucker, and feel kinda
stupid. Here's the function as it should look:

public string GetConfigAttrib ute(string sectionName, string attributeName,
bool createIfNotFoun d)
{
XmlNode sectionNode = this.xmlDoc.Doc umentElement[sectionName];
XmlAttribute attr = sectionNode.Att ributes[attributeName];
if (attr == null)
{
if (createIfNotFou nd)
{
attr = this.xmlDoc.Cre ateAttribute(at tributeName);
sectionNode.Att ributes.Append( attr);
this.xmlDoc.Sav e(this.configFi leName);
}
}
return (attr == null) ? "" : attr.Value;
}

As for the second question, here's what I have:

/// <summary>
/// Gets the specified Attribute
/// </summary>
/// <param name="sectionNa me">Name of section</param>
/// <param name="attribute Name">name of attribute</param>
/// <param name="createIfN otFound">Create section if it doesn't
exist</param>
/// <returns></returns>

The XML document did make, but I still don't have that info in the
Intellisense window. That's the only reason I'm doing this in C#, otherwise I'd do it in my native VB.NET.

Otherwise, I just need to figure out why I'm havingmy other error, and I can re-release this sucker. Funny how finickey things can be.

Thanks again,
Suefffel

Nov 16 '05 #7
I didn't have the name exactly as the assembly name. That problem is fixed.
Once again, thank you all for all your help, it is greatly appreciated.

Sueffel
"Sueffel" <so*****@somewh ere.com> wrote in message
news:uN******** ******@TK2MSFTN GP12.phx.gbl...
I ended up finding my original source for this sucker, and feel kinda
stupid. Here's the function as it should look:

public string GetConfigAttrib ute(string sectionName, string attributeName,
bool createIfNotFoun d)
{
XmlNode sectionNode = this.xmlDoc.Doc umentElement[sectionName];
XmlAttribute attr = sectionNode.Att ributes[attributeName];
if (attr == null)
{
if (createIfNotFou nd)
{
attr = this.xmlDoc.Cre ateAttribute(at tributeName);
sectionNode.Att ributes.Append( attr);
this.xmlDoc.Sav e(this.configFi leName);
}
}
return (attr == null) ? "" : attr.Value;
}

As for the second question, here's what I have:

/// <summary>
/// Gets the specified Attribute
/// </summary>
/// <param name="sectionNa me">Name of section</param>
/// <param name="attribute Name">name of attribute</param>
/// <param name="createIfN otFound">Create section if it doesn't
exist</param>
/// <returns></returns>

The XML document did make, but I still don't have that info in the
Intellisense window. That's the only reason I'm doing this in C#, otherwise I'd do it in my native VB.NET.

Otherwise, I just need to figure out why I'm havingmy other error, and I can re-release this sucker. Funny how finickey things can be.

Thanks again,
Suefffel

Nov 16 '05 #8

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

Similar topics

25
3490
by: Brian Patterson | last post by:
I have noticed in the book of words that hasattr works by calling getattr and raising an exception if no such attribute exists. If I need the value in any case, am I better off using getattr within a try statement myself, or is there some clever implementation enhancement which makes this a bad idea? i.e. should I prefer: if hasattr(self,"datum"): datum=getattr("datum") else: datum=None
20
1893
by: qscomputing | last post by:
Hi, I've developed in several other languages and have recently found Python and I'm trying to use it in the shape of the PythonCard application development tool. My two questions: 1. What is the easiest way to create a for loop in the style I'm used to from Delphi ie:
5
2213
by: Mel | last post by:
i would like to place a tiny image on the top-left corner of all screens and on clicking the image to to http://www.somewhere.com url can you please help ?
7
5893
by: Werner Nussbaumer | last post by:
Hello I am searching for a version of the Tiny C compiler for Windows 32. I downloaded a version from http://fabrice.bellard.free.fr/tcc/ but the make command displayed error messages: P:\DEVELOP\c2\TCC-09~1.20>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 5: Command syntax error Error makefile 13: Command syntax error
7
1378
by: Sueffel | last post by:
Simple questions that have just been kickin my butt! Question 1: Here's the code: XmlNode node1; XmlAttribute attribute1; node1 = this.xmlDoc.DocumentElement; attribute1 = node1.Attributes.GetNamedItem(attributeName);
5
1696
by: iTISTIC | last post by:
Developing a new app and am trying to make this my first truly OOP/3-Tier app. I understand the principles of the presentation, business, and data layers. I do, however, have some questions on where certain functionality should be placed and how some things should be implemented. Let's use a simple example such as an application to manage customer records (customer_id, first_name, last_name). I'd have a Customer business object with ID,...
6
6100
by: Tex | last post by:
I am writting a survey system web application. I am using ASP.Net 2, C# and MS SQL 2005. I am able to store surveys and questions associated to the surveys just fine. The problem I am having is Dynamically creating a survey on a page. I have read some MS articles on dynamic creation of web forms and have been able to create one question on a page. I am not sure how to create a variable amount of different types(radio button lists,...
1
1335
by: hmmmmmm | last post by:
heya, this is actually the first time i visit this forum, but i really wanted to make something.. but i kinda ran out of idea's <_< with html you can 'fill in' forms by just hitting an extern button... ill give an example. <form target='frame1' action="www.site.domain" method="post"> <input type="text" size="3" name="number1" value=""><br> <input type="text" size="3" name="number2" value=""><br>
9
1334
by: Setash | last post by:
I've got a tiny bit of coding background, but its not the most extensive. That said, I'm trying to wrap my head around python and have a couple questions with classes and functions. Two notable questions: 1) Classes. How do you extend classes?
0
5576
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
0
9621
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
9454
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
10106
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...
1
10039
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,...
0
8937
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
6716
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
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
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
3610
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.