Help from XML select only ftpServer and ftpDstDir values. Find all ftpServer is obtained, but also choose ftpDstDir does not work.

XML structure:

<ftpUpl> <FtpUpload name = "sdsdl" ftpServer = "123456789" ftpServerPort = "21" ftpDstDir = "/123/" ftpActiveMode = "true" ftpTimeout = "10" ftpFileType = "binary" saveTime = "false" queueWarnOn = "20" queueWarnOff = "2" /> </ftpUpl> 

My request that gets all ftpServer:

 $nodes = $xml->xpath('/ftpUpl/FtpUpload/@ftpServer'); 
  • "Find all ftpDstDir is working, but ftpDstDir cannot be selected either." so you chose them already: D - Naumov
  • Wrong spelling. It meant ftpServer turns out. - Dima Kuzmin
  • Yes, I understand already, but what exactly is it impossible to choose? or you want one xpath request to pull out everything? - Naumov
  • Yes, in one request I want to get two elements ftpServer and ftpDstDir - Dima Kuzmin
  • Try to glue two requests with instructions or | but not sure whether or not. - Naumov

2 answers 2

Your expression should look something like this:

 /ftpUpl/FtpUpload/@ftpServer | /ftpUpl/FtpUpload/@ftpDstDir 
     $nodes = $xml->xpath('/ftpUpl/FtpUpload/@ftpServer | /ftpUpl/FtpUpload/@ftpDstDir ');