-
1. Re: Error while consuming XML file containing ":" in Teiid
shawkins Oct 30, 2013 4:10 PM (in response to tanmoypalit)Can you provide a full/representative copy of the original and the sql you are using to process it?
-
2. Re: Error while consuming XML file containing ":" in Teiid
tanmoypalit Oct 30, 2013 4:25 PM (in response to shawkins)Here is the SQL:
SELECT
A.value1 AS value1, A.value2 AS value2, A.value3 AS value3
FROM
(EXEC tempXMLSource.getTextFiles('temp.xml')) AS f, XMLTABLE(XMLNAMESPACES('http://schemas.microsoft.com/ado/2007/08/dataservices' AS d, 'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' AS m), '/feed/content/m:properties' PASSING XMLPARSE(DOCUMENT f.file) COLUMNS value1 string PATH 'd:value1', value2 string PATH 'd:value2', value3 string PATH 'd:value3') AS A
below is the full XML from temp.xml
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<id>stream1</id>
<content>
<m:properties>
<d:value1>12</d:value1>
<d:value2>14</d:value2>
<d:value3>18</d:value3>
</m:properties>
</content>
</feed>
-
3. Re: Error while consuming XML file containing ":" in Teiid
tanmoypalit Oct 30, 2013 5:03 PM (in response to tanmoypalit)I am sorry. First part of the problem is resolved. It was a typo.
But the next part is not resolved which is
we had to remove one xmlns tag in the actual file which causes no data to be imported, the root in real file looks like:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
The data import works well if we remove xmlns="http://www.w3.org/2005/Atom" or change to xmlns:a="http://www.w3.org/2005/Atom" ( where 'a' could be anything)
Teiid reports it as invalid XML, but this could be valid problem with the file.
- Tanmoy
-
4. Re: Error while consuming XML file containing ":" in Teiid
shawkins Oct 31, 2013 8:17 AM (in response to tanmoypalit)> Teiid reports it as invalid XML, but this could be valid problem with the file.
Do you have an exception for that? I don't see an issue when I try to parse a document based upon the above.
If you just aren't getting data back, then the issue is that the default namespace is not defined:
XMLNAMESPACES(DEFAULT 'http://www.w3.org/2005/Atom', 'http://schemas.microsoft.com/ado/2007/08/dataservices' AS d, 'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata' AS m)
-
5. Re: Error while consuming XML file containing ":" in Teiid
tanmoypalit Oct 31, 2013 8:27 AM (in response to shawkins)Thanks Steven!! The problem has been solved after including DEFAULT namespace in the query.
I think something was changed in the file while attempting workarounds. After refreshing the file from the actual source the only problem was Teiid was not providing any data but there was no error.
Anyway, after including DEFAULT, it seems to be working now.
-Tanmoy