Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)



Andrus <kobruleht2@xxxxxx> wrote:
No. From the docs for XmlDocument.SelectNodes:

<quote>
An XmlNodeList containing a collection of nodes matching the XPath
query. The XmlNodeList should not be expected to be connected "live" to
the XML document. That is, changes that appear in the XML document may
not appear in the XmlNodeList, and vice versa.
</quote>

As I understand, this code may work in some cases and in some other cases
(like using other data or other version of .NET) it may cause exception.

Yes. In other words, you shouldn't depend on it working either way.

Why .NET allows to use such broken code ?

I don't see it as being particularly broken.

Has java 6 also such kind on desing flaw or is it better designed ?

There are many ways in which .NET is better designed than Java. There
are a few examples the other way round, of course, but generally I
prefer the design of .NET.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
.



Relevant Pages

  • Using XPath to copy nodes
    ... private Element getAnswers(Element root, String queID) throws ... XPath xpath = factory.newXPath; ... //Design the query to search through the XML Document ...
    (comp.lang.java.programmer)
  • Using XPath to copy nodes
    ... private Element getAnswers(Element root, String queID) throws ... XPath xpath = factory.newXPath; ... //Design the query to search through the XML Document ...
    (comp.lang.java.programmer)
  • Re: Why this code does not cause error in .NET 2 & 3.5 (bug?)
    ... An XmlNodeList containing a collection of nodes matching the XPath ... query. ... changes that appear in the XML document may ... Why .NET allows to use such broken code? ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Multiply qty of filtered records
    ... If you should want to try doing this with a query (which is probably the more ... etc in the bottom part of the design view. ... I do know how to get this information in a Report, ... Dim rs As DAO.Recordset ...
    (microsoft.public.access.modulesdaovba)
  • Re: Query Design View is Slow to Open
    ... same query takes about 20 minutes to open in datasheet view. ... took only seconds to open in both design view and datasheet view. ... The troublesome queries are based entirely on local tables (i.e. no ... HOUSEHOLD_PersonalInfo opens slowly in design ...
    (comp.databases.ms-access)

Loading