Skip to main content
I am tying to read xml metadata from a geodatabase but it is contained in one string as opposed to when you read in an xml file it would expose all of the elements.  I've tried a few different xml transformers and online help docs but cannot find a solution.  

 

Just to recap I am able to read in an xml file and process it the way i want but I now want to read in the xml from exposing the metadata in a geodatabase using geodb_metadata_string.  The problem is that the entire xml file is contained within one string now and I don't know how to explode the tags i want.  

 

Cheers
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.

Reply