Skip to main content

I am given the following XML document:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Line>
   <Segments>
        <Segment>
            <LineGeometry srid="4326">x_1,y_1;x_2,y_2;...</LineGeometry>
            <SegmentProperties>
...
    </SegmentProperties>
        </Segment>
        <Segment>
            <LineGeometry srid="4326">x_1,y_1;x_2,y_2;...</LineGeometry>
            <SegmentProperties>
...
    </SegmentProperties>
        </Segment>
...
   </Segments>
</Line>

where each Segment should eventually create an object in Smallworld. The number of segments can be arbitrarily large (the number of SegmentProperties is fixed per segment).

As I need to not only process the LineGeometry, but also the SegmentProperties, I was wondering what the best design for this case is. An idea I had was the following:

  • Write the transformation for one element, declare that a custom transformer and iterate over all elements via a loop

Or is there a better way? I have never yet tried to implement something like that, so I wonder if that's the right way. Could PythonCaller be a better idea?

 

And is there a way to tell StringReplacer to iterate over all elements? If I want to manipulate all LineGeometry-strings, I need to select elements from 0 to X. Can I insert "ALL" somehow?

You can explode all the list elements and aggregate them accordingly before inserting them into the GML.


Unclear what the goal is, but probably the XMLFragmenter or the XMLFlattener could be a good solution.


Reply