# XML Namespace Problem

**URL:** <https://forum.kirupa.com/t/xml-namespace-problem/275983>\
**Category:** programming\
**Created:** [November 20, 2008, 11:01pm UTC](https://forum.kirupa.com/t/xml-namespace-problem/275983 "2008-11-20T23:01:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![YAUN](https://avatars.discourse-cdn.com/v4/letter/y/3ec8ea/32.png) [@YAUN](https://forum.kirupa.com/u/YAUN)\
**Post date:** [November 20, 2008, 11:01pm UTC](https://forum.kirupa.com/t/xml-namespace-problem/275983/1 "2008-11-20T23:01:26Z")

</div>

Hello,  
I’ve got a little WPF app working but only because I modify the xml supplied by the vendor. Here is what they provide:

\<P2Main xmlns:si=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)” xmlns=“urn:schemas-Professional-Plug-in2:ClipMetadata:v3.0”\>

In order to get the app work, I manually edit this to \<P2Main\>

I assume that this is required per

“The root node of the XML data has an **xmlns** attribute that sets the XML namespace to an empty string. This is a requirement for applying XPath queries to a data island that is inline within the XAML page. In this inline case, the XAML, and thus the data island, inherits the [System.Windows namespace. Because of this, you need to set the namespace blank to keep XPath queries from being qualified by the [URL=“http://msdn.microsoft.com/en-us/library/system.windows.aspx”]System.Windows](http://msdn.microsoft.com/en-us/library/system.windows.aspx) namespace, which would misdirect the queries.”

This app does not use a data island getting the xml from an external source.  
Is there any way to “properly form” this “ill formed” xml easily?  
I’ve considered XML Text Reader/Writer, look at Namespace Mapping, thought about making a collection of some kind, but, in the end, do not seem to have a very good solution. Would appreciate some suggestions!  
:bucktooth:
