Skip to main content
Solved

Extracting attributes from HTML within KML with photos

  • November 16, 2021
  • 3 replies
  • 22 views

mapper
Contributor
Forum|alt.badge.img

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

 

Best answer by ebygomm

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)

 

 

View original
Did this help you find an answer to your question?

3 replies

danilo_fme
Evangelist
Forum|alt.badge.img+43
  • Evangelist
  • November 17, 2021

Hi @mapper​ 

 

Please, could you share a same data example?

 

 

Thanks in Advance,

Danilo


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • Best Answer
  • November 17, 2021

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)

 

 


mapper
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • November 17, 2021
ebygomm wrote:

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!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings