Bugs item #1207607, was opened at 2005-05-24 10:55
Message generated for change (Comment added) made by rutgerdijkstra
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1207607&group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Rutger Dijkstra (rutgerdijkstra)
Assigned to: Nobody/Anonymous (nobody)
Summary: NAnt chokes on namespace prefix use

Initial Comment:
If the xml in a build file uses an explicit namespace 
prefix NAnt fails to recognize most of the build file
contents

repro:

<NAnt:project xmlns:NAnt="urn:NAnt-0.85-rc3" 
default="choke">
  <NAnt:target name="choke">
    <NAnt:echo message="you won't see this"/>
  </NAnt:target>  
</NAnt:project>

The project and target tags are processed OK but 
tasks and datatypes are not recognized.
 

----------------------------------------------------------------------

>Comment By: Rutger Dijkstra (rutgerdijkstra)
Date: 2005-05-27 15:28

Message:
Logged In: YES 
user_id=1131474

attached a patch: 
all references to System.Xml.Xml\w+::get_Name()
in NAnt.Core are replaced to use LocalName instead.
[I used ildasm and grep to make sure].

All these changes were either nessecary for explicit prefix 
support or probably desirable (for node names inlined in
Log/Error messages). The only remaining uses of the 'Name'
property of an XmlNode are in NAnt.VSNet and as far as I 
could make out they all address the content of MS project 
files so that seems harmless. 

I ran all unit test with hacked version 
BuildTestBase.CreateFilebasedProject that adds explicit
namespace prefixes and had to add another fix to 
Project.InitializeProjectDocument to get the
IncludeTaskTests to pass. 

Consequently, it is now no
longer nessecary for an included build file to use the same
namespace as the including build.

 

----------------------------------------------------------------------

Comment By: Rutger Dijkstra (rutgerdijkstra)
Date: 2005-05-24 11:36

Message:
Logged In: YES 
user_id=1131474

Cause:

when matching the names of xml elements and attributes with
the nant names of tasks, datatypes and properties thereof, 
most of the code in NAnt.Core uses the XmlNode.Name 
property (which includes the arbitrary prefix) rather than
the XmlNode.LocalName property.

resolution option 1:

replace all references to XmlNode.Name anywhere in the 
source by XmlNode.LocalName (the meaningful part).
This is a nasty job because the error is scattered through the 
entire codebase. Moreover, even if the bug is eliminated from
NAnt.Core, we can't be sure it isn't repeated other parts for 
build elements that do custom xml processing.

resolution option 2:

Load project files in a subclass of XmlDocument that overrides
the Name property of Element and Attributes to yield the 
LocalName instead. This should change nothing else than fix 
the bug since, as far as I have been able to determine, all of
the xml functionality in the libraries uses only the 
combination LocalName+NamespaceUri (as it should).

I'd be happy to supply the sublass.
all of 


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1207607&group_id=31650


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to