Read Xml Elements

Hi there,

I want to ask about some issues on reading xml elements.

Is that possible to read the ad1, ad2, and ad3 in one line instead of separating them and read in one by one.
My current command is that
address1 = item.Elements(“adrVal”).Elements(“pad”).Elements(“ad1”).Value.ToString
address2 = item.Elements(“adrVal”).Elements(“pad”).Elements(“ad2”).Value.ToString
address3 = item.Elements(“adrVal”).Elements(“pad”).Elements(“ad3”).Value.ToString

My concern is to read the address in one line. Does anyone could help me on this?
I appreciate your assistance. Thanks in advance.


Hi @yushinchan

  1. You can do concatenation of ad1, ad2, ad3 values
  2. Use innerText property of adrVal element to extract text of all child nodes in one go

Hi @san.nagane

How am I going to do that?

address = item.Elements(“adrVal”).Elements(“pad”).innerText

Hi, but I don’t want con and pcd.

Hi @yushinchan

In that case you can use first approach to fetch individual values and do the string concatenationin the end