Click here to Skip to main content
15,891,431 members
Home / Discussions / C#
   

C#

 
QuestionObject Reference not Set an instance of an object while Querying the 2003 Active Directory Pin
Zach198315-Apr-07 17:28
Zach198315-Apr-07 17:28 
AnswerRe: Object Reference not Set an instance of an object while Querying the 2003 Active Directory Pin
Luc Pattyn16-Apr-07 4:10
sitebuilderLuc Pattyn16-Apr-07 4:10 
GeneralRe: Object Reference not Set an instance of an object while Querying the 2003 Active Directory Pin
Zach198316-Apr-07 8:27
Zach198316-Apr-07 8:27 
GeneralRe: Object Reference not Set an instance of an object while Querying the 2003 Active Directory Pin
Luc Pattyn16-Apr-07 8:58
sitebuilderLuc Pattyn16-Apr-07 8:58 
QuestionRe: Object Reference not Set an instance of an object while Querying the 2003 Active Directory Pin
Zach198318-Apr-07 10:13
Zach198318-Apr-07 10:13 
QuestionRe: Object Reference not Set an instance of an object while Querying the 2003 Active Directory Pin
Zach198318-Apr-07 10:22
Zach198318-Apr-07 10:22 
AnswerRe: Object Reference not Set an instance of an object while Querying the 2003 Active Directory Pin
Luc Pattyn18-Apr-07 14:04
sitebuilderLuc Pattyn18-Apr-07 14:04 
QuestionHelp selecting xml nodes Pin
drifters15-Apr-07 17:02
drifters15-Apr-07 17:02 
Hi,
I am suppose to read XML files and extract some data from certain nodes based on its attribute. What I have done is to use XmlTextReader and loop through, using select case and hardcode (inefficient and poor practice) the nodes to be extracted. I have used XmlTextReader instead of XmlDocument initially as I would not be needing Xpath. Now, I would like to know if there are ways to select the nodes based on part of its attribute name like using wildcards. I have tried using Xpath but no success. Essentially, I want to select all the nodes with attributes beginning with a certain string eg) Wanted[…., regardless of the remaining text in the attribute name field.
Can anybody please kindly point to me how to go about doing it if possible? Any advice will be greatly appreciated.

Below are sample of my code and xml file.

reader = new XmlTextReader(link);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name == "A") //To select some nodes w/o attributes
{…. }
if (reader.MoveToFirstAttribute()) {
switch (reader.GetAttribute(0)) //To select somes nodes based on attributes.
{
case "Wanted[zxx]":

break;
case "Wanted[yyy]":


default:
break;
….

- <Root>
<A>XXX</A>
….
- <Elements>
<Element name="Num">XXX</Element>
<Element name="xxx">xxx</Element>
<Element name="B1">1424</Element>
<Element name="Unwanted1">xxx</Element>
<Element name="Unwanted2">xxx</Element>
<Element name="Wanted[XXX]">xxx</Element>
<Element name="Wanted[YYY]">xxx</Element>
<Element name="Wanted[ZZZ]">xxx</Element>
</Elements>
</Root>

AnswerRe: Help selecting xml nodes Pin
Christian Graus15-Apr-07 17:36
protectorChristian Graus15-Apr-07 17:36 
GeneralRe: Help selecting xml nodes Pin
drifters15-Apr-07 17:42
drifters15-Apr-07 17:42 
QuestionWindow Focus Pin
dirkwilliams15-Apr-07 16:03
dirkwilliams15-Apr-07 16:03 
AnswerRe: Window Focus Pin
Luc Pattyn15-Apr-07 23:16
sitebuilderLuc Pattyn15-Apr-07 23:16 
QuestionQuestion about detecting mouse click using? Pin
Khoramdin15-Apr-07 15:31
Khoramdin15-Apr-07 15:31 
AnswerRe: Question about detecting mouse click using? Pin
Christian Graus15-Apr-07 16:54
protectorChristian Graus15-Apr-07 16:54 
GeneralRe: Question about detecting mouse click using? Pin
Khoramdin16-Apr-07 6:29
Khoramdin16-Apr-07 6:29 
QuestionmyCommand.SelectCommand.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar, 1)); Pin
swjam15-Apr-07 14:09
swjam15-Apr-07 14:09 
AnswerRe: myCommand.SelectCommand.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar, 1)); Pin
Christian Graus15-Apr-07 15:19
protectorChristian Graus15-Apr-07 15:19 
QuestionSave Mesh data to a .X file Pin
max2929715-Apr-07 13:06
max2929715-Apr-07 13:06 
AnswerRe: Save Mesh data to a .X file Pin
Judah Gabriel Himango16-Apr-07 10:11
sponsorJudah Gabriel Himango16-Apr-07 10:11 
QuestionHow to read data from external application? Pin
loony123415-Apr-07 12:49
loony123415-Apr-07 12:49 
AnswerRe: How to read data from external application? Pin
Judah Gabriel Himango16-Apr-07 10:16
sponsorJudah Gabriel Himango16-Apr-07 10:16 
GeneralRe: How to read data from external application? Pin
loony123416-Apr-07 13:28
loony123416-Apr-07 13:28 
Questioncrystal reports problem Pin
kifahhk15-Apr-07 12:38
kifahhk15-Apr-07 12:38 
AnswerRe: crystal reports problem Pin
phantanagu15-Apr-07 20:29
phantanagu15-Apr-07 20:29 
QuestionCreating RSS Reader Using New Windows RSS Platform Pin
William Spencer15-Apr-07 12:24
William Spencer15-Apr-07 12:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.