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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Error trying to read an XML file with NameSpaces

I'm trying to use a tFileInputXML component to read an XML file. The XML file contains namespaces which seems to cause errors trying to read the XML. Sample xml below. If I remove the namespaces, I'm able to read the file. Is there something I need to do differently when an XML file contains namespaces?
<?xml version="1.0" encoding="utf-8"?>
<ns0 0683p000009MA5A.pngnRampMessageRequest xmlns:ns0="urn:xxx 0683p000009MA5A.pngnRampMessageRequest:v1.0">
  <ns0 0683p000009M9p6.pngourceSystemName>xxx</ns0 0683p000009M9p6.pngourceSystemName>
  <ns0:MessageType>Exchange Rates</ns0:MessageType>
  <ns0:MessageTypeVersion>1.0</ns0:MessageTypeVersion>
  <ns0 0683p000009M9p6.pngourceMessageId>abc123</ns0 0683p000009M9p6.pngourceMessageId>
  <ns0 0683p000009M9p6.pngourceSentDatetime>2014-01-10T05:00:00</ns0 0683p000009M9p6.pngourceSentDatetime>
  <ns0 0683p000009MAB6.pngayload>
    <ns0:ExchangeRateData xmlns:ns0="">
      <ns0:ExchangeRates>
        <ns0 0683p000009MACJ.pngate>2012-05-17</ns0 0683p000009MACJ.pngate>
        <ns0 0683p000009M9p6.pngellRate>4.670057</ns0 0683p000009M9p6.pngellRate>
        <ns0:BuyRate>4.670057</ns0:BuyRate>
        <ns0:MeanRate>4.670057</ns0:MeanRate>
        <ns0:Checksum>14.010171</ns0:Checksum>
        <ns0:CurrencyCode>AED</ns0:CurrencyCode>
      </ns0:ExchangeRates>
      <ns0:ExchangeRates>
        <ns0 0683p000009MACJ.pngate>2012-05-17</ns0 0683p000009MACJ.pngate>
        <ns0 0683p000009M9p6.pngellRate>2.275906</ns0 0683p000009M9p6.pngellRate>
        <ns0:BuyRate>2.275906</ns0:BuyRate>
        <ns0:MeanRate>2.275906</ns0:MeanRate>
        <ns0:Checksum>6.827718</ns0:Checksum>
        <ns0:CurrencyCode>ANG</ns0:CurrencyCode>
      </ns0:ExchangeRates>
    </ns0:ExchangeRateData>
  </ns0 0683p000009MAB6.pngayload>
</ns0 0683p000009MA5A.pngnRampMessageRequest>
Labels (3)
9 Replies
Anonymous
Not applicable
Author

Hi,
Have you tried option "Ignore the namespaces" in Advanced settings of tfileinputxml?
Best regards
Sabrina
0683p000009MEnr.png
Anonymous
Not applicable
Author

I wanted to see if I could get it to work without the "Ignore the namespaces" option. I would think it should work without the option selected. Should it work without the option selected?
Anonymous
Not applicable
Author

Hi,
Currently, tFileInputXML can't be used to extract namespace value.
Best regards
Sabrina
Anonymous
Not applicable
Author

hi all,
And it seems that your file doesn't respect standard xml namespace.
Error on line 9 of document file:/C:/Users/lraulier/Documents/forum/readNamespace.xml: The value of the attribute "prefix="xmlns",localpart="ns0",rawname="xmlns:ns0"" is invalid. Prefixed namespace bindings may not be empty.

regards
laurent
Anonymous
Not applicable
Author

That was just a cut/paste error, the actual xml has a valid namespace, thanks
Anonymous
Not applicable
Author

put as resolved if it's ok for you 0683p000009MA9p.png
thanks 
regards
laurent
Anonymous
Not applicable
Author

Is there any example online with the "Ignore namespaces" option checked?
Anonymous
Not applicable
Author

hi,
it's in the doc from talend help ... just a check box :
https://help.talend.com/search/all?query=tFileInputXML&content-lang=en
regards
laurent
Anonymous
Not applicable
Author

Thanks for the link but I have already seen it.
The purpose behind asking for an example was that my situation differs a wee bit.
I am reading an XML file using tFileInputXML and then mapping its elements to database columns through tXMLMap component.
Now I am curious to know if in the tXMLMap where I define XML document structure by using "Import from File", do I keep the schema definitions along with their prefixes and also maintain the tag names with the namespace prefixes or do I remove them?