Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 136887 Details for
Bug 276134
[xpath2] improvements to schema aware primitive type support for attribute/element nodes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Merged patch
clipboard.txt (text/plain), 23.26 KB, created by
David Carver
on 2009-05-23 11:36:25 EDT
(
hide
)
Description:
Merged patch
Filename:
MIME Type:
Creator:
David Carver
Created:
2009-05-23 11:36:25 EDT
Size:
23.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.xml.xpath2.processor.tests >Index: src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java,v >retrieving revision 1.4 >diff -u -r1.4 AbstractPsychoPathTest.java >--- src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java 23 May 2009 00:24:02 -0000 1.4 >+++ src/org/eclipse/wst/xml/xpath2/processor/test/AbstractPsychoPathTest.java 23 May 2009 15:35:18 -0000 >@@ -20,6 +20,11 @@ > import java.util.regex.Matcher; > import java.util.regex.Pattern; > >+import javax.xml.XMLConstants; >+import javax.xml.transform.stream.StreamSource; >+import javax.xml.validation.Schema; >+import javax.xml.validation.SchemaFactory; >+ > import org.apache.xerces.xs.ElementPSVI; > import org.apache.xerces.xs.XSModel; > import org.eclipse.core.runtime.Platform; >@@ -31,6 +36,7 @@ > import org.eclipse.wst.xml.xpath2.processor.internal.types.QName; > import org.osgi.framework.Bundle; > import org.w3c.dom.Document; >+import org.xml.sax.SAXException; > > import junit.framework.TestCase; > >@@ -64,6 +70,21 @@ > domloader.set_validating(false); > domDoc = domloader.load(is); > } >+ >+ protected void loadDOMDocument(URL fileURL, URL schemaURL) throws Exception { >+ InputStream is = fileURL.openStream(); >+ InputStream schemaIs = schemaURL.openStream(); >+ DOMLoader domloader = new XercesLoader(getSchema(schemaIs)); >+ domDoc = domloader.load(is); >+ } >+ >+ private Schema getSchema(InputStream schemaIs) throws SAXException { >+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); >+ Schema schema = sf.newSchema(new StreamSource(schemaIs)); >+ >+ return schema; >+ } >+ > > @Override > protected void tearDown() throws Exception { >Index: src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/tests/org.eclipse.wst.xml.xpath2.processor.tests/src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java,v >retrieving revision 1.12 >diff -u -r1.12 TestBugs.java >--- src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java 23 May 2009 02:35:22 -0000 1.12 >+++ src/org/eclipse/wst/xml/xpath2/processor/test/TestBugs.java 23 May 2009 15:35:18 -0000 >@@ -375,4 +375,54 @@ > assertEquals("true", actual); > } > >+ public void testSchemaAwarenessForAttributes() throws Exception { >+ // Bug 276134 >+ URL fileURL = bundle.getEntry("/bugTestFiles/bug276134.xml"); >+ URL schemaURL = bundle.getEntry("/bugTestFiles/bug276134.xsd"); >+ >+ loadDOMDocument(fileURL, schemaURL); >+ >+ // Get XSModel object for the Schema >+ XSModel schema = getGrammar(); >+ >+ DynamicContext dc = setupDynamicContext(schema); >+ >+ String xpath = "person/@dob eq xs:date('2006-12-10')"; >+ XPath path = compileXPath(dc, xpath); >+ >+ Evaluator eval = new DefaultEvaluator(dc, domDoc); >+ ResultSequence rs = eval.evaluate(path); >+ >+ XSBoolean result = (XSBoolean) rs.first(); >+ >+ String actual = result.string_value(); >+ >+ assertEquals("true", actual); >+ } >+ >+ public void testSchemaAwarenessForElements() throws Exception { >+ // Bug 276134 >+ URL fileURL = bundle.getEntry("/bugTestFiles/bug276134_2.xml"); >+ URL schemaURL = bundle.getEntry("/bugTestFiles/bug276134_2.xsd"); >+ >+ loadDOMDocument(fileURL, schemaURL); >+ >+ // Get XSModel object for the Schema >+ XSModel schema = getGrammar(); >+ >+ DynamicContext dc = setupDynamicContext(schema); >+ >+ String xpath = "person/dob eq xs:date('2006-12-10')"; >+ XPath path = compileXPath(dc, xpath); >+ >+ Evaluator eval = new DefaultEvaluator(dc, domDoc); >+ ResultSequence rs = eval.evaluate(path); >+ >+ XSBoolean result = (XSBoolean) rs.first(); >+ >+ String actual = result.string_value(); >+ >+ assertEquals("true", actual); >+ } >+ > } >Index: .settings/org.eclipse.core.resources.prefs >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/tests/org.eclipse.wst.xml.xpath2.processor.tests/.settings/org.eclipse.core.resources.prefs,v >retrieving revision 1.1 >diff -u -r1.1 org.eclipse.core.resources.prefs >--- .settings/org.eclipse.core.resources.prefs 29 Apr 2009 04:28:11 -0000 1.1 >+++ .settings/org.eclipse.core.resources.prefs 23 May 2009 15:35:18 -0000 >@@ -1,3 +1,5 @@ >-#Tue Apr 28 23:45:15 GMT 2009 >+#Sat May 23 15:26:34 GMT 2009 > eclipse.preferences.version=1 >+encoding//bugTestFiles/bug276134.xsd=UTF8 >+encoding//bugTestFiles/bug276134_2.xsd=UTF8 > encoding/XQTSCatalog.xsd=UTF8 >Index: bugTestFiles/bug276134_2.xsd >=================================================================== >RCS file: bugTestFiles/bug276134_2.xsd >diff -N bugTestFiles/bug276134_2.xsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bugTestFiles/bug276134_2.xsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+<?xml version="1.0" encoding="UTF-8" standalone="no"?> >+<!-- >+/******************************************************************************* >+ * Copyright (c) 2009 Mukul Gandhi and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Mukul Gandhi - bug 276134 - initial API and implementation >+ ******************************************************************************* >+ --> >+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> >+ >+ <xs:element name="person"> >+ <xs:complexType> >+ <xs:sequence> >+ <xs:element name="id" type="xs:integer"/> >+ <xs:element name="fname" type="xs:string"/> >+ <xs:element name="lname" type="xs:string"/> >+ <xs:element name="dob" type="xs:date"/> >+ </xs:sequence> >+ </xs:complexType> >+ </xs:element> >+ >+</xs:schema> >Index: bugTestFiles/bug276134.xml >=================================================================== >RCS file: bugTestFiles/bug276134.xml >diff -N bugTestFiles/bug276134.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bugTestFiles/bug276134.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+ >+<!-- >+/******************************************************************************* >+ * Copyright (c) 2009 Mukul Gandhi and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Mukul Gandhi - bug 276134 - initial API and implementation >+ ******************************************************************************* >+ --> >+<person id="100" dob="2006-12-10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> >+ <fname>Mukul</fname> >+ <lname>Gandhi</lname> >+</person> >\ No newline at end of file >Index: bugTestFiles/bug276134.xsd >=================================================================== >RCS file: bugTestFiles/bug276134.xsd >diff -N bugTestFiles/bug276134.xsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bugTestFiles/bug276134.xsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<!-- >+/******************************************************************************* >+ * Copyright (c) 2009 Mukul Gandhi and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Mukul Gandhi - bug 276134 - initial API and implementation >+ ******************************************************************************* >+ --> >+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> >+ >+ <xs:element name="person"> >+ <xs:complexType> >+ <xs:sequence> >+ <xs:element name="fname" type = "xs:string" /> >+ <xs:element name="lname" type = "xs:string" /> >+ </xs:sequence> >+ <xs:attribute name="id" type="xs:integer" /> >+ <xs:attribute name="dob" type="xs:date" /> >+ </xs:complexType> >+ </xs:element> >+ >+</xs:schema> >\ No newline at end of file >Index: bugTestFiles/bug276134_2.xml >=================================================================== >RCS file: bugTestFiles/bug276134_2.xml >diff -N bugTestFiles/bug276134_2.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bugTestFiles/bug276134_2.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<!-- >+/******************************************************************************* >+ * Copyright (c) 2009 Mukul Gandhi and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Mukul Gandhi - bug 276134 - initial API and implementation >+ ******************************************************************************* >+ --> >+<person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> >+ <id>100</id> >+ <fname>Mukul</fname> >+ <lname>Gandhi</lname> >+ <dob>2006-12-10</dob> >+</person> >\ No newline at end of file >Index: NewFile.xml >=================================================================== >RCS file: NewFile.xml >diff -N NewFile.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ NewFile.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+<?xml version="1.0" encoding="UTF-8"?> >#P org.eclipse.wst.xml.xpath2.processor >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/AttrType.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/AttrType.java,v >retrieving revision 1.1 >diff -u -r1.1 AttrType.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/AttrType.java 27 Apr 2009 15:07:07 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/AttrType.java 23 May 2009 15:35:18 -0000 >@@ -6,15 +6,19 @@ > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Mukul Gandhi - bug 276134 - improvements to schema aware primitive type support >+ * for attribute/element nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >-import org.w3c.dom.*; >+import org.apache.xerces.dom.PSVIAttrNSImpl; >+import org.apache.xerces.xs.XSTypeDefinition; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >-import org.eclipse.wst.xml.xpath2.processor.internal.*; >+import org.eclipse.wst.xml.xpath2.processor.function.XSCtrLibrary; >+import org.w3c.dom.Attr; > > /** > * A representation of the AttributeType datatype >@@ -72,10 +76,22 @@ > @Override > public ResultSequence typed_value() { > ResultSequence rs = ResultSequenceFactory.create_new(); >- >- // XXX with no PSVI >- rs.add(new UntypedAtomic(string_value())); >- >+ >+ PSVIAttrNSImpl psviAttr = (PSVIAttrNSImpl)_value; >+ XSTypeDefinition typeDef = psviAttr.getTypeDefinition(); >+ >+ if (typeDef != null && typeDef.getNamespace().equals(XSCtrLibrary.XML_SCHEMA_NS)) { >+ Object schemaTypeValue = getTypedValueForPrimitiveType(typeDef); >+ if (schemaTypeValue != null) { >+ rs.add((AnyType)schemaTypeValue); >+ } >+ else { >+ rs.add(new UntypedAtomic(string_value())); >+ } >+ } else { >+ rs.add(new UntypedAtomic(string_value())); >+ } >+ > return rs; > } > >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/ElementType.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/ElementType.java,v >retrieving revision 1.1 >diff -u -r1.1 ElementType.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/ElementType.java 27 Apr 2009 15:07:08 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/ElementType.java 23 May 2009 15:35:18 -0000 >@@ -6,15 +6,22 @@ > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Mukul Gandhi - bug 276134 - improvements to schema aware primitive type support >+ * for attribute/element nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >-import org.w3c.dom.*; >+import org.apache.xerces.dom.PSVIElementNSImpl; >+import org.apache.xerces.xs.XSTypeDefinition; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >-import org.eclipse.wst.xml.xpath2.processor.internal.*; >+import org.eclipse.wst.xml.xpath2.processor.function.XSCtrLibrary; >+import org.w3c.dom.Element; >+import org.w3c.dom.Node; >+import org.w3c.dom.NodeList; >+import org.w3c.dom.Text; > > /** > * A representation of the ElementType datatype >@@ -90,10 +97,22 @@ > */ > @Override > public ResultSequence typed_value() { >- ResultSequence rs = ResultSequenceFactory.create_new(); >- >- // XXX only if PSVI is not present!! [not our case] >- rs.add(new UntypedAtomic(string_value())); >+ ResultSequence rs = ResultSequenceFactory.create_new(); >+ >+ PSVIElementNSImpl psviElem = (PSVIElementNSImpl)_value; >+ XSTypeDefinition typeDef = psviElem.getTypeDefinition(); >+ >+ if (typeDef != null && typeDef.getNamespace().equals(XSCtrLibrary.XML_SCHEMA_NS)) { >+ Object schemaTypeValue = getTypedValueForPrimitiveType(typeDef); >+ if (schemaTypeValue != null) { >+ rs.add((AnyType)schemaTypeValue); >+ } >+ else { >+ rs.add(new UntypedAtomic(string_value())); >+ } >+ } else { >+ rs.add(new UntypedAtomic(string_value())); >+ } > > return rs; > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/types/NodeType.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/types/NodeType.java,v >retrieving revision 1.1 >diff -u -r1.1 NodeType.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/types/NodeType.java 27 Apr 2009 15:07:07 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/types/NodeType.java 23 May 2009 15:35:18 -0000 >@@ -6,17 +6,28 @@ > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Mukul Gandhi - bug 276134 - improvements to schema aware primitive type support >+ * for attribute/element nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >-import org.w3c.dom.*; >+import java.math.BigInteger; >+import java.util.ArrayList; >+import java.util.Hashtable; >+import java.util.Iterator; >+ >+import org.apache.xerces.xs.XSTypeDefinition; > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >-import org.eclipse.wst.xml.xpath2.processor.internal.*; >- >-import java.util.*; >+import org.w3c.dom.Attr; >+import org.w3c.dom.Comment; >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; >+import org.w3c.dom.Node; >+import org.w3c.dom.ProcessingInstruction; >+import org.w3c.dom.Text; > > /** > * A representation of a Node datatype >@@ -175,4 +186,32 @@ > > return !before(a, b); > } >+ >+ protected Object getTypedValueForPrimitiveType(XSTypeDefinition typeDef) { >+ Object schemaTypeValue = null; >+ >+ if (typeDef.getName().equals("date")) { >+ schemaTypeValue = XSDate.parse_date(string_value()); >+ } >+ else if (typeDef.getName().equals("int")) { >+ schemaTypeValue = new XSInt(new BigInteger(string_value())); >+ } >+ else if (typeDef.getName().equals("long")) { >+ schemaTypeValue = new XSLong(new BigInteger(string_value())); >+ } >+ else if (typeDef.getName().equals("integer")) { >+ schemaTypeValue = new XSInteger(new BigInteger(string_value())); >+ } >+ else if (typeDef.getName().equals("double")) { >+ schemaTypeValue = new XSDouble(Double.parseDouble(string_value())); >+ } >+ else if (typeDef.getName().equals("float")) { >+ schemaTypeValue = new XSFloat(Float.parseFloat(string_value())); >+ } >+ else if (typeDef.getName().equals("decimal")) { >+ schemaTypeValue = new XSDecimal(Double.parseDouble(string_value())); >+ } >+ >+ return schemaTypeValue; >+ } > } >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnData.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnData.java,v >retrieving revision 1.1 >diff -u -r1.1 FnData.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnData.java 27 Apr 2009 15:06:56 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FnData.java 23 May 2009 15:35:18 -0000 >@@ -6,17 +6,23 @@ > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Mukul Gandhi - bug 276134 - improvements to schema aware primitive type support >+ * for attribute/element nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; > >+import java.util.Collection; >+import java.util.Iterator; >+import java.util.ListIterator; >+ > import org.eclipse.wst.xml.xpath2.processor.ResultSequence; > import org.eclipse.wst.xml.xpath2.processor.ResultSequenceFactory; >-import org.eclipse.wst.xml.xpath2.processor.internal.*; >-import org.eclipse.wst.xml.xpath2.processor.internal.types.*; >- >-import java.util.*; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyAtomicType; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.AnyType; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.NodeType; >+import org.eclipse.wst.xml.xpath2.processor.internal.types.QName; > > /** > * fn:data takes a sequence of items and returns a sequence of atomic values. >@@ -65,14 +71,15 @@ > for (Iterator i = arg.iterator(); i.hasNext();) { > AnyType at = (AnyType) i.next(); > >- if (at instanceof AnyAtomicType) >+ if (at instanceof AnyAtomicType) { > rs.add(at); >+ } > else if (at instanceof NodeType) { > NodeType nt = (NodeType) at; >- > rs.concat(nt.typed_value()); >- } else >+ } else { > assert false; >+ } > } > > return rs; >Index: src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsEq.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsEq.java,v >retrieving revision 1.1 >diff -u -r1.1 FsEq.java >--- src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsEq.java 27 Apr 2009 15:06:58 -0000 1.1 >+++ src/org/eclipse/wst/xml/xpath2/processor/internal/function/FsEq.java 23 May 2009 15:35:18 -0000 >@@ -6,7 +6,9 @@ > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Mukul Gandhi - bug 276134 - improvements to schema aware primitive type support >+ * for attribute/element nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; >@@ -64,7 +66,8 @@ > for (Iterator i = args.iterator(); i.hasNext();) { > ResultSequence rs = (ResultSequence) i.next(); > >- FnData.fast_atomize(rs); >+ //FnData.fast_atomize(rs); >+ rs = FnData.atomize(rs); > > if (rs.empty()) > return new ArrayList(); >Index: src/org/eclipse/wst/xml/xpath2/processor/XercesLoader.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.xpath2.processor/src/org/eclipse/wst/xml/xpath2/processor/XercesLoader.java,v >retrieving revision 1.4 >diff -u -r1.4 XercesLoader.java >--- src/org/eclipse/wst/xml/xpath2/processor/XercesLoader.java 27 Apr 2009 15:07:08 -0000 1.4 >+++ src/org/eclipse/wst/xml/xpath2/processor/XercesLoader.java 23 May 2009 15:35:18 -0000 >@@ -6,7 +6,9 @@ > * http://www.eclipse.org/legal/epl-v10.html > * > * Contributors: >- * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Andrea Bittau - initial API and implementation from the PsychoPath XPath 2.0 >+ * Mukul Gandhi - bug 276134 - improvements to schema aware primitive type support >+ * for attribute/element nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor; >@@ -15,6 +17,8 @@ > > import org.w3c.dom.*; > import javax.xml.parsers.*; >+import javax.xml.validation.Schema; >+ > import org.xml.sax.*; > > /** >@@ -41,13 +45,25 @@ > public static final String DOCUMENT_PSVI_IMPLEMENTATION = "org.apache.xerces.dom.PSVIDocumentImpl"; > > boolean _validating; >+ >+ Schema _schema = null;; > > /** >- * Constructor for Xerxes loader. >+ * Constructor for Xerces loader. > */ > public XercesLoader() { > _validating = false; > } >+ >+ /** >+ * Constructor for Xerces Loader with a corresponding XML Schema >+ * @param schema An XML Schema to use with the XML file. >+ * @since 1.1 >+ */ >+ public XercesLoader(Schema schema) { >+ _validating = false; >+ _schema = schema; >+ } > > /** > * The Xerces loader loads the XML docuemnt >@@ -58,18 +74,22 @@ > * DOM loader exception. > * @return The loaded document. > */ >- // XXX: fix error reporting > public Document load(InputStream in) throws DOMLoaderException { > > DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); > > factory.setNamespaceAware(true); >- factory.setValidating(_validating); > factory.setAttribute(SCHEMA_VALIDATION_FEATURE, > new Boolean(_validating)); > factory.setAttribute(DOCUMENT_IMPLEMENTATION_PROPERTY, > DOCUMENT_PSVI_IMPLEMENTATION); >- // factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); >+ >+ if (_schema != null) { >+ factory.setSchema(_schema); >+ } >+ else { >+ factory.setValidating(_validating); >+ } > > try { > DocumentBuilder builder = factory.newDocumentBuilder();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 276134
:
135625
|
135626
|
135634
|
135722
|
135723
| 136887 |
136888
|
136890
|
136891