Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
rlooijmans
Contributor II
Contributor II

tHMap move namespace from elements to root structure in XML

Hi all,

How can I move a namespace for an element to the root structure of the XML? Now the xmlns:dt namespace is shown on each and every dt:dt element.

This is what I have:

rlooijmans_0-1715875463360.png

This is what I want:

rlooijmans_1-1715875527299.png

 

Namespace setup:

rlooijmans_2-1715875578549.png

XML properties

rlooijmans_4-1715875633992.png

Attribute name:

rlooijmans_5-1715875721610.png

I couldn't find anything specific in the docs for this. I am sure there must be a straightforward way, but I can't wrap my head around this.

Hopefully someone has an insight on how to achieve this, or has managed to get it working before. Every input is greatly appreciated.

Thanks,
Reno

 

 

 

Labels (2)
1 Solution

Accepted Solutions
emariani
Contributor
Contributor

The problem comes from the type Document defined in the schema of the connection row6 (see screenshot schema_with_document). This forces the tHMap component to produce a Document object (which is a dom4j implementation of an XML Document Object Model). The result you get is simply the result of the print of this document.
If you change the type from Document to Object, then the tHMap component will produce an XML string with the namespaces defined at the root level as expected (see screenshot schema_with_Object).

View solution in original post

4 Replies
Venky2
Contributor II
Contributor II

I am just curious to know few more details. I never seen Qlik using the XML file
can you explain a little bit more about the project or the process that you are doing and where does the Qlik sense fall in?
thanks!

 

rlooijmans
Contributor II
Contributor II
Author

Perhaps I was not entirely clear. This XML structure is generated by Talend using tHMap. It's just the namespace being put at each and every element because of an attribute. Instead of repeating, I want it to be put in the root.

Basically this job generates an XML structure with product data from an sql output.

 

Thanks.

rlooijmans
Contributor II
Contributor II
Author

Nobody has any idea? I kinda assumed that something so basic should be easily possible.. 😞

emariani
Contributor
Contributor

The problem comes from the type Document defined in the schema of the connection row6 (see screenshot schema_with_document). This forces the tHMap component to produce a Document object (which is a dom4j implementation of an XML Document Object Model). The result you get is simply the result of the print of this document.
If you change the type from Document to Object, then the tHMap component will produce an XML string with the namespaces defined at the root level as expected (see screenshot schema_with_Object).