Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 276134 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java (-4 / +160 lines)
Lines 7-17 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     David Carver (STAR) - initial API and implementation
9
 *     David Carver (STAR) - initial API and implementation
10
 *     Jin Mingjan - bug 262765 -  extractXPathExpression and getExpectedResults
11
 *     Mukul Gandhi - bug 273760 - wrong namespace for functions and data types
12
 *     Mukul Gandhi - bug 276134 - improvements to schema aware primitive type support
13
 *                                  for attribute/element nodes  
10
 *******************************************************************************/
14
 *******************************************************************************/
11
package org.eclipse.wst.xml.xpath2.processor.test;
15
package org.eclipse.wst.xml.xpath2.processor.test;
12
16
17
18
13
import java.io.*;
19
import java.io.*;
14
import java.net.URL;
20
import java.net.URL;
21
import java.util.HashMap;
22
import java.util.Iterator;
23
import java.util.regex.Matcher;
24
import java.util.regex.Pattern;
25
26
import javax.xml.XMLConstants;
27
import javax.xml.transform.stream.StreamSource;
28
import javax.xml.validation.Schema;
29
import javax.xml.validation.SchemaFactory;
15
30
16
import org.apache.xerces.xs.ElementPSVI;
31
import org.apache.xerces.xs.ElementPSVI;
17
import org.apache.xerces.xs.XSModel;
32
import org.apache.xerces.xs.XSModel;
Lines 19-27 Link Here
19
import org.eclipse.wst.xml.xpath2.processor.*;
34
import org.eclipse.wst.xml.xpath2.processor.*;
20
import org.eclipse.wst.xml.xpath2.processor.ast.*;
35
import org.eclipse.wst.xml.xpath2.processor.ast.*;
21
import org.eclipse.wst.xml.xpath2.processor.function.*;
36
import org.eclipse.wst.xml.xpath2.processor.function.*;
22
import org.eclipse.wst.xml.xpath2.processor.internal.function.XDTCtrLibrary;
37
import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType;
38
import org.eclipse.wst.xml.xpath2.processor.internal.types.ElementType;
39
import org.eclipse.wst.xml.xpath2.processor.internal.types.QName;
23
import org.osgi.framework.Bundle;
40
import org.osgi.framework.Bundle;
24
import org.w3c.dom.Document;
41
import org.w3c.dom.Document;
42
import org.xml.sax.SAXException;
25
43
26
import junit.framework.TestCase;
44
import junit.framework.TestCase;
27
45
Lines 29-34 Link Here
29
47
30
	protected Document domDoc = null;
48
	protected Document domDoc = null;
31
	protected Bundle bundle = null;
49
	protected Bundle bundle = null;
50
	
51
	private static final String INPUT_CONTEXT = "input-context";
52
	private static final String INPUT_CONTEXT1 = "input-context1";
53
	private static final String INPUT_CONTEXT2 = "input-context2";
54
//	private static final String S_COMMENT1 = "(:";
55
	private static final String S_COMMENT2 = ":)";
56
	private static final String DECLARE_NAMESPACE = "declare namespace";
57
	private static final String DECLARE_VARIABLE = "declare variable";
58
	private static final String REGEX_DN = "declare namespace\\s+(\\w[-_\\w]*)\\s*=\\s*['\"]([^;]*)['\"];";
59
	private static HashMap<String, String> namespaceMap = new HashMap<String, String>(3);
60
	private static HashMap<String, String> inputMap = new HashMap<String, String>(3);
32
61
33
	@Override
62
	@Override
34
	protected void setUp() throws Exception {
63
	protected void setUp() throws Exception {
Lines 44-49 Link Here
44
		domloader.set_validating(false);
73
		domloader.set_validating(false);
45
		domDoc = domloader.load(is);
74
		domDoc = domloader.load(is);
46
	}
75
	}
76
	
77
	protected void loadDOMDocument(URL fileURL, URL schemaURL) throws IOException,
78
	        DOMLoaderException, SAXException {
79
      InputStream is = fileURL.openStream();
80
      InputStream schemaIs = schemaURL.openStream();
81
      DOMLoader domloader = new XercesLoader(getSchema(schemaIs));
82
      domDoc = domloader.load(is);
83
    }
84
	
