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 135625 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]
patch file for the bug
bug276134_patch.txt (text/plain), 8.41 KB, created by
Mukul Gandhi
on 2009-05-13 13:10:01 EDT
(
hide
)
Description:
patch file for the bug
Filename:
MIME Type:
Creator:
Mukul Gandhi
Created:
2009-05-13 13:10:01 EDT
Size:
8.41 KB
patch
obsolete
>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 13 May 2009 17:05:52 -0000 >@@ -6,7 +6,8 @@ > * 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 support for attribute nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.function; >@@ -64,7 +65,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/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 13 May 2009 17:05:51 -0000 >@@ -6,17 +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 support for attribute 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 +70,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/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 13 May 2009 17:05:51 -0000 >@@ -6,7 +6,8 @@ > * 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 support for attribute nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor; >@@ -15,6 +16,8 @@ > > import org.w3c.dom.*; > import javax.xml.parsers.*; >+import javax.xml.validation.Schema; >+ > import org.xml.sax.*; > > /** >@@ -41,6 +44,8 @@ > public static final String DOCUMENT_PSVI_IMPLEMENTATION = "org.apache.xerces.dom.PSVIDocumentImpl"; > > boolean _validating; >+ >+ Schema _schema = null;; > > /** > * Constructor for Xerxes loader. >@@ -48,6 +53,11 @@ > public XercesLoader() { > _validating = false; > } >+ >+ public XercesLoader(Schema schema) { >+ _validating = false; >+ _schema = schema; >+ } > > /** > * The Xerces loader loads the XML docuemnt >@@ -64,12 +74,17 @@ > 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(); >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 13 May 2009 17:05:52 -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 support for attribute nodes > *******************************************************************************/ > > package org.eclipse.wst.xml.xpath2.processor.internal.types; > >-import org.w3c.dom.*; >+import java.math.BigInteger; >+ >+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.w3c.dom.Attr; > > /** > * A representation of the AttributeType datatype >@@ -72,10 +76,34 @@ > @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) { >+ if (typeDef.getName().equals("date")) { >+ rs.add(XSDate.parse_date(string_value())); >+ } >+ else if (typeDef.getName().equals("int")) { >+ rs.add(new XSInt(new BigInteger(string_value()))); >+ } >+ else if (typeDef.getName().equals("integer")) { >+ rs.add(new XSInteger(new BigInteger(string_value()))); >+ } >+ else if (typeDef.getName().equals("double")) { >+ rs.add(new XSDouble(Double.parseDouble(string_value()))); >+ } >+ else if (typeDef.getName().equals("float")) { >+ rs.add(new XSFloat(Float.parseFloat(string_value()))); >+ } >+ else if (typeDef.getName().equals("decimal")) { >+ rs.add(new XSDecimal(Double.parseDouble(string_value()))); >+ } >+ } else { >+ // construct an 'untypedatomic' value >+ rs.add(new UntypedAtomic(string_value())); >+ } >+ > return rs; > } >
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