XML schema problems

Four Stars

XML schema problems

Somehow I always get the chills when I need to deal with XML in Talend.

I need to produce such a schema, and tried various ways, to get it, using different mechanism, ... but nothing works.
The other side of the integrations wants this format of the schema

<root>
	<a>
		<a1>a1</a1>
		<a2>a2</a2>
	</a>
	<a>
		<a1>a1</a1>
		<a2>a2</a2>
	</a>
	<b>
		<b1>b1</b1>
		<b2>
			<b21>b21</b21>
			<b22>b22</b22>
		</b2>
	</b>
	<b>
		<b1>b1</b1>
		<b2>
			<b21>b21</b21>
			<b22>b22</b22>
		</b2>
	</b>
<root>

both a and b are childnodes of the root.
I'm banging my head around this, but simply can't figure it out.

 

 

 

Ten Stars

Re: XML schema problems

Please provide a real example and mask some data if its confidential... however if its a basic structure like this
you could use a tJavaFlex and just generate the needed xml as a string and write it to a file (dont set headers =0, and delimiter = "" )
Do it yourself.
Four Stars

Re: XML schema problems

The structure is exactly llike this. It looks like two lists one after another.
I Truly hope that this is not the only solution.
Ten Stars

Re: XML schema problems

Dont believe you unless you show me Smiley Very Happy a real example... this is duplicate stuff exact same <a> ... 

	<a>
		<a1>a1</a1>
		<a2>a2</a2>
	</a>
	<a>
		<a1>a1</a1>
		<a2>a2</a2>
	</a>
Four Stars

Re: XML schema problems

<a>
<a1>examplestring 1</a1>
<a2>examplestring 2</a2>
</a>
<a>
<a1>examplestring 3</a1>
<a2>examplestring 4</a2>
</a>

better?
Four Stars

Re: XML schema problems

Look, ... this is the schema. I did not copy/paste anthing, but wrote up a quick example. But the schema is like that
Ten Stars

Re: XML schema problems

Yes, better, now an example of your source data please.
Because you need to transform from type A -> XML , we need to understand that to.

However you could try it with tXMLMap and in the output create a one column of Document type.
see example: the example is from another post I did... but give it a go, not sure if it works...

Set your most elementary element as loop.

 

Otherwise the tJavaFlex needs to do the trick and code a little bit of java... pretty easy.

Four Stars

Re: XML schema problems

In the source data I have two flat files. One for the As and one for the Bs

A1;A2

B1;B21;B22

I tried various things, including the tXMLMap. The biggest Problem is that A, B and B2 are looped, ... meaning there are more of them in the same hierarchy.
Everything is properly normalized, .... but the problem is how to get it to be extracted like this.I cant get tehm to be looped like this.
I tried also to play with the Document type, but no success.
Four Stars

Re: XML schema problems

I have two source files. One for the As and one for the Bs and the source files are properly flattened:

My biggest issue is the A and B node, how to get them to populate in the same hierarchy.
I tried several things, and it did not work.

I would really like to avoid the tJavaFlex, since I would have to take care of all of the ecape characters myself, and similar things. If there are already XML components, than it would be best also to utilize them.