Package se.despotify.util

Examples of se.despotify.util.XMLElement


    String xml = new String(data, Charset.forName("UTF-8"));
    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement root = XML.load(xml);

    if (root.getElement().getNodeName().equals("artist")) {
      Artist.fromXMLElement(root, store);
      return true;
    } else {
      throw new DespotifyException("Root element is not named <artist>: " + root.getElement().getNodeName());
    }



View Full Code Here


        "\n</playlists>";

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement response = XML.load(xml);

    Playlist.fromXMLElement(response, store, playlist);

    if (response.hasChild("next-change")) {
      return true;
    } else {
      playlists.getItems().add(position - 1, playlist);
      throw new RuntimeException("Unknown server response:\n" + xml);
    }
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }

    XMLElement reponseElement = XML.load(xml);

    if (reponseElement.hasChild("confirm")) {
      return true;
    } else {
      log.warn("Invalid response when requesting UUID " + Hex.toHex(requestedPlaylistUUID) + ":\n" + xml);
      return false;
    }
View Full Code Here

    /* Load XML. */
    String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><playlist>" +
        new String(data, Charset.forName("UTF-8")) +
        "</playlist>";
    XMLElement playlistElement = XML.load(xml);
    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    /* Create and return playlist. */
    Playlist.fromXMLElement(playlistElement, store, playlist);
View Full Code Here

        "\n</playlists>";

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement response = XML.load(xml);

    final XMLElement versionParentElement;
    if (response.hasChild("confirm")) {
      versionParentElement = response.getChild("confirm");
    } else if (response.hasChild("")) {
      versionParentElement = response;
    } else {
      throw new RuntimeException("Unknown server response:\n" + xml);
    }

    // <version>0000000007,0000000002,3701476273,0</version>
    String[] versionTagValues = versionParentElement.getChildText("version").split(",", 4);

    playlists.setRevision(Long.parseLong(versionTagValues[0]));
    playlists.setChecksum(Long.parseLong(versionTagValues[2]));

    if (playlists.getItems().size() != Long.parseLong(versionTagValues[1])) {
View Full Code Here

        new String(data, Charset.forName("UTF-8")) +
        "\n</playlist>";
    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement response = XML.load(xml);

    if (response.hasChild("confirm")) {
      // <version>0000000002,0000000001,1326385279,0</version>
      String[] versionTagValues = response.getChild("confirm").getChildText("version").split(",", 4);

      playlist.setRevision(Long.parseLong(versionTagValues[0]));
      playlist.setChecksum(Long.parseLong(versionTagValues[2]));

      if (playlist.size() != Long.parseLong(versionTagValues[1])) {
View Full Code Here

    xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<playlist>\n" +
        new String(data, Charset.forName("UTF-8")) +
        "\n</playlist>";
    log.debug(xml);
    XMLElement response = XML.load(xml);

    if (response.hasChild("confirm")) {
      // <version>0000000002,0000000001,1326385279,0</version>
      String[] versionTagValues = response.getChild("confirm").getChildText("version").split(",", 4);

      playlist.setRevision(Long.parseLong(versionTagValues[0]));
      playlist.setChecksum(Long.parseLong(versionTagValues[2]));

      if (playlist.size() != Long.parseLong(versionTagValues[1])) {
View Full Code Here

    String xml = new String(data, Charset.forName("UTF-8"));
    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement root = XML.load(xml);

    // load tracks


    Result.fromXMLElement(root, store);
View Full Code Here

    String xml = new String(data, Charset.forName("UTF-8"));
    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement root = XML.load(xml);

    /* Create result from XML. */

    return Result.fromXMLElement(root, store);

View Full Code Here

    String xml = new String(data, Charset.forName("UTF-8"));
    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement root = XML.load(xml);

    // load tracks


    Result.fromXMLElement(root, store);
View Full Code Here

TOP

Related Classes of se.despotify.util.XMLElement

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.