85
	private Schema getSchema(InputStream schemaIs) throws SAXException {
86
		SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
87
        Schema schema = sf.newSchema(new StreamSource(schemaIs));
88
        
89
        return schema;
90
	}
47
91
48
	@Override
92
	@Override
49
	protected void tearDown() throws Exception {
93
	protected void tearDown() throws Exception {
Lines 59-70 Link Here
59
103
60
	protected DynamicContext setupDynamicContext(XSModel schema) {
104
	protected DynamicContext setupDynamicContext(XSModel schema) {
61
		DynamicContext dc = new DefaultDynamicContext(schema, domDoc);
105
		DynamicContext dc = new DefaultDynamicContext(schema, domDoc);
62
		dc.add_namespace("xsd", "http://www.w3.org/2001/XMLSchema");
106
		dc.add_namespace("xs", "http://www.w3.org/2001/XMLSchema");
63
		dc.add_namespace("xdt", "http://www.w3.org/2004/10/xpath-datatypes");
107
		dc.add_namespace("fn", "http://www.w3.org/2005/xpath-functions");
64
108
65
		dc.add_function_library(new FnFunctionLibrary());
109
		dc.add_function_library(new FnFunctionLibrary());
66
		dc.add_function_library(new XSCtrLibrary());
110
		dc.add_function_library(new XSCtrLibrary());
67
		dc.add_function_library(new XDTCtrLibrary());
68
		return dc;
111
		return dc;
69
	}
112
	}
70
113
Lines 77-81 Link Here
77
		name_check.check(path);
120
		name_check.check(path);
78
		return path;
121
		return path;
79
	}
122
	}
123
	
124
	protected String getExpectedResult(String xqFile){
125
		String resultFile = xqFile;
126
		//
127
		if (resultFile.length()<10) {   //<9 enough? like XPST0001
128
			return resultFile;
129
		}
130
		String content="";
131
		//
132
		InputStream isrf;
133
		try {
134
			isrf = bundle.getEntry(resultFile).openStream();
135
			BufferedReader rfreader = new BufferedReader(new InputStreamReader(isrf));
136
			//XXX:assume char buffer 2048 is long enough;1024 maybe enough
137
	        //Exception: Axes085, NodeTest003/04/05,... 
138
			int bufferLength = 2048;
139
			if ((resultFile.indexOf("Axes085") != -1)
140
					|| (resultFile.indexOf("NodeTest003") != -1)
141
					|| (resultFile.indexOf("NodeTest004") != -1)
142
					|| (resultFile.indexOf("NodeTest005") != -1)) {
143
				bufferLength = 40000;
144
			}else if(resultFile.indexOf("ForExpr013") != -1) {
145
				bufferLength = 433500;
146
			}else if(resultFile.indexOf("ForExpr016") != -1
147
					|| (resultFile.indexOf("ReturnExpr011") != -1)
148
					|| (resultFile.indexOf("sgml-queries-results-q1") != -1)
149
					|| (resultFile.indexOf("sgml-queries-results-q2") != -1)) {
150
				bufferLength = 10240;
151
			}
152
			char[] cbuf = new char[bufferLength];
153
			int nByte = rfreader.read(cbuf);
154
	        assertTrue(resultFile,nByte<bufferLength);//assert nice buffer length
155
	        
156
	        content = new String(cbuf).trim();
157
	        rfreader.close();
158
	        isrf.close();
159
			
160
		} catch (IOException e) {
161
//			e.printStackTrace();
162
			content = "XPST0003";
163
		}
164
		return content;
165
	}
166
	
167
	public String extractXPathExpression(String xqFile, String inputFile) {
168
		// get the xpath2 expr from xq file, first
169
        char[] cbuf = new char[2048];//
170
        String content = null;
171
        String xpath2Expr = null;
172
		
173
		try {
174
			InputStream isxq =  bundle.getEntry(xqFile).openStream();
175
	        BufferedReader xqreader = new BufferedReader(new InputStreamReader(isxq));
176
	        int nByte = xqreader.read(cbuf);
177
	        assertTrue(xqFile,nByte<2048);
178
	        content = new String(cbuf).trim();
179
	        //
180
			if (content.indexOf(INPUT_CONTEXT) != -1
181
					&& content.indexOf(INPUT_CONTEXT1) == -1
182
					&& content.indexOf(INPUT_CONTEXT2) == -1) {
183
				inputMap.put(INPUT_CONTEXT, inputFile);
184
			} else if (content.indexOf(INPUT_CONTEXT1) == -1) {
185
				inputMap.put(INPUT_CONTEXT1, inputFile);
186
			} else if (content.indexOf(INPUT_CONTEXT2) != -1) {
187
				inputMap.put(INPUT_CONTEXT2, inputFile);
188
			}
189
	        //	        
190
	        if (content.indexOf(DECLARE_NAMESPACE)!=-1) {
191
	        	setupNamespace(content);
192
	        }
193
	        //
194
	        assertTrue(content.lastIndexOf(S_COMMENT2)!=-1);//assert to get
195
	        xpath2Expr = content.substring(content.lastIndexOf(S_COMMENT2)+2).trim(); 
196
	        
197
	        xqreader.close();
198
	        isxq.close();
199
		} catch (IOException e) {
200
			// TODO Auto-generated catch block
201
			e.printStackTrace();
202
		}
203
		return xpath2Expr;
204
	}
205
	
206
	protected void setupNamespace(String content) {
207
		Pattern p = Pattern.compile(REGEX_DN);
208
		Matcher m = p.matcher(content);
209
		while (m.find()) {
210
			assertTrue(m.groupCount()==2);//
211
			namespaceMap.put(m.group(1), m.group(2));
212
		}
213
		
214
	}
215
	
216
	protected DynamicContext setupVariables(DynamicContext dc) {
217
		dc.add_variable(new QName("x"));
218
		dc.add_variable(new QName("var"));
219
		ElementType elementType = new ElementType(domDoc.getDocumentElement(), 0);;
220
		dc.set_variable(new QName("input-context1"), elementType);
221
		
222
		return dc;
223
	}
224
225
	protected String buildResultString(ResultSequence rs) {
226
		String actual = new String();
227
		Iterator<AnyType> iterator = rs.iterator();
228
		while (iterator.hasNext()) {
229
			AnyType anyType = iterator.next();
230
			actual = actual + anyType.string_value() + " ";
231
		}
232
	
233
		return actual.trim();
234
	}
235
	
80
236
81
}
237
}
(-)src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java (-2 / +337 lines)
Lines 7-19 Link Here
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     David Carver (STAR) - initial API and implementation
9
 *     David Carver (STAR) - initial API and implementation
10
 *     Mukul Gandhi - bug 273719 - String-Length with Element Arg
10
 *     Mukul Gandhi - bug 273719 - improvements to fn:string-length function
11
 *     Mukul Gandhi - bug 273795 - improvements to substring function
11
 *     Mukul Gandhi - bug 273795 - improvements to fn:substring function
12
 *     Mukul Gandhi - bug 274471 - improvements to fn:string function
13
 *     Mukul Gandhi - bug 274719 - implementation of equality of xs:anyURI values
14
 *     Mukul Gandhi - bug 274725 - implementation of fn:base-uri function
15
 *     Mukul Gandhi - bug 274731 - implementation of fn:document-uri function
16
 *     Mukul Gandhi - bug 274784 - improvements to xs:boolean data type
17
 *     Mukul Gandhi - bug 274792 - improvements to xs:date data type
18
 *     Mukul Gandhi - bug 274805 - improvements to xs:integer data type
19
 *     Mukul Gandhi - bug 274952 - implementation of xs:long data type
20
 *     Mukul Gandhi - bug 275105 - implementation of xs:int data type
21
 *     Mukul Gandhi - bug 276134 - improvements to schema aware primitive type support
22
 *                                 for attribute/element nodes 
12
 *******************************************************************************/
23
 *******************************************************************************/
13
package org.eclipse.wst.xml.xpath2.processor.test;
24
package org.eclipse.wst.xml.xpath2.processor.test;
14
25
15
import java.net.URL;
26
import java.net.URL;
16
27
28
import javax.xml.parsers.DocumentBuilder;
29
import javax.xml.parsers.DocumentBuilderFactory;
30
17
import org.apache.xerces.xs.XSModel;
31
import org.apache.xerces.xs.XSModel;
18
import org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator;
32
import org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator;
19
import org.eclipse.wst.xml.xpath2.processor.DynamicContext;
33
import org.eclipse.wst.xml.xpath2.processor.DynamicContext;
Lines 94-98 Link Here
94
108
95
		assertEquals("true", actual);
109
		assertEquals("true", actual);
96
	}
110
	}
111
	
112
	public void testStringFunctionBug274471() throws Exception {
113
		// Bug 274471
114
		URL fileURL = bundle.getEntry("/bugTestFiles/bug274471.xml");
115
		loadDOMDocument(fileURL);
116
		
117
		// Get XML Schema Information for the Document
118
		XSModel schema = getGrammar();
119
120
		DynamicContext dc = setupDynamicContext(schema);
121
122
		String xpath = "x/string() = 'unhappy'";
123
		XPath path = compileXPath(dc, xpath);
124
125
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
126
		ResultSequence rs = eval.evaluate(path);
127
128
		XSBoolean result = (XSBoolean) rs.first();
129
130
		String actual = result.string_value();
131
132
		assertEquals("true", actual);
133
	}
134
	
135
	public void testStringLengthFunctionBug274471() throws Exception {
136
		// Bug 274471. string-length() with arity 0
137
		URL fileURL = bundle.getEntry("/bugTestFiles/bug274471.xml");
138
		loadDOMDocument(fileURL);
139
		
140
		// Get XML Schema Information for the Document
141
		XSModel schema = getGrammar();
142
143
		DynamicContext dc = setupDynamicContext(schema);
144
145
		String xpath = "x/string-length() = 7";
146
		XPath path = compileXPath(dc, xpath);
147
148
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
149
		ResultSequence rs = eval.evaluate(path);
150
151
		XSBoolean result = (XSBoolean) rs.first();
152
153
		String actual = result.string_value();
154
155
		assertEquals("true", actual);
156
	}
157
	
158
	public void testNormalizeSpaceFunctionBug274471() throws Exception {
159
		// Bug 274471. normalize-space() with arity 0
160
		URL fileURL = bundle.getEntry("/bugTestFiles/bug274471.xml");
161
		loadDOMDocument(fileURL);
162
		
163
		// Get XML Schema Information for the Document
164
		XSModel schema = getGrammar();
165
166
		DynamicContext dc = setupDynamicContext(schema);
167
168
		String xpath = "x/normalize-space() = 'unhappy'";
169
		XPath path = compileXPath(dc, xpath);
170
171
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
172
		ResultSequence rs = eval.evaluate(path);
173
174
		XSBoolean result = (XSBoolean) rs.first();
175
176
		String actual = result.string_value();
177
178
		assertEquals("true", actual);
179
	}
180
	
181
	public void testAnyUriEqualityBug() throws Exception {
182
		// Bug 274719
183
		// reusing the XML document from another bug
184
		URL fileURL = bundle.getEntry("/bugTestFiles/bug274471.xml");
185
		loadDOMDocument(fileURL);
186
		
187
		// Get XML Schema Information for the Document
188
		XSModel schema = getGrammar();
189
190
		DynamicContext dc = setupDynamicContext(schema);
191
		
192
		String xpath = "xs:anyURI('abc') eq xs:anyURI('abc')";
193
		XPath path = compileXPath(dc, xpath);
194
195
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
196
		ResultSequence rs = eval.evaluate(path);
197
198
		XSBoolean result = (XSBoolean) rs.first();
199
200
		String actual = result.string_value();
201
202
		assertEquals("true", actual);
203
	}
204
	
205
	public void testBaseUriBug() throws Exception {
206
		// Bug 274725
207
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
208
		DocumentBuilder docBuilder = dbf.newDocumentBuilder();
209
		
210
		// for testing this bug, we read the XML document from the web. 
211
		// this ensures, that base-uri property of DOM is not null.
212
		domDoc = docBuilder.parse("http://www.w3schools.com/xml/note.xml");
213
214
		// we pass XSModel as null for this test case. Otherwise, we would
215
		// get an exception.
216
		DynamicContext dc = setupDynamicContext(null);
217
		
218
		String xpath = "base-uri(note) eq xs:anyURI('http://www.w3schools.com/xml/note.xml')";
219
		
220
		// please note: The below XPath would also work, with base-uri using arity 0.
221
		//String xpath = "note/base-uri() eq xs:anyURI('http://www.w3schools.com/xml/note.xml')";
222
		
223
		XPath path = compileXPath(dc, xpath);
224
225
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
226
		ResultSequence rs = eval.evaluate(path);
227
228
		XSBoolean result = (XSBoolean) rs.first();
229
230
		String actual = result.string_value();
231
232
		assertEquals("true", actual);
233
	}
234
	
235
	public void testDocumentUriBug() throws Exception {
236
		// Bug 274731
237
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
238
		DocumentBuilder docBuilder = dbf.newDocumentBuilder();
239
		
240
		domDoc = docBuilder.parse("http://www.w3schools.com/xml/note.xml");
241
242
		DynamicContext dc = setupDynamicContext(null);
243
		
244
		String xpath = "document-uri(/) eq xs:anyURI('http://www.w3schools.com/xml/note.xml')";
245
		
246
		XPath path = compileXPath(dc, xpath);
247
248
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
249
		ResultSequence rs = eval.evaluate(path);
250
251
		XSBoolean result = (XSBoolean) rs.first();
252
253
		String actual = "false";
254
		
255
		if (result != null) {
256
		  actual = result.string_value();
257
		}
258
259
		assertEquals("true", actual);
260
	}
261
	
262
	public void testBooleanTypeBug() throws Exception {
263
		// Bug 274784
264
		// reusing the XML document from another bug
265
		URL fileURL = bundle.getEntry("/bugTestFiles/bug273719.xml");
266
		loadDOMDocument(fileURL);
267
		
268
		// Get XML Schema Information for the Document
269
		XSModel schema = getGrammar();
270
271
		DynamicContext dc = setupDynamicContext(schema);
272
		
273
		String xpath = "xs:boolean('1') eq xs:boolean('true')";
274
		XPath path = compileXPath(dc, xpath);
275
276
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
277
		ResultSequence rs = eval.evaluate(path);
278
279
		XSBoolean result = (XSBoolean) rs.first();
280
281
		String actual = result.string_value();
282
283
		assertEquals("true", actual);
284
	}
285
	
286
	public void testDateConstructorBug() throws Exception {
287
		// Bug 274792
288
		URL fileURL = bundle.getEntry("/bugTestFiles/bug274792.xml");
289
		loadDOMDocument(fileURL);
290
		
291
		// Get XML Schema Information for the Document
292
		XSModel schema = getGrammar();
293
294
		DynamicContext dc = setupDynamicContext(schema);
295
		
296
		String xpath = "xs:date('2009-01-01') eq xs:date('2009-01-01')";
297
		XPath path = compileXPath(dc, xpath);
298
299
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
300
		ResultSequence rs = eval.evaluate(path);
301
302
		XSBoolean result = (XSBoolean) rs.first();
303
304
		String actual = result.string_value();
305
306
		assertEquals("true", actual);
307
	}
308
	
309
	public void testIntegerDataTypeBug() throws Exception {
310
		// Bug 274805
311
		URL fileURL = bundle.getEntry("/bugTestFiles/bug274805.xml");
312
		loadDOMDocument(fileURL);
313
		
314
		// Get XML Schema Information for the Document
315
		XSModel schema = getGrammar();
316
317
		DynamicContext dc = setupDynamicContext(schema);
318
		
319
		// xs:integer by definition is from -INF to +INF
320
		String xpath = "xs:integer(x) gt 100";
321
		XPath path = compileXPath(dc, xpath);
322
323
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
324
		ResultSequence rs = eval.evaluate(path);
325
326
		XSBoolean result = (XSBoolean) rs.first();
327
328
		String actual = result.string_value();
329
330
		assertEquals("true", actual);
331
	}
332
	
333
	public void testLongDataType() throws Exception {
334
		// Bug 274952
335
		URL fileURL = bundle.getEntry("/TestSources/emptydoc.xml");
336
		loadDOMDocument(fileURL);
337
		
338
		// Get XML Schema Information for the Document
339
		XSModel schema = getGrammar();
340
341
		DynamicContext dc = setupDynamicContext(schema);
342
		
343
		// long min value is -9223372036854775808
344
		// and max value can be 9223372036854775807
345
		String xpath = "xs:long('9223372036854775807') gt 0";
346
		XPath path = compileXPath(dc, xpath);
347
348
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
349
		ResultSequence rs = eval.evaluate(path);
350
351
		XSBoolean result = (XSBoolean) rs.first();
352
353
		String actual = result.string_value();
354
355
		assertEquals("true", actual);
356
	}
357
	
358
	public void testIntDataType() throws Exception {
359
		// Bug 275105
360
		URL fileURL = bundle.getEntry("/TestSources/emptydoc.xml");
361
		loadDOMDocument(fileURL);
362
		
363
		// Get XML Schema Information for the Document
364
		XSModel schema = getGrammar();
365
366
		DynamicContext dc = setupDynamicContext(schema);
367
		
368
		// int min value is -2147483648
369
		// and max value can be 2147483647
370
		String xpath = "xs:int('2147483647') gt 0";
371
		XPath path = compileXPath(dc, xpath);
372
373
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
374
		ResultSequence rs = eval.evaluate(path);
375
376
		XSBoolean result = (XSBoolean) rs.first();
377
378
		String actual = result.string_value();
379
380
		assertEquals("true", actual);
381
	}
382
	
383
	public void testSchemaAwarenessForAttributes() throws Exception {
384
		// Bug 276134
385
		URL fileURL = bundle.getEntry("/bugTestFiles/bug276134.xml");
386
		URL schemaURL = bundle.getEntry("/bugTestFiles/bug276134.xsd");
387
388
		loadDOMDocument(fileURL, schemaURL);
389
		
390
		// Get XSModel object for the Schema
391
		XSModel schema = getGrammar();
392
393
		DynamicContext dc = setupDynamicContext(schema);
394
		
395
		String xpath = "person/@dob eq xs:date('2006-12-10')";
396
		XPath path = compileXPath(dc, xpath);
397
398
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
399
		ResultSequence rs = eval.evaluate(path);
400
401
		XSBoolean result = (XSBoolean) rs.first();
402
403
		String actual = result.string_value();
404
405
		assertEquals("true", actual);
406
	}
407
	
408
	public void testSchemaAwarenessForElements() throws Exception {
409
		// Bug 276134
410
		URL fileURL = bundle.getEntry("/bugTestFiles/bug276134_2.xml");
411
		URL schemaURL = bundle.getEntry("/bugTestFiles/bug276134_2.xsd");
412
413
		loadDOMDocument(fileURL, schemaURL);
414
		
415
		// Get XSModel object for the Schema
416
		XSModel schema = getGrammar();
417
418
		DynamicContext dc = setupDynamicContext(schema);
419
		
420
		String xpath = "person/dob eq xs:date('2006-12-10')";
421
		XPath path = compileXPath(dc, xpath);
422
423
		Evaluator eval = new DefaultEvaluator(dc, domDoc);
424
		ResultSequence rs = eval.evaluate(path);
425
426
		XSBoolean result = (XSBoolean) rs.first();
427
428
		String actual = result.string_value();
429
430
		assertEquals("true", actual);
431
	}
97
432
98
}
433
}
(-)bugTestFiles/bug276134_2.xml (+6 lines)
Added Link Here
1
<person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2
  <id>100</id>
3
  <fname>Mukul</fname>
4
  <lname>Gandhi</lname>
5
  <dob>2006-12-10</dob>
6
</person>
(-)bugTestFiles/bug276134.xsd (+14 lines)
Added Link Here
1
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
2
 
3
  <xs:element name="person">
4
   <xs:complexType>
5
    <xs:sequence>
6
     <xs:element name="fname" type = "xs:string" />
7
     <xs:element name="lname" type = "xs:string" />
8
    </xs:sequence>
9
    <xs:attribute name="id" type="xs:integer" />
10
    <xs:attribute name="dob" type="xs:date" />
11
   </xs:complexType>
12
  </xs:element>
13
 
14
</xs:schema>
(-)bugTestFiles/bug276134.xml (+4 lines)
Added Link Here
1
<person id="100" dob="2006-12-10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2
  <fname>Mukul</fname>
3
  <lname>Gandhi</lname>
4
</person>
(-)bugTestFiles/bug276134_2.xsd (+14 lines)
Added Link Here
1
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
2
 
3
  <xs:element name="person">
4
   <xs:complexType>
5
    <xs:sequence>
6
     <xs:element name="id" type = "xs:integer" />
7
     <xs:element name="fname" type = "xs:string" />
8
     <xs:element name="lname" type = "xs:string" />
9
     <xs:element name="dob" type = "xs:date" />
10
    </xs:sequence>
11
   </xs:complexType>
12
  </xs:element>
13
 
14
</xs:schema>

Return to bug 276134