Add prefixed Nodes to a specific prefixed child Node C#



I'm stuck making a huge XML and trying to add prefixed Nodes to a specific prefixed nodes.


I have tried to use


srcXML.Element("importManifest").Element("cargaDes").Add( from el in NewNode.Elements() select el)


without luck.


I have this:



<soapenv:Body>
<web:importManifest>
<web:cargaDes>
<web:ArrayPallet>
<web:boxes>
<web:Color>color</web:Color>
<web:Commodity>Comm</web:Commodity>
<web:CustomerBrand>Brand</web:CustomerBrand>
<web:CustomerReference>CusReference</web:CustomerReference>
<web:FolioClient>FolioClient</web:FolioClient>
<web:FolioFisico>FolioFis</web:FolioFisico>
<web:Grower>Grw</web:Grower>
<web:OriginOfPackage>OriofPack</web:OriginOfPackage>
<web:PalletFolio>PalletFolio</web:PalletFolio>
<web:PlaceOfOrigen>PlaceOrig</web:PlaceOfOrigen>
<web:Presentation>Presenta</web:Presentation>
<web:QuantityOfBoxes>QtyBoxes</web:QuantityOfBoxes>
<web:Size>size</web:Size>
</web:boxes>
<web:ManifestFolio>ManFolio</web:ManifestFolio>
<web:PalletFolio>PalletFolio2</web:PalletFolio>
</web:ArrayPallet>
</web:cargaDes>
</web:importManifest>


I want This:



<soapenv:Body>
<web:importManifest>
<web:cargaDes>
<web:ArrayPallet>
<web:boxes>
<web:Color>color</web:Color>
<web:Commodity>Comm</web:Commodity>
<web:CustomerBrand>Brand</web:CustomerBrand>
<web:CustomerReference>CusReference</web:CustomerReference>
<web:FolioClient>FolioClient</web:FolioClient>
<web:FolioFisico>FolioFis</web:FolioFisico>
<web:Grower>Grw</web:Grower>
<web:OriginOfPackage>OriofPack</web:OriginOfPackage>
<web:PalletFolio>PalletFolio</web:PalletFolio>
<web:PlaceOfOrigen>PlaceOrig</web:PlaceOfOrigen>
<web:Presentation>Presenta</web:Presentation>
<web:QuantityOfBoxes>QtyBoxes</web:QuantityOfBoxes>
<web:Size>size</web:Size>
</web:boxes>
<web:ManifestFolio>ManFolio</web:ManifestFolio>
<web:PalletFolio>PalletFolio2</web:PalletFolio>
</web:ArrayPallet>

<web:ArrayPallet>
<web:boxes>
<web:Color>color</web:Color>
<web:Commodity>Comm</web:Commodity>
<web:CustomerBrand>Brand</web:CustomerBrand>
<web:CustomerReference>CusReference</web:CustomerReference>
<web:FolioClient>FolioClient</web:FolioClient>
<web:FolioFisico>FolioFis</web:FolioFisico>
<web:Grower>Grw</web:Grower>
<web:OriginOfPackage>OriofPack</web:OriginOfPackage>
<web:PalletFolio>PalletFolio</web:PalletFolio>
<web:PlaceOfOrigen>PlaceOrig</web:PlaceOfOrigen>
<web:Presentation>Presenta</web:Presentation>
<web:QuantityOfBoxes>QtyBoxes</web:QuantityOfBoxes>
<web:Size>size</web:Size>
</web:boxes>
<web:ManifestFolio>ManFolio</web:ManifestFolio>
<web:PalletFolio>PalletFolio2</web:PalletFolio>
</web:ArrayPallet>

</web:cargaDes>
</web:importManifest>


Hope you can help me, many thanks!


No comments:

Post a Comment