Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
hack to ensure filter namespace is in scope (needs fixing on provider) (
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarle Pedersen authored May 16, 2019
1 parent 5e61db3 commit 432444c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CORESubscriber/Changelog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,31 @@ private static XDocument SetTransactionValues(XElement transaction)

transaction.SetAttributeValue("version", "2.0.0");

AddNamespaceForReplace(transaction);

var xTransaction = new XDocument(transaction);

File.WriteAllText($"{Config.DownloadFolder}/lastTransaction.xml", xTransaction.ToString());

return xTransaction;
}

private static void AddNamespaceForReplace(XContainer transaction)
{
foreach (var replace in transaction.Elements(XmlNamespaces.Wfs + "Replace"))
{
var firstDescendant = replace.Descendants().First();
var nameSpace = firstDescendant.Name.Namespace;
var namespaceAttribute =
new XAttribute(XNamespace.Xmlns + firstDescendant.GetPrefixOfNamespace(nameSpace),
nameSpace.NamespaceName);

if(replace.Attributes().Any(a => a.IsNamespaceDeclaration && a.Value == nameSpace.NamespaceName)) continue;

replace.Add(namespaceAttribute);
}
}

private static void Send(XNode transactionDocument)
{
using (var client = new HttpClient())
Expand Down

0 comments on commit 432444c

Please sign in to comment.