Estou usando um namespace no momento que crio meu xml, porém o 'xmlns' também está aparecendo na tag abaixo da raiz, isso está me prejudicando, como posso fazer para o 'xmlns' ficar apernas na tag root(TLote_GNRE)? Segue o código:
Dim xDoc As New XDocument(New XDeclaration("1.0", "utf-8", Nothing))
Dim nS As XNamespace = "http://www.gnre.pe.gov.br"
Dim xGuias As XElement = New XElement("guias")
xDoc.Add(New XElement(nS + "TLote_GNRE", xGuias))
Dim sw As New StringWriter()
Dim xWrite As XmlWriter = XmlWriter.Create(sw)
xDoc.Save(xWrite)
xWrite.Close()
xDoc.Save("C:\xml.xml")
XML saída:
<?xml version="1.0" encoding="UTF-8"?>
<TLote_GNRE xmlns="http://www.gnre.pe.gov.br">
<guias xmlns=""/>
</TLote_GNRE>