Package org.codehaus.jettison.mapped

Examples of org.codehaus.jettison.mapped.MappedXMLStreamReader


                    if (null == config.getXml2JsonNs()) {
                        jmConfig = new Configuration();
                    } else {
                        jmConfig = new Configuration(config.getXml2JsonNs());
                    }
                    return new MappedXMLStreamReader(
                            new JSONObject(new JSONTokener(ReaderWriter.readFromAsString(nonEmptyReader))),
                            new MappedNamespaceConvention(jmConfig));
                } catch (Exception ex) {
                    throw new XMLStreamException(ex);
                }
View Full Code Here


                    if (null == config.getXml2JsonNs()) {
                        jmConfig = new Configuration();
                    } else {
                        jmConfig = new Configuration(config.getXml2JsonNs());
                    }
                    return new MappedXMLStreamReader(
                            new JSONObject(new JSONTokener(readFromAsString(reader))),
                            new MappedNamespaceConvention(jmConfig));
                } catch (Exception ex) {
                    Logger.getLogger(JSONUnmarshaller.class.getName()).log(Level.SEVERE, null, ex);
                }
View Full Code Here

      Map<String, String> xmlToJsonNamespaces = new HashMap<String,String>(1);
      xmlToJsonNamespaces.put("http://www.example.org/b/Test", "test");
      xmlToJsonNamespaces.put("http://www.example.org/a/TestCanonical", "can");
      config.setXmlToJsonNamespaces(xmlToJsonNamespaces);
      MappedNamespaceConvention con = new MappedNamespaceConvention(config);
      XMLStreamReader xmlStreamReader = new MappedXMLStreamReader(new JSONObject(output), con);

      Unmarshaller unmarshaller = jc.createUnmarshaller();
      JAXBElement<TestExtends> val = (JAXBElement<TestExtends>)unmarshaller.unmarshal(xmlStreamReader);
      return val.getValue();
View Full Code Here

   }

   public Object unmarshal(Reader reader)
           throws JAXBException
   {
      MappedXMLStreamReader badger = null;
      badger = getXmlStreamReader(reader);
      return unmarshaller.unmarshal(badger);
   }
View Full Code Here

   }

   protected MappedXMLStreamReader getXmlStreamReader(Reader reader)
           throws JAXBException
   {
      MappedXMLStreamReader badger;
      char[] buffer = new char[100];
      StringBuffer buf = new StringBuffer();
      BufferedReader bufferedReader = new BufferedReader(reader);

      try
      {
         int wasRead = 0;
         do
         {
            wasRead = bufferedReader.read(buffer, 0, 100);
            if (wasRead > 0) buf.append(buffer, 0, wasRead);
         } while (wasRead > -1);
         badger = new MappedXMLStreamReader(new JSONObject(new JSONTokener(buf.toString())), convention);
      }
      catch (Exception e)
      {
         throw new JAXBException(e);
      }
View Full Code Here

                    if (null == config.getXml2JsonNs()) {
                        jmConfig = new Configuration();
                    } else {
                        jmConfig = new Configuration(config.getXml2JsonNs());
                    }
                    return new MappedXMLStreamReader(
                            new JSONObject(new JSONTokener(ReaderWriter.readFromAsString(nonEmptyReader))),
                            new MappedNamespaceConvention(jmConfig));
                } catch (Exception ex) {
                    throw new XMLStreamException(ex);
                }
View Full Code Here

TOP

Related Classes of org.codehaus.jettison.mapped.MappedXMLStreamReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.