Solved

Extracting attributes from HTML within KML with photos

  • 17 November 2021
  • 3 replies
  • 5 views

Badge

Hello

I am having trouble extracting attributes from a kml for the features that have photos.

I am using XQuery similar to this example https://community.safe.com/s/question/0D54Q0000848CTkSAM/extracting-information-from-different-folders-in-kml-to-convert-to-the-shapefile

 

That method works for the features that don't have photos but the features that have photos seem to have a extra section in the HTML that is causing my XQuery to fail.

 

The Xquery I am using is :

 

declare default element namespace "http://www.w3.org/1999/xhtml";

for $x in /html/body/table/tr/td/table/tr

return fme:set-attribute($x/td[1]/text(),$x/td[2]/text())

 

I am pretty sure I just need to modify the Xquery

 

icon

Best answer by ebygomm 17 November 2021, 11:54

View original

3 replies

Userlevel 4
Badge +30

Hi @mapper​ 

 

Please, could you share a same data example?

 

 

Thanks in Advance,

Danilo

Userlevel 1
Badge +10

If you just want to ignore the parts with a link you could do something like this

declare default element namespace "http://www.w3.org/1999/xhtml";
 
let $values :=  /html/body/table/tr/td/table/tr
 
for $v in $values
let $attrname:= $v/td[1][not(a)]
let $attrval:=$v/td[2]/text()
return fme:set-attribute($attrname,$attrval)

 

 

Badge

If you just want to ignore the parts with a link you could do something like this

declare default element namespace "http://www.w3.org/1999/xhtml";
 
let $values :=  /html/body/table/tr/td/table/tr
 
for $v in $values
let $attrname:= $v/td[1][not(a)]
let $attrval:=$v/td[2]/text()
return fme:set-attribute($attrname,$attrval)

 

 

This worked perfectly! Thank you!

Reply