org.activiti.engine.impl.util.json
类 JSONML

java.lang.Object
  继承者 org.activiti.engine.impl.util.json.JSONML

public class JSONML
extends Object

This provides static methods to convert an XML text into a JSONArray or JSONObject, and to covert a JSONArray or JSONObject into an XML text using the JsonML transform.

版本:
2010-02-12
作者:
JSON.org

构造方法摘要
JSONML()
           
 
方法摘要
static JSONArray toJSONArray(String string)
          Convert a well-formed (but not necessarily valid) XML string into a JSONArray using the JsonML transform.
static JSONArray toJSONArray(XMLTokener x)
          Convert a well-formed (but not necessarily valid) XML string into a JSONArray using the JsonML transform.
static JSONObject toJSONObject(String string)
          Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform.
static JSONObject toJSONObject(XMLTokener x)
          Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform.
static String toString(JSONArray ja)
          Reverse the JSONML transformation, making an XML text from a JSONArray.
static String toString(JSONObject jo)
          Reverse the JSONML transformation, making an XML text from a JSONObject.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

JSONML

public JSONML()
方法详细信息

toJSONArray

public static JSONArray toJSONArray(String string)
                             throws JSONException
Convert a well-formed (but not necessarily valid) XML string into a JSONArray using the JsonML transform. Each XML tag is represented as a JSONArray in which the first element is the tag name. If the tag has attributes, then the second element will be JSONObject containing the name/value pairs. If the tag contains children, then strings and JSONArrays will represent the child tags. Comments, prologs, DTDs, and <[ [ ]]> are ignored.

参数:
string - The source string.
返回:
A JSONArray containing the structured signalData from the XML string.
抛出:
JSONException

toJSONArray

public static JSONArray toJSONArray(XMLTokener x)
                             throws JSONException
Convert a well-formed (but not necessarily valid) XML string into a JSONArray using the JsonML transform. Each XML tag is represented as a JSONArray in which the first element is the tag name. If the tag has attributes, then the second element will be JSONObject containing the name/value pairs. If the tag contains children, then strings and JSONArrays will represent the child content and tags. Comments, prologs, DTDs, and <[ [ ]]> are ignored.

参数:
x - An XMLTokener.
返回:
A JSONArray containing the structured signalData from the XML string.
抛出:
JSONException

toJSONObject

public static JSONObject toJSONObject(XMLTokener x)
                               throws JSONException
Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform. Each XML tag is represented as a JSONObject with a "tagName" property. If the tag has attributes, then the attributes will be in the JSONObject as properties. If the tag contains children, the object will have a "childNodes" property which will be an array of strings and JsonML JSONObjects. Comments, prologs, DTDs, and <[ [ ]]> are ignored.

参数:
x - An XMLTokener of the XML source text.
返回:
A JSONObject containing the structured signalData from the XML string.
抛出:
JSONException

toJSONObject

public static JSONObject toJSONObject(String string)
                               throws JSONException
Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform. Each XML tag is represented as a JSONObject with a "tagName" property. If the tag has attributes, then the attributes will be in the JSONObject as properties. If the tag contains children, the object will have a "childNodes" property which will be an array of strings and JsonML JSONObjects. Comments, prologs, DTDs, and <[ [ ]]> are ignored.

参数:
string - The XML source text.
返回:
A JSONObject containing the structured signalData from the XML string.
抛出:
JSONException

toString

public static String toString(JSONArray ja)
                       throws JSONException
Reverse the JSONML transformation, making an XML text from a JSONArray.

参数:
ja - A JSONArray.
返回:
An XML string.
抛出:
JSONException

toString

public static String toString(JSONObject jo)
                       throws JSONException
Reverse the JSONML transformation, making an XML text from a JSONObject. The JSONObject must contain a "tagName" property. If it has children, then it must have a "childNodes" property containing an array of objects. The other properties are attributes with string values.

参数:
jo - A JSONObject.
返回:
An XML string.
抛出:
JSONException


Copyright © 2013 Alfresco. All rights reserved.