After deserializing the XML file I printed the whole data in a message box next to it I used write line activity. At write line activity it was showing an “Object reference not set to an instance of an object error”. Here is the attached file for reference. samplexaml.zip (6.3 KB)
Could anyone suggest, please
XML elements in a file need to be uniquely identified to avoid issues when you have same type of elements but they differ in usage (say ID of SAP and ID of Oracle. Both are same elements but belong to different classes/instances).
To do that there is a standard of using namespaces.
Namespaces can be single(when you do just xmlns) like in your case or many(when you use prefix xmlns:ns1).
So when you are using the .Element structure you are basically the processor that this is the path(xpath or xml-path) to the element that i want. nfeProc/NFe/infNFe/ide Its like a folder structure.
Now that there is a namespace for your elements that is defined in the parent element you will need to prefix that for the elements otherwise it will not be able to identify it and thus gives you the error “Object reference not set to an instance of an object error” because its empty.
Please close this thread marking the answer as a solution to this thread.
Thanks, Nadim. I have another small doubt regarding queues and transactions. I am able to retrieve the single item from Get Transaction Item activity (item.Specificcontent(“fieldname”). Can I do the same thing using Get Queues item activity if so could you plz let me know what is the command to get the item.
Well you dont have to worry if they are different. You just need declare it like we do in case of processing xmls.
Create the various namespaces with the prefix you desire and then use them in the expression like i have mentioned.