Remove a node like <nom:Hrs/> from xml with vb .net -


i have xml this:

<cfdi:comprobante>    <cfdi:emisor>    </cfdi:emisor>    <cfdi:conceptos>        <cfdi:concepto/>      </cfdi:conceptos>      <cfdi:complemento>        <nomina:nomina dato="21">          <nomina:percepciones>            <nomina:percepcion/>          </nomina:percepciones>          <nomina:incapacidades/>          <nomina:horasextras/>        </nomina:nomina>      </cfdi:complemento>    </cfdi:comprobante>

and need remove nodes:

      <nomina:incapacidades/>       <nomina:horasextras/> 

and attribute dato="21".

i tried next code:

dim doc xdocument = xdocument.load(_xml2) doc.root.element("nomina:incapacidades").remove() doc.root.element("nomina:horasextras").remove() doc.root.element("nomina:nomina").attribute("dato").remove() doc.save(_xml2) 

but not working.

would nice if me.

try this

        doc.descendants.where(function(x) x.name.localname = ("incapacidades")).remove()         doc.descendants.where(function(x) x.name.localname = ("horasextras")).remove()         doc.descendants.where(function(x) x.name.localname = ("nomina")).remove() 

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -