In for each i try this: DeserXml.Element(“CU_DOCUMENT”).Element(“GoodsShipment”).Elements(“Goods”)
but the error keeps appearing “For Each: Object reference not set to an instance of an object.”
also i needed to get “DocumentID” and i got it with this code
xNameSpaces = “{”+DeserXml.Root.GetDefaultNamespace.ToString+“}”
DeserXml.Root.Element(xNameSpaces+“DocumentID”).Value
but that dont work for my “For each”, i try string like this DeserXml.Root.Element(“GoodsShipment”).Elements(“Goods”)
You can Iterate Through ‘Goods’ Elements:
In your ‘For Each’ activity, you should use the correct namespace to access the “Goods” elements.
DeserXml.Descendants(cuNamespace + “Goods”)
Inside the ‘For Each’ loop, use an ‘Assign’ activity to extract the ‘Code’ value. You can access it using something like item.Element(cuNamespace + "Code").Value
Thank you! now i can see the “Goods” elements, but i cant output the code.
Im use an ‘Assign’ and item.Element(cuNamespace + “Code”).Value inside it, error: Object reference not set to an instance of an object.
i got result, but i wrote a line on my own. In for each item.Element(“cu_namespace” + “Code”).Value
There is a line at the top of the document:
<CU_DOCUMENT xmlns:cat_cu=“" xmlns="” xmlns:cu=“" DocumentModeID="”>
to refer to a “DocumentID” i need to use “xmlns:cat_cu” and for “Code” to “xmlns:cu” but how do i write it in code ?