|
Suppose you have the following to query the rules nodes:
XmlNodeList rulesNodes = myDoc.SelectNodes("//rules");
Then, in order to loop the rule nodes:
foreach (XmlNode rulesNode in rulesNodes)
{
XmlNodeList ruleNodes = rulesNode.SelectNodes("rule");
foreach (XmlNode ruleNode in ruleNodes)
{
....
}
}
Hope this helps.
|
|
|
|
|
Thanks Le Centriste,
For this statement -- "myDoc.SelectNodes("//rules");", XMLDocument class does not contain a method called SelectNodes. Any comments?
regards,
George
|
|
|
|
|
George_George wrote: XMLDocument class does not contain a method called SelectNodes. Any comments?
Yes it does[^]
|
|
|
|
|
Sorry, Le Centriste!
My typo.
regards,
George
|
|
|
|
|
George_George wrote: For this statement -- "myDoc.SelectNodes("//rules");"
How did you created the XMLDocuments?
XmlDocument xmlDoc = new XmlDocument();
Now Check xmlDoc.SelectedNodes() is there or not ?
cheers,
Abhijit
|
|
|
|
|
Thanks Abhijit!
My typo in my code before.
regards,
George
|
|
|
|
|
George_George wrote: XMLDocument class
What XMLDocument class George? You have provided ZERO information about your development environment.
I see this year is going to be like last year with you eh?
led mike
|
|
|
|
|
Thanks led mike,
Found it out.
regards,
George
|
|
|
|
|
Try This one
XPathDocument doc = new XPathDocument(XmlFilePath);
XPathNavigator XPathnav = doc.CreateNavigator();
XPathExpression expr;
expr = XPathnav.Compile("/Abc/rules");
XPathNodeIterator XpathIterator = XPathnav.Select(expr);
try
{
while (XpathIterator .MoveNext())
{
XPathNavigator IteXPathnav= XpathIterator .Current.Clone();
Console.WriteLine("name: " + IteXPathnav.Value);
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
This is For Further Study[^]
cheers,
Abhijit
|
|
|
|
|
Thanks Abhijit,
Your code works good. But it only has one loop, but what I need is a loop inside another loop for the XML structure.
regards,
George
|
|
|
|
|
Please Read These
Ref1[^]
And
Ref2[^]
cheers,
Abhijit
CodeProject.Com MVP
|
|
|
|
|
I created a DLL (class library) on C#.NET (2005) and want
to use it as an ActiveX control on a web page (html).
I have checked the box for Make "assembly COM visible" in the
project properties before I build the DLL. Code does do much,
here is my C# code for ctrl
namespace MyActiveXctrlLib
{
public partial class MyUserCtrl : UserControl
{
public string setName
{
set
{
txtName.Text = value;
}
}
public MyUserCtrl()
{
InitializeComponent();
}
}
}
here is my HTML
<title>Untitled Page
<object id="myControl1" name="myControl1" classid="MyActiveXctrlLib.dll#MyActiveXctrlLib.MyUserCtrl" width="288" height="50">
function doScript()
{
myControl1.setName = frm.txt.value;
}
on button click doScript(); is executed .
it sets the setName property of myControl1 i.e. WinForm control.
this code working successfully on IE 7.0 machine having .NET installed on them
but is not working on Machine those dnt have .NET installed on them.
not checked on IE 6.0.
Thanks in advance .
DaTtA
way2datta@gmail.com
|
|
|
|
|
Dattatraya Kale wrote: Subject: Run .NET ActiveX control on IE 7.0 machine that doesnt have .NET installed.
This is crosspost. You have already put the same question in asp.net forum.
cheers,
Abhijit
|
|
|
|
|
Was it really necessary to spam 5 forums with the same question??
Don't do this again. It's considered very rude and will not get your question answered any faster.
|
|
|
|
|
hello
guys, anyone know how to do mapping file for this? For example:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="ThinkFundamentals.Util.Security.Person, ThinkFundamentals.Util.Security" table="Person">
<id name="Id" column="Id" type="Int64" unsaved-value="0">
<generator class="native" />
</id>
<property name="FirstName" column="FirstName" type="String(50)" />
<property name="MiddleName" column="MiddleName" type="String(50)" />
...
<!-- how to map this to ObjProperties table? -->
<property name="ObjProperties" type="Util.Object" ??? />
</class>
</hibernate-mapping>
There's a table named "ObjProperties", schema for example:
Id int
PersonId int /* references */
PropertyName varchar(50),
PropertyValue varchar(50)
...
And class "Util.Object.ObjProperties" is NOT a collection class, but it contains one.
class ObjectProperties
{
... other properties ...
Hashtable _properties = new HashTable(); << See, that's the property collection.
...
}
I got a feeling this setup is not very nHibernate-friendly?
Thanks!
dev
|
|
|
|
|
public class MainClass
{
public virtual long MainKey {get; set;}
public virtual SubClass SubInstance {get; set;}
public class SubClass
{
public virtual long SubKey {get;set;}
}
}
can be mapped as:
<class name="MainClass" table="Main">
<id name="MainKey" column="MainId" type="Int64">
<generator class="identity" />
</id>
<many-to-one name="SubInstance" class="MainClass+SubClass" Column="SubId"/>
</class>
<class name="MainClass+SubClass" table="Sub">
<id name="SubKey" column="SubId" type="Int64">
<generator class="identity" />
</id>
</class>
So you need to use a plus(+) sign.
(I believe you have to use a dollar ($) sign for this in java hibernate)
|
|
|
|
|
Thanks but you're late (I don't use nHibernate no more!)
(But still thanks and voted 5 for ya)
dev
|
|
|
|
|
Hello everyone,
Support I am using str1 = str2 statement, both str1 and str2 are type of string.
Then, suppose str1 is hold by thread 1 and str2 is hold by thread 2. My question is whether operation (for example, tryu to change content of the string, toupper, tolower, replacement) on str1 (from thread 1) and operaton on str2 (from thread 2) are thread safe?
My idea is it is thread safe, since even if str1 and str2 are pointing to the same string instance, but as string is immutable, i.e. each operation which will change the content of the string will make a new string. So, it is thread safe.
Am I correct?
thanks in advance,
George
|
|
|
|
|
A quick check on MSDN[^] would show you that the string class as a whole is thread safe.
|
|
|
|
|
All operations in string class is thread safe?
regards,
George
|
|
|
|
|
Did you not even look at the link I sent you?!
It definitely isn't definatley
|
|
|
|
|
I read it and it mentions all string operations are thread safe. It makes me surprised, just double check with you.
regards,
George
|
|
|
|
|
I'm sure I should be flattered but given that Microsoft wrote the class, I'd probably believe their documentation over anything I have to say.
It definitely isn't definatley
|
|
|
|
|
Thanks moon_stick,
I agree with the conclusion. My question is about why.
I think the reason why all methods of string class are thread safe is because string is immutable, i.e. when the string is modified, a new instance is created. Agree or?
regards,
George
|
|
|
|
|
Immutable objects are inherently thread safe but it's quite possible for an object to be thread safe without being immutable.
I'm done answering questions on this topic now - go and search on google (thread safety) or MSDN if you want more detail.
It definitely isn't definatley
|
|
|
|