Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tAdvancedFileOuputXML not able to use namespace prefix for root elemen

Good Afternoon,
I hope you can help me with a problem on XML file generation.
Please see attached for screenshots of the jobs and XML tree setup.
I am using tAdvancedFileOutputXML to create an XML file that uses a namespace called "scf".
I have been able to get the file to generate (jobs complete successfully) but I can only get the sub-elements to display with the namespace prefix. If I add the namespace pref to the root element i.e. <scf 0683p000009MA5A.pngpenItems> rather than <OpenItems> I encounter the following error:
"Exception in component tAdvancedFileOutputXML_1
java.lang.NullPointerException
at ing_buyer_import.scf_oi_extractor_v2_0_1.SCF_OI_Extractor_v2.tSybaseInput_3Process(SCF_OI_Extractor_v2.java:4418)
at ing_buyer_import.scf_oi_extractor_v2_0_1.SCF_OI_Extractor_v2.tWarn_4Process(SCF_OI_Extractor_v2.java:2473)
at ing_buyer_import.scf_oi_extractor_v2_0_1.SCF_OI_Extractor_v2.runJobInTOS(SCF_OI_Extractor_v2.java:7986)
at ing_buyer_import.scf_oi_extractor_v2_0_1.SCF_OI_Extractor_v2.main(SCF_OI_Extractor_v2.java:7800)"
If I leave the XML tree root element without a namespace prefix my tXSDValidator job fails as the namespace is required in my xsd schema.
Can you please give me advice on a workaround or if I am using the jobs/tree incorrectly?
Thanks for your help!
Best regards,
Fabrice
Labels (4)
6 Replies
Anonymous
Not applicable
Author

hi,
try by specifying hour "xmlns:scf" like an attribute and give it a default value !
Here a little similar example with svg and 2 differents namespaces :
the result :
<?xml version="1.0" encoding="ISO-8859-15"?>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg"
baseProfile="full"
xmlns:xlink="http://www.w3.org/1999/xlink">
<svg:rect x="70" y="45" height="75" width="67" fill="red"/>
<svg:script xlink:href="script.js"/>
</svg:svg>

hope it helps
regard
laurent
Anonymous
Not applicable
Author

Thanks for your response 0683p000009MACn.png
I am running Talend 4.01 (r41260-20100429-0544).
I tried your suggestion before too but it results in a different error. It seems to indicate that Talend cannot resolve the namespace when creating the XML file.
In my previous configuration it recognises the namespace but doesn't set the prefix on the root element.
If your test scenario works then it may be ordering of the attributes.
"Exception in component tAdvancedFileOutputXML_1
org.dom4j.XPathException: Exception occurred evaluting XPath: /scf 0683p000009MA5A.pngpenItems/scf:buyer. Exception: XPath expression uses unbound namespace prefix scf
at org.dom4j.xpath.DefaultXPath.handleJaxenException(DefaultXPath.java:374)
at org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:173)
at org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:185)
at ing_buyer_import.scf_oi_extractor_v2_0_1.SCF_OI_Extractor_v2.tSybaseInput_3Process(SCF_OI_Extractor_v2.java:4401)
at ing_buyer_import.scf_oi_extractor_v2_0_1.SCF_OI_Extractor_v2.tWarn_4Process(SCF_OI_Extractor_v2.java:2473)
at ing_buyer_import.scf_oi_extractor_v2_0_1.SCF_OI_Extractor_v2.runJobInTOS(SCF_OI_Extractor_v2.java:7983)
at ing_buyer_import.scf_oi_extractor_v2_0_1.SCF_OI_Extractor_v2.main(SCF_OI_Extractor_v2.java:7797)!"
Thanks
Anonymous
Not applicable
Author

extra screenshots
Anonymous
Not applicable
Author

Hey Symond,
Even I'm facing the same problem.
My XML looses its attributes and namespaces.
I used tAdvancedFileOutputXML Component to generate XML.
If you have the solution, please share.
Thanks & Regards,
Priya
Anonymous
Not applicable
Author

Hey Symond,
Even I'm facing the same problem.
My XML looses its attributes and namespaces.
I used tAdvancedFileOutputXML Component to generate XML.
If you have the solution, please share.
Thanks & Regards,
Priya

please see attached for setup that worked for me
namespace was added to the schema with its value hardcoded as a default
not great but it worked for me
Anonymous
Not applicable
Author

Hey Symond,
Thanks for reply.
Priya