|
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 primitive type support |
| 11 |
* for attribute/element nodes |
| 10 |
*******************************************************************************/ |
12 |
*******************************************************************************/ |
| 11 |
|
13 |
|
| 12 |
package org.eclipse.wst.xml.xpath2.processor.internal.types; |
14 |
package org.eclipse.wst.xml.xpath2.processor.internal.types; |
| 13 |
|
15 |
|
| 14 |
import org.w3c.dom.*; |
16 |
import java.math.BigInteger; |
|
|
17 |
import java.util.ArrayList; |
| 18 |
import java.util.Hashtable; |
| 19 |
import java.util.Iterator; |
| 20 |
|
| 21 |
import org.apache.xerces.xs.XSTypeDefinition; |
| 15 |
import org.eclipse.wst.xml.xpath2.processor.ResultSequence; |
22 |
import org.eclipse.wst.xml.xpath2.processor.ResultSequence; |
| 16 |
import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; |
23 |
import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; |
| 17 |
import org.eclipse.wst.xml.xpath2.processor.internal.*; |
24 |
import org.w3c.dom.Attr; |
| 18 |
|
25 |
import org.w3c.dom.Comment; |
| 19 |
import java.util.*; |
26 |
import org.w3c.dom.Document; |
|
|
27 |
import org.w3c.dom.Element; |
| 28 |
import org.w3c.dom.Node; |
| 29 |
import org.w3c.dom.ProcessingInstruction; |
| 30 |
import org.w3c.dom.Text; |
| 20 |
|
31 |
|
| 21 |
/** |
32 |
/** |
| 22 |
* A representation of a Node datatype |
33 |
* A representation of a Node datatype |
|
Lines 175-178
Link Here
|
| 175 |
|
186 |
|
| 176 |
return !before(a, b); |
187 |
return !before(a, b); |
| 177 |
} |
188 |
} |
|
|
189 |
|
| 190 |
protected Object getTypedValueForPrimitiveType(XSTypeDefinition typeDef) { |
| 191 |
Object schemaTypeValue = null; |
| 192 |
|
| 193 |
if (typeDef.getName().equals("date")) { |
| 194 |
schemaTypeValue = XSDate.parse_date(string_value()); |
| 195 |
} |
| 196 |
else if (typeDef.getName().equals("int")) { |
| 197 |
schemaTypeValue = new XSInt(new BigInteger(string_value())); |
| 198 |
} |
| 199 |
else if (typeDef.getName().equals("long")) { |
| 200 |
schemaTypeValue = new XSLong(new BigInteger(string_value())); |
| 201 |
} |
| 202 |
else if (typeDef.getName().equals("integer")) { |
| 203 |
schemaTypeValue = new XSInteger(new BigInteger(string_value())); |
| 204 |
} |
| 205 |
else if (typeDef.getName().equals("double")) { |
| 206 |
schemaTypeValue = new XSDouble(Double.parseDouble(string_value())); |
| 207 |
} |
| 208 |
else if (typeDef.getName().equals("float")) { |
| 209 |
schemaTypeValue = new XSFloat(Float.parseFloat(string_value())); |
| 210 |
} |
| 211 |
else if (typeDef.getName().equals("decimal")) { |
| 212 |
schemaTypeValue = new XSDecimal(Double.parseDouble(string_value())); |
| 213 |
} |
| 214 |
|
| 215 |
return schemaTypeValue; |
| 216 |
} |
| 178 |
} |
217 |
} |