CheckIn:Bugzilla272115--A Problem with Xpath [14]
diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test27.txt b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test27.txt
new file mode 100644
index 0000000..108403f
--- /dev/null
+++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test27.txt
@@ -0,0 +1,5 @@
+id
+block
+null
+Name
+Position
diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/input/doubleslash.xml b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/input/doubleslash.xml
new file mode 100644
index 0000000..f22f525
--- /dev/null
+++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/input/doubleslash.xml
@@ -0,0 +1,12 @@
+<Top>
+ <Tree id="doc" lang="en" refid="tree">
+ <blocks>
+ <block id="block" order="1.1" refid="Type0" type="table">
+ <parameters>
+ <parameter id="Name" value="Bob"/>
+ <parameter id="Position" value="Developer"/>
+ </parameters>
+ </block>
+ </blocks>
+ </Tree>
+ </Top>
\ No newline at end of file
diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/test/util/TestConstants.java b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/test/util/TestConstants.java
index 4817bf9..66f608e 100644
--- a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/test/util/TestConstants.java
+++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/test/util/TestConstants.java
@@ -126,6 +126,8 @@
public static final String SAX_PARSER_TEST25_GOLDEN_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test25.txt";
public static final String SAX_PARSER_TEST26_OUTPUT_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/output/SaxParserTest.test26.txt";
public static final String SAX_PARSER_TEST26_GOLDEN_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test26.txt";
+ public static final String SAX_PARSER_TEST27_OUTPUT_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/output/SaxParserTest.test27.txt";
+ public static final String SAX_PARSER_TEST27_GOLDEN_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.test27.txt";
public static final String SAX_PARSER_TEST_PARAM_OUTPUT_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/output/SaxParserTest.testParam.txt";
public static final String SAX_PARSER_TEST_PARAM_GOLDEN_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/golden/SaxParserTest.testParam.txt";
@@ -142,4 +144,6 @@
public static final String ANY_RECURSIVE_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/input/anyRecursive.xml";
+ public static final String DOUBLE_SLASH_XML = home+"test/org/eclipse/datatools/enablement/oda/xml/input/doubleslash.xml";
+
}
diff --git a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/util/SaxParserTest.java b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/util/SaxParserTest.java
index 91afdae..ff9dee5 100644
--- a/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/util/SaxParserTest.java
+++ b/tests/org.eclipse.datatools.enablement.oda.xml.tests/test/org/eclipse/datatools/enablement/oda/xml/util/SaxParserTest.java
@@ -63,6 +63,7 @@
+ "#-# soap#:#[/SOAP-ENV:Envelope/SOAP-ENV:Body/GetWeatherByZipCodeResponse/GetWeatherByZipCodeResult]#:#{Latitude;STRING;/Latitude},{Longitude;STRING;/Longitude},{AllocationFactor;STRING;/AllocationFactor},{FipsCode;STRING;/FipsCode},{PlaceName;STRING;/PlaceName},{StateCode;STRING;/StateCode},{Status;STRING;/Status},{Day;STRING;/Details/WeatherData/Day},{WeatherImage;STRING;/Details/WeatherData/WeatherImage},{MaxTemperatureF;STRING;/Details/WeatherData/MaxTemperatureF},{MinTemperatureF;STRING;/Details/WeatherData/MinTemperatureF},{MaxTemperatureC;STRING;/Details/WeatherData/MaxTemperatureC},{MinTemperatureC;STRING;/Details/WeatherData/MinTemperatureC}"
+ "#-# anyAndRecursive#:#[//test]#:#{test_name;STRING;test_name},{area_name;STRING;../../../../area_name}"
+ "#-# parameter#:#[//{?entry?}]#:#{b-bar1;String;/field[@{?b?}='bar1']},{b-bar2;String;/field[@{?b?}='{?bar2?}']},{b-bar9;String;/field[@b='bar9']},{a-foo;String;/field[@a='foo']}"
+ + "#-# doubleslash#:#[//block//]#:#{id;STRING;@id}"
/*this line should be the last because name space information is saved with the last table mapping currently */
+ "#-# nameSpace#:#[/feed/entry/g:id]#:#{title;STRING;../title},{g:price;STRING;../g:price},{g:id;STRING;}#:#<\"openSearch\",\"http:%%a9.com%-%spec%opensearchrss%1.0%\";\"g\",\"http:%%base.google.com%ns%1.0\";\"batch\",\"http:%%schemas.google.com%gdata%batch\";\"gm\",\"http:%%base.google.com%ns-metadata%1.0\";\"\",\"http:%%www.w3.org%2005%Atom\";\"SOAP-ENV\",\"http:%%schemas.xmlsoap.org%soap%envelope%\";\"xsd\",\"http:%%www.w3.org%2001%XMLSchema\";\"SOAP-ENC\",\"http:%%schemas.xmlsoap.org%soap%encoding%\";\"xsi\",\"http:%%www.w3.org%2001%XMLSchema-instance\">";
@@ -1265,6 +1266,48 @@
new File( TestConstants.SAX_PARSER_TEST26_GOLDEN_XML ) ) );
}
+ public void test27( ) throws OdaException, IOException
+ {
+ File file = new File( TestConstants.SAX_PARSER_TEST27_OUTPUT_XML );
+
+ if ( file.exists( ) )
+ file.delete( );
+ File path = new File( file.getParent( ) );
+ if ( !path.exists( ) )
+ path.mkdir( );
+ file.createNewFile( );
+ FileOutputStream fos = new FileOutputStream( file );
+
+ mt = new MappedTables( testString );
+ Connection conn = new Connection( );
+ Properties p = new Properties( );
+ p.put( Constants.CONST_PROP_FILELIST, TestConstants.DOUBLE_SLASH_XML );
+ conn.open( p );
+ rs = new ResultSet( conn,
+ mt,
+ "doubleslash" ,
+ 0);
+
+ for ( int i = 0; i < rs.getMetaData( ).getColumnCount( ); i++ )
+ fos.write( ( rs.getMetaData( ).getColumnName( i + 1 ) + "\t\t\t\t\t" ).getBytes( ) );
+ fos.write( lineSeparator.getBytes( ) );
+
+ while ( rs.next( ) )
+ {
+ for ( int i = 0; i < rs.getMetaData( ).getColumnCount( ); i++ )
+ fos.write( ( rs.getString( i + 1 ) + "\t\t\t\t\t" ).getBytes( ) );
+ fos.write( lineSeparator.getBytes( ) );
+ }
+ assertFalse( rs.next( ) );
+
+ fos.close( );
+ rs.close( );
+ conn.close( );
+ assertTrue( TestUtil.compareTextFile( new File( TestConstants.SAX_PARSER_TEST27_OUTPUT_XML ),
+ new File( TestConstants.SAX_PARSER_TEST27_GOLDEN_XML ) ) );
+ }
+
+
public void testParameters( ) throws OdaException, IOException
{
File file = new File( TestConstants.SAX_PARSER_TEST_PARAM_OUTPUT_XML );