|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Checking the types of atomic valuesHi Mike,
I use this method to test if the value specified for an option is consistent with it's specified type: public static void checkType(XProcRuntime runtime, String value, QName type, XdmNode node) { // Code for dealing with QNames and other special cases elided if (typeFactory == null) { typeFactory = new ItemTypeFactory(runtime.getProcessor()); types = new Hashtable<QName,ItemType> (); } ItemType itype = null; // Squirrel them away so I don't have to keep making new ones if (types.containsKey(type)) { itype = types.get(type); } else { try { itype = typeFactory.getAtomicType(type); } catch (SaxonApiException sae) { throw new XProcException("Unexpected type: " + type); } types.put(type,itype); } // FIXME: There's probably a less expensive expensive way to do this try { XdmAtomicValue avalue = new XdmAtomicValue(value, itype); } catch (SaxonApiException sae) { throw XProcException.dynamicError(45, sae); } } In 9.1 this worked fine. In 9.2, the exception never seems to be thrown. The result is a new "avalue" with a "null" value field. My bug, or yours? (My test case is checkType(runtime, "string", "xs:integer", null) ) Be seeing you, norm -- Norman Walsh <ndw@...> | The reverse side also has a reverse http://nwalsh.com/ | side. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
|
|
Re: Checking the types of atomic valuesLooks like this bug: http://sourceforge.net/tracker/?func=detail&aid=2879248&group_id=29872&atid= 397617 which is cleared in 9.2.0.3. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Norman Walsh [mailto:ndw@...] > Sent: 04 November 2009 01:42 > To: saxon-help@... > Subject: [saxon] Checking the types of atomic values > > Hi Mike, > > I use this method to test if the value specified for an > option is consistent with it's specified type: > > public static void checkType(XProcRuntime runtime, > String value, QName type, XdmNode node) { > // Code for dealing with QNames and other special cases elided > > if (typeFactory == null) { > typeFactory = new ItemTypeFactory(runtime.getProcessor()); > types = new Hashtable<QName,ItemType> (); > } > > ItemType itype = null; > > // Squirrel them away so I don't have to keep making new ones > if (types.containsKey(type)) { > itype = types.get(type); > } else { > try { > itype = typeFactory.getAtomicType(type); > } catch (SaxonApiException sae) { > throw new XProcException("Unexpected type: " + type); > } > types.put(type,itype); > } > > // FIXME: There's probably a less expensive expensive way > to do this > try { > XdmAtomicValue avalue = new XdmAtomicValue(value, itype); > } catch (SaxonApiException sae) { > throw XProcException.dynamicError(45, sae); > } > } > > In 9.1 this worked fine. In 9.2, the exception never seems to > be thrown. The result is a new "avalue" with a "null" value field. > > My bug, or yours? > > (My test case is checkType(runtime, "string", "xs:integer", null) ) > > Be seeing you, > norm > > -- > Norman Walsh <ndw@...> | The reverse side also has a reverse > http://nwalsh.com/ | side. > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@... https://lists.sourceforge.net/lists/listinfo/saxon-help |
| Free embeddable forum powered by Nabble | Forum Help |