Hi,
you can use the XMLFragmenter to split up an attribute containing an XML document into separate features, just like the XML reader.
David
Thank you. Seperating the 'Elements to Match' with a whitespace did the trick.
One more thing... How would you flatten a list? I have this as my xml:
...
<idAbs>The Transportation District dataset is comprised of all the polygons that represent... </idAbs>
<searchKeys>
<keyword>transportation</keyword>
<keyword>district</keyword>
<keyword>jurisdiction</keyword>
<keyword>road</keyword>
</searchKeys>
...
Within xmlFlattener I can flatten idAbs just fine but don't know what to put to get each keyword as a list. I tried searchKeys and expose searckKeys.keyword{} but it didn't work. After the flattener I pass it into the JSONTemplater with this template:
{
"summary" : fme:get-attribute("idAbs"),
"description" : fme:get-attribute("idPurp"),
"credits" : fme:get-attribute("idCredit"),
"tags" : q fme:get-list-attribute("searchKeys.keyword{}") ]
}
The template is written this way becasue i got it working with an xml file that i read in (as opposed to now where I am reading the xml from a string). I think there must be some easy way but the documentation is not easy.
I just got it! What i did was enter searchKeys as the Element to Match in Flatten Paths and then entered keyword{} in the Expose Attribute (on the xmlFlattener). Then on th eJSONTemplater I used "tags" : fme:get-list-attribute("keyword{}") ].
In case anyone else has this problem.