Question

How to I extract information from XML fle

  • 15 December 2022
  • 2 replies
  • 3 views

Badge

Hello Sir/ Madam,

 

So I have a CityGML file, which is based on XML. In each of the 3D model, I would like to extract the attribute name and values. Basically, what I want is that those with gen:string attribute name and bldg are the values where I would like to retreive.

 

Here is a part of the file

 

<gen:stringAttribute name="BuildingStructureID">

    <gen:value>15169952</gen:value>

   </gen:stringAttribute>

   <gen:stringAttribute name="BuildingCSUID">

    <gen:value>3917120211T20050430</gen:value>

   </gen:stringAttribute>

   <gen:stringAttribute name="BuildingID">

    <gen:value>1108233601</gen:value>

   </gen:stringAttribute>

   <gen:stringAttribute name="ModelIdentityNumber">

    <gen:value>B391712021101062A0</gen:value>

   </gen:stringAttribute>

   <gen:stringAttribute name="UUID">

    <gen:value>22fe4b82-05e8-44ec-91cc-3408862e240a</gen:value>

   </gen:stringAttribute>

   <gen:stringAttribute name="BuildingStructureType">

    <gen:value>T</gen:value>

   </gen:stringAttribute>

   <gen:stringAttribute name="BuildingNameEN">

    <gen:value>

    </gen:value>

   </gen:stringAttribute>

   <gen:stringAttribute name="BuildingNameTC">

    <gen:value>

    </gen:value>

   </gen:stringAttribute>

   <bldg:usage>Miscellaneous</bldg:usage>

   <bldg:measuredHeight>3.7001</bldg:measuredHeight>

 

 

I would like to extract the information with two attributes - Attribute_Name and Value,

 

Attribute_Name Value

BuildingStructureID 15169952

BuildingCSUID 3917120211T20050430

BuildingID 1108233601

Usage Miscellaneous

MeasuredHeight 3.7001

 

 

 

Is it possible to do that in FME? I tried to use XMLFlattener but with no luck. Any assistant would be gratefully appreciated.

I have attached one model sample in here.

 

Thank you very much.

 


2 replies

Userlevel 4
Badge +26

FME has a CityGML reader. You can add a CityGML reader and just pick the 'Building' feature type. The attributes will be part of the building features.imageThe 'Measured Height' attribute is read into FME as "citygml_measured_height" as is shown in the screen shot. You can then use an AttributeManager to remove the unneeded extra attributes and rename any.

 

Badge

FME has a CityGML reader. You can add a CityGML reader and just pick the 'Building' feature type. The attributes will be part of the building features.imageThe 'Measured Height' attribute is read into FME as "citygml_measured_height" as is shown in the screen shot. You can then use an AttributeManager to remove the unneeded extra attributes and rename any.

 

Thank you and sorry for this stupid question. I use Schema reader at the first place.

Ok, I will try to use CityGML reader.

 

Thanks for your help! 🙂

Reply