开发者

How to transform XML to match XSD or DTD?

开发者 https://www.devze.com 2023-03-08 15:09 出处:网络
I have a Pentaho Kettle (PDI) transformation that starts with a Table Output step executing basic SQL. This step hops to an XML Output step that creates an XML file.

I have a Pentaho Kettle (PDI) transformation that starts with a Table Output step executing basic SQL. This step hops to an XML Output step that creates an XML file.

The xml format looks like this:

<series>
 <values><Date>2011&#47;03&#47;15 00:00:00.000</Date> <Media Cost>$136.08</Media Cost> <Clicks> 50.0</Clicks> </values>
 <values><Date>2011&#47;03&#47;16 00:00:00.000</Date> <Media Cost>$240.47</Media Cost> <Clicks> 71.0</Clicks> </values>

However, I need this XML to be a specific format. I do have an XML schema and DTD to define this format, just not sure the best way to get into that format.

Here is an example of how it needs to be formatted.

<series name="Media Cost">
<value>340</value>
<value>154</value>
<value>516</value>
<value>103</value>
<value>315</value>
&开发者_如何转开发lt;/series>

<series name="Clicks">
<value>476</value>
<value>504</value>
<value>239</value>
<value>111</value>
<value>224</value>
</series>

Any advice is appreciated.


The only way I came up with to do this was to use the Add XML or the Append Stream transform steps and build the final output. I used Execute SQL statements to create the individual components and then joined them together to create the output that was required.

0

精彩评论

暂无评论...
验证码 换一张
取 消