Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5541

Incorrect parsing of xml with XmlTable

    XMLWordPrintable

Details

    • Hide

      Run the following query and have a look at last column:

      Begin
      	Declare xml xcontent = '<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      	<report>
      		<data>
      			<year xsi:type="decimal">2018</year>
      		</data>
      	</report>
      	<waitSeconds xsi:type="decimal">13</waitSeconds>
           </root>' ;
      	Select *
      	From 
      		XmlTable(
      			XmlNamespaces ('http://www.w3.org/2001/XMLSchema-instance' as xsi),
      			'/root/report/data' 
      			PASSING xcontent 
      			Columns 
      				"year" integer,
      				waitSeconds xml Path 'root()/root/waitSeconds',
      				waitSecondsStr string Path 'root()/root/waitSeconds'
      	)a ;
      End ;;
      
      Show
      Run the following query and have a look at last column: Begin Declare xml xcontent = '<root xmlns:xsi= "http://www.w3.org/2001/XMLSchema- instance " > <report> < data > < year xsi: type = " decimal " >2018</ year > </ data > </report> <waitSeconds xsi: type = " decimal " >13</waitSeconds> </root>' ; Select * From XmlTable( XmlNamespaces ( 'http://www.w3.org/2001/XMLSchema- instance ' as xsi), '/root/report/ data ' PASSING xcontent Columns " year " integer , waitSeconds xml Path 'root()/root/waitSeconds' , waitSecondsStr string Path 'root()/root/waitSeconds' ) a ; End ;;

    Description

      Running the query:

      Begin
      	Declare xml xcontent = '<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      	<report>
      		<data>
      			<year xsi:type="decimal">2018</year>
      		</data>
      	</report>
      	<waitSeconds xsi:type="decimal">13</waitSeconds>
           </root>' ;
      	Select *
      	From 
      		XmlTable(
      			XmlNamespaces ('http://www.w3.org/2001/XMLSchema-instance' as xsi),
      			'/root/report/data' 
      			PASSING xcontent 
      			Columns 
      				"year" integer,
      				waitSeconds xml Path 'root()/root/waitSeconds',
      				waitSecondsStr string Path 'root()/root/waitSeconds'
      	)a ;
      End ;;
      

      and having a look at the structure we can see that the value 13 should be returned, while the value is not picked from xml for result.

      Attachments

        Issue Links

          Activity

            People

              rhn-engineering-shawkins Steven Hawkins
              dalex005 Dmitrii Pogorelov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: