I have an XElement that I need to create using dynamic XML literals / inline expressions, and I need it to inherit the default namespace. This is not possible, although through everything I tried. Does anyone know how to make this work?
for example
Imports <xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
Sub CreateXAML()
Dim obj = "Rectangle"
Dim objFill As String = obj & ".Fill"
Dim myXML As XElement = <<%= obj %>><<%= objFill %>>no namespace</></>
Dim myXML2 As XElement = <Path><Path.Fill>inherits namespace</Path.Fill></Path>
MsgBox(myXML.ToString & vbCrLf & myXML2.ToString)
End Sub
The first myXML,, is not created with default ns, and the second,, myXML2is.
source
share