-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.Web.XmlTransform.XmlNodeException: No element in the source document matches #6
Comments
when I remove the namespace from base.xml , <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="test20180421" value="1" />
<add key="test20180422" value="2" />
</appSettings>
</configuration> then the patch generated as following <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="test20180423" value="3" xdt:Transform="InsertBefore(/configuration/appSettings/add[(@key='test20180422')])" />
</appSettings>
</configuration> and there is no problem to apply source. I am not sure if this is a bug in this repository or just bug from |
Hi @chucklu Unfortunately, I wasn't able to reproduce the error you described. It could be related to the version of I did however get a different error when I pasted your example into https://fatantelopetester.apphb.com to generate a patch. The error was related to the XML namespace on the node in base.xml: I removed the namespace and generated a patch, and then applied the patch using the FatAntelope.exe command line tool, and it correctly applied the patch. So I suggest removing the XML namespace and trying again as it might be reason for the issue. Cheers, |
Hi @CameronWills , The workaround about remove the namespace I have found that, but that's weird.
Actually I can encounter the same exception everytime. |
I know this is quite old. I've picked up this and I'm encountering the same problem. Though in my case it's I'm not sure why it's occurring since XPath supports this syntax. Changing the index to a lower or higher number doesn't change the error. Updated the XDT nuget to 3.1.1 but no luck there either. To get around this, instead of calling "InsertAfter(xyz)", I changed it to just "Insert". This solves my problem but means that I have to manually check my transformations to avoid this occurring during deployments. |
@agility-matth Finally I give up to upgrade the config file through the library, because there are some custom setting in client's config file. |
That sounds like an interesting idea. I’ll see if I can do a similar
approach since our situations are similar. Thanks!
|
@agility-matth are you able to provide the source & target files? Or at least just the |
Sure thing @CameronWills , I'll see what I can do early next week and send it over. |
Hi,
I have two xml files
base.xml
target.xml
I got the patch.xml as following
when I try to apply the source, I got the exception
The text was updated successfully, but these errors were encountered: