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/internal/function/FsEq.java (-2 / +4 lines)
Lines 6-12 Link Here
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 
9
 *     Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0
10
 *     Mukul Gandhi - bug 276134 - improvements to schema aware support for attribute nodes
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.wst.xml.xpath2.processor.internal.function;
13
package org.eclipse.wst.xml.xpath2.processor.internal.function;
Lines 64-70 Link Here
64
		for (Iterator i = args.iterator(); i.hasNext();) {
65
		for (Iterator i = args.iterator(); i.hasNext();) {
65
			ResultSequence rs = (ResultSequence) i.next();
66
			ResultSequence rs = (ResultSequence) i.next();
66
67
67
			FnData.fast_atomize(rs);
68
			//FnData.fast_atomize(rs);
69
			rs = FnData.atomize(rs);
68
70
69
			if (rs.empty())
71
			if (rs.empty())
70
				return new ArrayList();
72
				return new ArrayList();
(-)src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnData.java (-8 / +14 lines)
Lines 6-22 Link Here
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 
9
 *     Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0
10
 *     Mukul Gandhi - bug 276134 - improvements to schema aware support for attribute nodes 
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.wst.xml.xpath2.processor.internal.function;
13
package org.eclipse.wst.xml.xpath2.processor.internal.function;
13
14
15
import java.util.Collection;
16
import java.util.Iterator;
17
import java.util.ListIterator;
18
14
import org.eclipse.wst.xml.xpath2.processor.ResultSequence;
19
import org.eclipse.wst.xml.xpath2.processor.ResultSequence;
15
import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory;
20
import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory;
16
import org.eclipse.wst.xml.xpath2.processor.internal.*;
21
import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType;
17
import org.eclipse.wst.xml.xpath2.processor.internal.types.*;
22
import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType;
18
23
import org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType;
19
import java.util.*;
24
import org.eclipse.wst.xml.xpath2.processor.internal.types.QName;
20
25
21
/**
26
/**
22
 * fn:data takes a sequence of items and returns a sequence of atomic values.
27
 * fn:data takes a sequence of items and returns a sequence of atomic values.
Lines 65-78 Link Here
65
		for (Iterator i = arg.iterator(); i.hasNext();) {
70
		for (Iterator i = arg.iterator(); i.hasNext();) {
66
			AnyType at = (AnyType) i.next();
71
			AnyType at = (AnyType) i.next();
67
72
68
			if (at instanceof AnyAtomicType)
73
			if (at instanceof AnyAtomicType) {
69
				rs.add(at);
74
				rs.add(at);
75
			}
70
			else if (at instanceof NodeType) {
76
			else if (at instanceof NodeType) {
71
				NodeType nt = (NodeType) at;
77
				NodeType nt = (NodeType) at;
72
73
				rs.concat(nt.typed_value());
78
				rs.concat(nt.typed_value());
74
			} else
79
			} else {
75
				assert false;
80
				assert false;
81
			}
76
		}
82
		}
77
83
78
		return rs;
84
		return rs;
(-)src/org/eclipse/wst/xml/xpath2/processor/XercesLoader.java (-3 / +18 lines)
Lines 6-12 Link Here
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 
9
 *     Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0
10
 *     Mukul Gandhi - bug 276134 - improvements to schema aware support for attribute nodes 
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.wst.xml.xpath2.processor;
13
package org.eclipse.wst.xml.xpath2.processor;
Lines 15-20 Link Here
15
16
16
import org.w3c.dom.*;
17
import org.w3c.dom.*;
17
import javax.xml.parsers.*;
18
import javax.xml.parsers.*;
19
import javax.xml.validation.Schema;
20
18
import org.xml.sax.*;
21
import org.xml.sax.*;
19
22
20
/**
23
/**
Lines 41-46 Link Here
41
	public static final String DOCUMENT_PSVI_IMPLEMENTATION = "org.apache.xerces.dom.PSVIDocumentImpl";
44
	public static final String DOCUMENT_PSVI_IMPLEMENTATION = "org.apache.xerces.dom.PSVIDocumentImpl";
42
45
43
	boolean _validating;
46
	boolean _validating;
47
	
48
	Schema _schema = null;;
44
49
45
	/**
50
	/**
46
	 * Constructor for Xerxes loader.
51
	 * Constructor for Xerxes loader.
Lines 48-53 Link Here
48
	public XercesLoader() {
53
	public XercesLoader() {
49
		_validating = false;
54
		_validating = false;
50
	}
55
	}
56
	
57
	public XercesLoader(Schema schema) {
58
		_validating = false;
59
		_schema = schema;
60
	}
51
61
52
	/**
62
	/**
53
	 * The Xerces loader loads the XML docuemnt
63
	 * The Xerces loader loads the XML docuemnt
Lines 64-75 Link Here
64
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
74
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
65
75
66
		factory.setNamespaceAware(true);
76
		factory.setNamespaceAware(true);
67
		factory.setValidating(_validating);
68
		factory.setAttribute(SCHEMA_VALIDATION_FEATURE,
77
		factory.setAttribute(SCHEMA_VALIDATION_FEATURE,
69
				new Boolean(_validating));
78
				new Boolean(_validating));
70
		factory.setAttribute(DOCUMENT_IMPLEMENTATION_PROPERTY,
79
		factory.setAttribute(DOCUMENT_IMPLEMENTATION_PROPERTY,
71
				DOCUMENT_PSVI_IMPLEMENTATION);
80
				DOCUMENT_PSVI_IMPLEMENTATION);
72
		// factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
81
		
82
		if (_schema != null) {
83
		  factory.setSchema(_schema);
84
		}
85
		else {
86
		  factory.setValidating(_validating);	
87
		}
73
88
74
		try {
89
		try {
75
			DocumentBuilder builder = factory.newDocumentBuilder();
90
			DocumentBuilder builder = factory.newDocumentBuilder();
(-)src/org/eclipse/wst/xml/xpath2/processor/internal/types/AttrType.java (-7 / +38 lines)
Lines 6-20 Link Here
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 
9
 *     Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0
10
 *     Mukul Gandhi - bug 276134 - improvements to schema aware support for attribute nodes 
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.wst.xml.xpath2.processor.internal.types;
13
package org.eclipse.wst.xml.xpath2.processor.internal.types;
13
14
14
import org.w3c.dom.*;
15
import java.math.BigInteger;
16
17
import org.apache.xerces.dom.PSVIAttrNSImpl;
18
import org.apache.xerces.xs.XSTypeDefinition;
15
import org.eclipse.wst.xml.xpath2.processor.ResultSequence;
19
import org.eclipse.wst.xml.xpath2.processor.ResultSequence;
16
import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory;
20
import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory;
17
import org.eclipse.wst.xml.xpath2.processor.internal.*;
21
import org.w3c.dom.Attr;
18
22
19
/**
23
/**
20
 * A representation of the AttributeType datatype
24
 * A representation of the AttributeType datatype
Lines 72-81 Link Here
72
	@Override
76
	@Override
73
	public ResultSequence typed_value() {
77
	public ResultSequence typed_value() {
74
		ResultSequence rs = ResultSequenceFactory.create_new();
78
		ResultSequence rs = ResultSequenceFactory.create_new();
75
79
		
76
		// XXX with no PSVI
80
		PSVIAttrNSImpl psviAttr = (PSVIAttrNSImpl)_value;
77
		rs.add(new UntypedAtomic(string_value()));
81
		XSTypeDefinition typeDef = psviAttr.getTypeDefinition();
78
82
		
83
		if (typeDef != null) {
84
		  if (typeDef.getName().equals("date")) {		
85
		     rs.add(XSDate.parse_date(string_value()));
86
		  }
87
		  else if (typeDef.getName().equals("int")) {		
88
	         rs.add(new XSInt(new BigInteger(string_value())));
89
		  }
90
		  else if (typeDef.getName().equals("long")) {		
91
		     rs.add(new XSLong(new BigInteger(string_value())));
92
	      }
93
		  else if (typeDef.getName().equals("integer")) {		
94
		     rs.add(new XSInteger(new BigInteger(string_value())));
95
		  }
96
		  else if (typeDef.getName().equals("double")) {		
97
		     rs.add(new XSDouble(Double.parseDouble(string_value())));
98
		  }
99
		  else if (typeDef.getName().equals("float")) {		
100
		    rs.add(new XSFloat(Float.parseFloat(string_value())));
101
	      }
102
		  else if (typeDef.getName().equals("decimal")) {		
103
		    rs.add(new XSDecimal(Double.parseDouble(string_value())));
104
		  }
105
	    } else {
106
		   // construct an 'untypedatomic' value
107
		   rs.add(new UntypedAtomic(string_value()));	
108
		}
109
		
79
		return rs;
110
		return rs;
80
	}
111
	}
81
112

Return to bug 276134