Package net.sf.json.xml

Examples of net.sf.json.xml.XMLSerializer


    }

    private JSONObject makeRequest(String endpoint, Map<String, String> params) throws IOException, InvalidCredentialsException {
        String url = signUrl("https://" + endpoint + "/", params);
        String rawResponse = HTTPUtils.openUrl(url, "GET", null, null, null, null, null, null);
        JSONObject json = (JSONObject) new XMLSerializer().read(rawResponse);
        return json;
    }
View Full Code Here


        List<Header> requestHeader = new ArrayList<>();
        requestHeader.add(new BasicHeader("Date", date));
        requestHeader.add(new BasicHeader("Authorization", "AWS " + getConnectionCredentials().getIdentity() + ":" + signature));
        String url = "https://" + (bucket == null ? "" : bucket + ".") + endpoint + path;
        String rawResponse = HTTPUtils.openUrl(url, "GET", null, null, null, null, requestHeader, null);
        JSON json = new XMLSerializer().read(rawResponse);
        return (json instanceof JSONObject ? (JSONObject) json : null);
    }
View Full Code Here

  }
 
  @Deprecated
  public String ConvertToXML(String jsonData)
  {
    XMLSerializer serializer = new XMLSerializer();
        JSON json = JSONSerializer.toJSON(jsonData);
        serializer.setRootName("xmlOutput");
        serializer.setTypeHintsEnabled(false);
        String xml = serializer.write(json);   
    return xml;
  }
View Full Code Here

    return xml;
  }
 
  public void convertToXML()
  {
    XMLSerializer serializer = new XMLSerializer();
        JSON json = JSONSerializer.toJSON(this.getJsonInput());
        serializer.setRootName("xmlOutput");
        serializer.setTypeHintsEnabled(false);
        setXmlOutput(serializer.write(json));
  }
View Full Code Here

        super();
    }

    @Deprecated
    private String ConvertToXML(String jsonData) {
        XMLSerializer serializer = new XMLSerializer();
        JSON json = JSONSerializer.toJSON(jsonData);
        serializer.setRootName("xmlOutput");
        serializer.setTypeHintsEnabled(false);
        String xml = serializer.write(json);
        return xml;
    }
View Full Code Here

        String xml = serializer.write(json);
        return xml;
    }

    private void convertToXML() {
        XMLSerializer serializer = new XMLSerializer();
        JSON json = JSONSerializer.toJSON(this.getJsonInput());
        serializer.setRootName("xmlOutput");
        serializer.setTypeHintsEnabled(false);
        setXmlOutput(serializer.write(json));
    }
View Full Code Here

     * @return the JSON response
     *
     * @throws IOException
     */
    public static String getJSON (String xml) throws IOException {
        XMLSerializer xmlSerializer = new XMLSerializer();
       
        // Disable type hints. When enable, a type attribute in the root
        // element will throw NPE.
        // http://sourceforge.net/mailarchive/message.php?msg_id=27646519
        xmlSerializer.setTypeHintsEnabled(false);
        xmlSerializer.setTypeHintsCompatibility(false);
        JSON json = xmlSerializer.read(xml);
        return json.toString(2);
    }
View Full Code Here

      if (response != null && response.has("response")) {
        JSONArray a = response.getJSONArray("response");
        if (a.iterator().hasNext()) {
          JSONObject j = (JSONObject) a.iterator().next();
          if (j.has("file") && j.has("xml")) {
            XMLSerializer xmls = new XMLSerializer();
            JSON info = xmls.read(j.getString("xml"));
            if (!info.isEmpty()) {
              if (info.isArray()) {
                json.put("response", info);
              }
              else {
View Full Code Here

            DOMSource source = new DOMSource(output);
            trans.transform(source, result);
            String xmlString = sw.toString();

            //convert to json string
            XMLSerializer xmlSerializer = new XMLSerializer();
            JSON json = xmlSerializer.read(xmlString);
            String jsonString = json.toString(2);
            return jsonString;
        } catch (Exception e) {
            System.out.println(e);
        }
View Full Code Here

   */
  private JSONObject jsonRule(Rule rule) {

    JSONObject ruleSz = null;
    String xmlRule;
    XMLSerializer xmlS = new XMLSerializer();

    SLDTransformer transform = new SLDTransformer();
    transform.setIndentation(2);
    try {
      xmlRule = transform.transform(rule);
      xmlS.setRemoveNamespacePrefixFromElements(true);
      xmlS.setSkipNamespaces(true);
      ruleSz = (JSONObject) xmlS.read(xmlRule);
    } catch (TransformerException e) {
      e.printStackTrace();
    }

    return ruleSz;
View Full Code Here

TOP

Related Classes of net.sf.json.xml.XMLSerializer

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.