public void testNakedXMLParse() throws Exception { // set up a parser that only has the the xml schema bindings Parser parser = new Parser( new XMLConfiguration() ); parser.setValidating(false); Map map = (Map) parser.parse( MLSchemaLocationResolver.class.getResourceAsStream("mails.xml")); List mail = (List) map.get("mail"); Map mail0 = (Map) mail.get(0); System.out.println( "mail0:"+mail0 ); String id = (String) mail0.get("id"); assertEquals( "xs int", "0", id ); // xsd simple type bindings not provided Map envelope = (Map) mail0.get("envelope"); List<String> from = (List<String>) envelope.get("From"); Map mail1 = (Map) mail.get(1); assertNotNull( "mail multiplicity", mail1); } That passes for me - the id should come out as an Integer because it is an xsd integer the schema; but I have not added the xsd bindings so it comes out as a string rather then an integer. Justin I tried with the XSD configuration and it still came out as a String rather then an integer so am I doing something wrong? Somehow I think I need to tell it where to find the mails.xsd file as part of the configuration?
This is where the WPS spec is being magic on you; if you look at the examples in the spec they start sneaking in references to the schema for any of their complex types at the top of the file. Where we left off at with the wps code at refreactions was going through the schema definitions and setting up a configuration *just* for that particular request - ie checking the describe process for references to any complex schemas and checking if we have any bindings for the content mentioned and adding those bindings to our configuration when we go to encode our request or parse the result.
It is a question of where you want the complexity to be handled; what I am trying to avoid is the soap situation where people rely on code generators to access one single WPS services. Jody Attached parser test - Justin could we show some basic out of the box bindings using the mails.xml example in the xml developers good prior to implementing bindings? |
ParserTest.java
Description: Binary data
------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf
_______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel