当前位置: 首页>>代码示例>>Java>>正文


Java Xml.parse方法代码示例

本文整理汇总了Java中android.util.Xml.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Xml.parse方法的具体用法?Java Xml.parse怎么用?Java Xml.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.util.Xml的用法示例。


在下文中一共展示了Xml.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseFromPicasaXml

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parses photos XML (a list of photo; the contents of an album).
 * 
 * @param xmlStr
 *          the photo XML
 * @return a list of {@link Photo}s
 */
public static List<Photo> parseFromPicasaXml(String xmlStr) {
  PicasaPhotosSaxHandler handler = new PicasaPhotosSaxHandler();
  try {
    // The Parser somehow has some trouble with a plus sign in the
    // content. This is a hack to fix this.
    // TODO: Maybe we should replace all these special characters with
    // XML entities?
    xmlStr = xmlStr.replace("+", "&#43;");
    Xml.parse(xmlStr, handler);
    return handler.getPhotos();
  } catch (SAXException e) {
    Log.e("Photo", e.getMessage(), e);
  }
  return new ArrayList<Photo>();
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:23,代码来源:Photo.java

示例2: parseFromPicasaXml

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parses Picasa albums XML and returns a list of albums.
 */
public static List<Album> parseFromPicasaXml(String xmlStr) {
  PicasaAlbumsSaxHandler handler = new PicasaAlbumsSaxHandler();
  try {
    Xml.parse(xmlStr, handler);
    return handler.getAlbums();
  } catch (SAXException e) {
    Log.e(TAG, e.getMessage(), e);
  }
  return new ArrayList<Album>();
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:14,代码来源:Album.java

示例3: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (host_info)
 *
 * @param rpcResult String returned by RPC call of core client
 * @return HostInfo
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 *     or does not contain valid {@code <host_info>} tag
 */
public static HostInfo parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        HostInfoParser parser = new HostInfoParser();
        Xml.parse(rpcResult, parser);
        return parser.getHostInfo();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <host_info>", e);
    }
}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:21,代码来源:HostInfoParser.java

示例4: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (version_info)
 *
 * @param rpcResult String returned by RPC call of core client
 * @return VersionInfo (of core client)
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static VersionInfo parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        VersionInfoParser parser = new VersionInfoParser();
        Xml.parse(rpcResult, parser);
        return parser.getVersionInfo();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <server_version>", e);
    }
}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:20,代码来源:VersionInfoParser.java

示例5: getSeqno

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (seqno) and generate corresponding vector
 *
 * @param rpcResult String returned by RPC call of core client
 * @return number of messages
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static int getSeqno(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        MessageCountParser parser = new MessageCountParser();
        Xml.parse(rpcResult, parser);
        return parser.seqno();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <seqno>", e);
    }

}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:21,代码来源:MessageCountParser.java

示例6: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (results) and generate vector of results info
 *
 * @param rpcResult String returned by RPC call of core client
 * @return vector of results info
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static Vector<Result> parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        ResultsParser parser = new ResultsParser();
        Xml.parse(rpcResult, parser);
        return parser.getResults();
    } catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <results>", e);
    }

}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:20,代码来源:ResultsParser.java

示例7: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (file_transfers) and generate vector of transfers info
 *
 * @param rpcResult String returned by RPC call of core client
 * @return vector of projects info
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static Vector<Transfer> parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        TransfersParser parser = new TransfersParser();
        Xml.parse(rpcResult, parser);
        return parser.getTransfers();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <file_transfers>", e);
    }
}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:20,代码来源:TransfersParser.java

示例8: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (projects) and generate vector of projects info
 *
 * @param rpcResult String returned by RPC call of core client
 * @return vector of projects info
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static Vector<Project> parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        ProjectsParser parser = new ProjectsParser();
        Xml.parse(rpcResult, parser);
        return parser.getProjects();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <project>", e);
    }
}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:20,代码来源:ProjectsParser.java

示例9: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (app) and generate vector of app
 *
 * @param rpcResult String returned by RPC call of core client
 * @return vector of app
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static Vector<App> parse(String rpcResult) throws InvalidDataReceivedException {
    try {
        AppsParser parser = new AppsParser();
        Xml.parse(rpcResult, parser);
        return parser.getApps();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <app>", e);
    }
}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:19,代码来源:AppsParser.java

示例10: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (cc_status)
 * @param rpcResult String returned by RPC call of core client
 * @return CcStatus
 * @throws RpcClientFailedException in case of error:
 * <ul>
 * <li>{@link AuthorizationFailedException} in case of unauthorized</li>
 * <li>{@link InvalidDataReceivedException} in case XML cannot be parsed
 *     or does not contain valid {@code <cc_status>} tag</li>
 * </ul>
 */
public static CcStatus parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        CcStatusParser parser = new CcStatusParser();
        Xml.parse(rpcResult, parser);
        return parser.getCcStatus();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <cc_status>");
    }
}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:23,代码来源:CcStatusParser.java

示例11: isSuccess

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result of command
 *
 * @param rpcResult String returned by RPC call of core client
 * @return true in case of {@code <success/>}, false in case of {@code <failure/>}
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static boolean isSuccess(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        SimpleReplyParser parser = new SimpleReplyParser();
        Xml.parse(rpcResult, parser);
        return parser.result();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing simple reply", e);
    }

}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:21,代码来源:SimpleReplyParser.java

示例12: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (workunit) and generate corresponding vector
 *
 * @param rpcResult String returned by RPC call of core client
 * @return vector of workunits
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static Vector<Workunit> parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        WorkunitsParser parser = new WorkunitsParser();
        Xml.parse(rpcResult, parser);
        return parser.getWorkunits();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <workunits>", e);
    }
}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:20,代码来源:WorkunitsParser.java

示例13: parse

import android.util.Xml; //导入方法依赖的package包/类
/**
 * Parse the RPC result (state) and generate vector of projects info
 *
 * @param rpcResult String returned by RPC call of core client
 * @return connected client state
 * @throws AuthorizationFailedException in case of unauthorized
 * @throws InvalidDataReceivedException in case XML cannot be parsed
 */
public static CcState parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
    try {
        CcStateParser parser = new CcStateParser();
        Xml.parse(rpcResult, parser);
        return parser.getCcState();
    }
    catch (SAXException e) {
        if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
        throw new InvalidDataReceivedException("Malformed XML while parsing <cc_state>", e);
    }

}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:21,代码来源:CcStateParser.java

示例14: parse

import android.util.Xml; //导入方法依赖的package包/类
public static String parse(String rpcRequest) {
    try {
        RpcRequestParser parser = new RpcRequestParser();
        Xml.parse(rpcRequest, parser);
        return parser.mRequest;
    }
    catch (SAXException e) {
        Log.d(TAG, "Malformed XML:\n" + rpcRequest);
        return "";
    }
}
 
开发者ID:palo-m,项目名称:androboinc,代码行数:12,代码来源:RpcRequestParser.java

示例15: a

import android.util.Xml; //导入方法依赖的package包/类
public HashMap<String, Object> a(String str) {
    Object aVar = new a();
    Xml.parse(str, aVar);
    return aVar.a();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:6,代码来源:g.java


注:本文中的android.util.Xml.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。