/doc/javadoc/org/json/XML.html

https://bitbucket.org/crholm/mdfs · HTML · 607 lines · 544 code · 42 blank · 21 comment · 0 complexity · a0f0938c276fb08754c251953f13cf3f MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!--NewPage-->
  3. <HTML>
  4. <HEAD>
  5. <!-- Generated by javadoc (build 1.6.0_23) on Thu Apr 26 19:46:16 CEST 2012 -->
  6. <TITLE>
  7. XML
  8. </TITLE>
  9. <META NAME="date" CONTENT="2012-04-26">
  10. <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
  11. <SCRIPT type="text/javascript">
  12. function windowTitle()
  13. {
  14. if (location.href.indexOf('is-external=true') == -1) {
  15. parent.document.title="XML";
  16. }
  17. }
  18. </SCRIPT>
  19. <NOSCRIPT>
  20. </NOSCRIPT>
  21. </HEAD>
  22. <BODY BGCOLOR="white" onload="windowTitle();">
  23. <HR>
  24. <!-- ========= START OF TOP NAVBAR ======= -->
  25. <A NAME="navbar_top"><!-- --></A>
  26. <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
  27. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  28. <TR>
  29. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  30. <A NAME="navbar_top_firstrow"><!-- --></A>
  31. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  32. <TR ALIGN="center" VALIGN="top">
  33. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  34. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  35. <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  36. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XML.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  37. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  38. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  39. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  40. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  41. </TR>
  42. </TABLE>
  43. </TD>
  44. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  45. </EM>
  46. </TD>
  47. </TR>
  48. <TR>
  49. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  50. &nbsp;<A HREF="../../org/json/JSONWriter.html" title="class in org.json"><B>PREV CLASS</B></A>&nbsp;
  51. &nbsp;<A HREF="../../org/json/XMLTokener.html" title="class in org.json"><B>NEXT CLASS</B></A></FONT></TD>
  52. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  53. <A HREF="../../index.html?org/json/XML.html" target="_top"><B>FRAMES</B></A> &nbsp;
  54. &nbsp;<A HREF="XML.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  55. &nbsp;<SCRIPT type="text/javascript">
  56. <!--
  57. if(window==top) {
  58. document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
  59. }
  60. //-->
  61. </SCRIPT>
  62. <NOSCRIPT>
  63. <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
  64. </NOSCRIPT>
  65. </FONT></TD>
  66. </TR>
  67. <TR>
  68. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  69. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  70. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  71. DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  72. </TR>
  73. </TABLE>
  74. <A NAME="skip-navbar_top"></A>
  75. <!-- ========= END OF TOP NAVBAR ========= -->
  76. <HR>
  77. <!-- ======== START OF CLASS DATA ======== -->
  78. <H2>
  79. <FONT SIZE="-1">
  80. org.json</FONT>
  81. <BR>
  82. Class XML</H2>
  83. <PRE>
  84. java.lang.Object
  85. <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>org.json.XML</B>
  86. </PRE>
  87. <HR>
  88. <DL>
  89. <DT><PRE>public class <B>XML</B><DT>extends java.lang.Object</DL>
  90. </PRE>
  91. <P>
  92. This provides static methods to convert an XML text into a JSONObject,
  93. and to covert a JSONObject into an XML text.
  94. <P>
  95. <P>
  96. <DL>
  97. <DT><B>Version:</B></DT>
  98. <DD>2011-02-11</DD>
  99. <DT><B>Author:</B></DT>
  100. <DD>JSON.org</DD>
  101. </DL>
  102. <HR>
  103. <P>
  104. <!-- =========== FIELD SUMMARY =========== -->
  105. <A NAME="field_summary"><!-- --></A>
  106. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  107. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  108. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  109. <B>Field Summary</B></FONT></TH>
  110. </TR>
  111. <TR BGCOLOR="white" CLASS="TableRowColor">
  112. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  113. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  114. <TD><CODE><B><A HREF="../../org/json/XML.html#AMP">AMP</A></B></CODE>
  115. <BR>
  116. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '&'.</TD>
  117. </TR>
  118. <TR BGCOLOR="white" CLASS="TableRowColor">
  119. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  120. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  121. <TD><CODE><B><A HREF="../../org/json/XML.html#APOS">APOS</A></B></CODE>
  122. <BR>
  123. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '''.</TD>
  124. </TR>
  125. <TR BGCOLOR="white" CLASS="TableRowColor">
  126. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  127. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  128. <TD><CODE><B><A HREF="../../org/json/XML.html#BANG">BANG</A></B></CODE>
  129. <BR>
  130. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '!'.</TD>
  131. </TR>
  132. <TR BGCOLOR="white" CLASS="TableRowColor">
  133. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  134. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  135. <TD><CODE><B><A HREF="../../org/json/XML.html#EQ">EQ</A></B></CODE>
  136. <BR>
  137. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '='.</TD>
  138. </TR>
  139. <TR BGCOLOR="white" CLASS="TableRowColor">
  140. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  141. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  142. <TD><CODE><B><A HREF="../../org/json/XML.html#GT">GT</A></B></CODE>
  143. <BR>
  144. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '>'.</TD>
  145. </TR>
  146. <TR BGCOLOR="white" CLASS="TableRowColor">
  147. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  148. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  149. <TD><CODE><B><A HREF="../../org/json/XML.html#LT">LT</A></B></CODE>
  150. <BR>
  151. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '<'.</TD>
  152. </TR>
  153. <TR BGCOLOR="white" CLASS="TableRowColor">
  154. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  155. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  156. <TD><CODE><B><A HREF="../../org/json/XML.html#QUEST">QUEST</A></B></CODE>
  157. <BR>
  158. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '?'.</TD>
  159. </TR>
  160. <TR BGCOLOR="white" CLASS="TableRowColor">
  161. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  162. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  163. <TD><CODE><B><A HREF="../../org/json/XML.html#QUOT">QUOT</A></B></CODE>
  164. <BR>
  165. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '"'.</TD>
  166. </TR>
  167. <TR BGCOLOR="white" CLASS="TableRowColor">
  168. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  169. <CODE>static&nbsp;java.lang.Character</CODE></FONT></TD>
  170. <TD><CODE><B><A HREF="../../org/json/XML.html#SLASH">SLASH</A></B></CODE>
  171. <BR>
  172. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The Character '/'.</TD>
  173. </TR>
  174. </TABLE>
  175. &nbsp;
  176. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  177. <A NAME="constructor_summary"><!-- --></A>
  178. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  179. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  180. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  181. <B>Constructor Summary</B></FONT></TH>
  182. </TR>
  183. <TR BGCOLOR="white" CLASS="TableRowColor">
  184. <TD><CODE><B><A HREF="../../org/json/XML.html#XML()">XML</A></B>()</CODE>
  185. <BR>
  186. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
  187. </TR>
  188. </TABLE>
  189. &nbsp;
  190. <!-- ========== METHOD SUMMARY =========== -->
  191. <A NAME="method_summary"><!-- --></A>
  192. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  193. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  194. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  195. <B>Method Summary</B></FONT></TH>
  196. </TR>
  197. <TR BGCOLOR="white" CLASS="TableRowColor">
  198. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  199. <CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
  200. <TD><CODE><B><A HREF="../../org/json/XML.html#escape(java.lang.String)">escape</A></B>(java.lang.String&nbsp;string)</CODE>
  201. <BR>
  202. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replace special characters with XML escapes:</TD>
  203. </TR>
  204. <TR BGCOLOR="white" CLASS="TableRowColor">
  205. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  206. <CODE>static&nbsp;void</CODE></FONT></TD>
  207. <TD><CODE><B><A HREF="../../org/json/XML.html#noSpace(java.lang.String)">noSpace</A></B>(java.lang.String&nbsp;string)</CODE>
  208. <BR>
  209. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Throw an exception if the string contains whitespace.</TD>
  210. </TR>
  211. <TR BGCOLOR="white" CLASS="TableRowColor">
  212. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  213. <CODE>static&nbsp;java.lang.Object</CODE></FONT></TD>
  214. <TD><CODE><B><A HREF="../../org/json/XML.html#stringToValue(java.lang.String)">stringToValue</A></B>(java.lang.String&nbsp;string)</CODE>
  215. <BR>
  216. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Try to convert a string into a number, boolean, or null.</TD>
  217. </TR>
  218. <TR BGCOLOR="white" CLASS="TableRowColor">
  219. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  220. <CODE>static&nbsp;<A HREF="../../org/json/JSONObject.html" title="class in org.json">JSONObject</A></CODE></FONT></TD>
  221. <TD><CODE><B><A HREF="../../org/json/XML.html#toJSONObject(java.lang.String)">toJSONObject</A></B>(java.lang.String&nbsp;string)</CODE>
  222. <BR>
  223. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert a well-formed (but not necessarily valid) XML string into a
  224. JSONObject.</TD>
  225. </TR>
  226. <TR BGCOLOR="white" CLASS="TableRowColor">
  227. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  228. <CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
  229. <TD><CODE><B><A HREF="../../org/json/XML.html#toString(java.lang.Object)">toString</A></B>(java.lang.Object&nbsp;object)</CODE>
  230. <BR>
  231. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert a JSONObject into a well-formed, element-normal XML string.</TD>
  232. </TR>
  233. <TR BGCOLOR="white" CLASS="TableRowColor">
  234. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  235. <CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
  236. <TD><CODE><B><A HREF="../../org/json/XML.html#toString(java.lang.Object, java.lang.String)">toString</A></B>(java.lang.Object&nbsp;object,
  237. java.lang.String&nbsp;tagName)</CODE>
  238. <BR>
  239. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert a JSONObject into a well-formed, element-normal XML string.</TD>
  240. </TR>
  241. </TABLE>
  242. &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
  243. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  244. <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
  245. <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
  246. </TR>
  247. <TR BGCOLOR="white" CLASS="TableRowColor">
  248. <TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
  249. </TR>
  250. </TABLE>
  251. &nbsp;
  252. <P>
  253. <!-- ============ FIELD DETAIL =========== -->
  254. <A NAME="field_detail"><!-- --></A>
  255. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  256. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  257. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  258. <B>Field Detail</B></FONT></TH>
  259. </TR>
  260. </TABLE>
  261. <A NAME="AMP"><!-- --></A><H3>
  262. AMP</H3>
  263. <PRE>
  264. public static final java.lang.Character <B>AMP</B></PRE>
  265. <DL>
  266. <DD>The Character '&'.
  267. <P>
  268. <DL>
  269. </DL>
  270. </DL>
  271. <HR>
  272. <A NAME="APOS"><!-- --></A><H3>
  273. APOS</H3>
  274. <PRE>
  275. public static final java.lang.Character <B>APOS</B></PRE>
  276. <DL>
  277. <DD>The Character '''.
  278. <P>
  279. <DL>
  280. </DL>
  281. </DL>
  282. <HR>
  283. <A NAME="BANG"><!-- --></A><H3>
  284. BANG</H3>
  285. <PRE>
  286. public static final java.lang.Character <B>BANG</B></PRE>
  287. <DL>
  288. <DD>The Character '!'.
  289. <P>
  290. <DL>
  291. </DL>
  292. </DL>
  293. <HR>
  294. <A NAME="EQ"><!-- --></A><H3>
  295. EQ</H3>
  296. <PRE>
  297. public static final java.lang.Character <B>EQ</B></PRE>
  298. <DL>
  299. <DD>The Character '='.
  300. <P>
  301. <DL>
  302. </DL>
  303. </DL>
  304. <HR>
  305. <A NAME="GT"><!-- --></A><H3>
  306. GT</H3>
  307. <PRE>
  308. public static final java.lang.Character <B>GT</B></PRE>
  309. <DL>
  310. <DD>The Character '>'.
  311. <P>
  312. <DL>
  313. </DL>
  314. </DL>
  315. <HR>
  316. <A NAME="LT"><!-- --></A><H3>
  317. LT</H3>
  318. <PRE>
  319. public static final java.lang.Character <B>LT</B></PRE>
  320. <DL>
  321. <DD>The Character '<'.
  322. <P>
  323. <DL>
  324. </DL>
  325. </DL>
  326. <HR>
  327. <A NAME="QUEST"><!-- --></A><H3>
  328. QUEST</H3>
  329. <PRE>
  330. public static final java.lang.Character <B>QUEST</B></PRE>
  331. <DL>
  332. <DD>The Character '?'.
  333. <P>
  334. <DL>
  335. </DL>
  336. </DL>
  337. <HR>
  338. <A NAME="QUOT"><!-- --></A><H3>
  339. QUOT</H3>
  340. <PRE>
  341. public static final java.lang.Character <B>QUOT</B></PRE>
  342. <DL>
  343. <DD>The Character '"'.
  344. <P>
  345. <DL>
  346. </DL>
  347. </DL>
  348. <HR>
  349. <A NAME="SLASH"><!-- --></A><H3>
  350. SLASH</H3>
  351. <PRE>
  352. public static final java.lang.Character <B>SLASH</B></PRE>
  353. <DL>
  354. <DD>The Character '/'.
  355. <P>
  356. <DL>
  357. </DL>
  358. </DL>
  359. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  360. <A NAME="constructor_detail"><!-- --></A>
  361. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  362. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  363. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  364. <B>Constructor Detail</B></FONT></TH>
  365. </TR>
  366. </TABLE>
  367. <A NAME="XML()"><!-- --></A><H3>
  368. XML</H3>
  369. <PRE>
  370. public <B>XML</B>()</PRE>
  371. <DL>
  372. </DL>
  373. <!-- ============ METHOD DETAIL ========== -->
  374. <A NAME="method_detail"><!-- --></A>
  375. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  376. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  377. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  378. <B>Method Detail</B></FONT></TH>
  379. </TR>
  380. </TABLE>
  381. <A NAME="escape(java.lang.String)"><!-- --></A><H3>
  382. escape</H3>
  383. <PRE>
  384. public static java.lang.String <B>escape</B>(java.lang.String&nbsp;string)</PRE>
  385. <DL>
  386. <DD>Replace special characters with XML escapes:
  387. <pre>
  388. &amp; <small>(ampersand)</small> is replaced by &amp;amp;
  389. &lt; <small>(less than)</small> is replaced by &amp;lt;
  390. &gt; <small>(greater than)</small> is replaced by &amp;gt;
  391. &quot; <small>(double quote)</small> is replaced by &amp;quot;
  392. </pre>
  393. <P>
  394. <DD><DL>
  395. <DT><B>Parameters:</B><DD><CODE>string</CODE> - The string to be escaped.
  396. <DT><B>Returns:</B><DD>The escaped string.</DL>
  397. </DD>
  398. </DL>
  399. <HR>
  400. <A NAME="noSpace(java.lang.String)"><!-- --></A><H3>
  401. noSpace</H3>
  402. <PRE>
  403. public static void <B>noSpace</B>(java.lang.String&nbsp;string)
  404. throws <A HREF="../../org/json/JSONException.html" title="class in org.json">JSONException</A></PRE>
  405. <DL>
  406. <DD>Throw an exception if the string contains whitespace.
  407. Whitespace is not allowed in tagNames and attributes.
  408. <P>
  409. <DD><DL>
  410. <DT><B>Parameters:</B><DD><CODE>string</CODE> -
  411. <DT><B>Throws:</B>
  412. <DD><CODE><A HREF="../../org/json/JSONException.html" title="class in org.json">JSONException</A></CODE></DL>
  413. </DD>
  414. </DL>
  415. <HR>
  416. <A NAME="stringToValue(java.lang.String)"><!-- --></A><H3>
  417. stringToValue</H3>
  418. <PRE>
  419. public static java.lang.Object <B>stringToValue</B>(java.lang.String&nbsp;string)</PRE>
  420. <DL>
  421. <DD>Try to convert a string into a number, boolean, or null. If the string
  422. can't be converted, return the string. This is much less ambitious than
  423. JSONObject.stringToValue, especially because it does not attempt to
  424. convert plus forms, octal forms, hex forms, or E forms lacking decimal
  425. points.
  426. <P>
  427. <DD><DL>
  428. <DT><B>Parameters:</B><DD><CODE>string</CODE> - A String.
  429. <DT><B>Returns:</B><DD>A simple JSON value.</DL>
  430. </DD>
  431. </DL>
  432. <HR>
  433. <A NAME="toJSONObject(java.lang.String)"><!-- --></A><H3>
  434. toJSONObject</H3>
  435. <PRE>
  436. public static <A HREF="../../org/json/JSONObject.html" title="class in org.json">JSONObject</A> <B>toJSONObject</B>(java.lang.String&nbsp;string)
  437. throws <A HREF="../../org/json/JSONException.html" title="class in org.json">JSONException</A></PRE>
  438. <DL>
  439. <DD>Convert a well-formed (but not necessarily valid) XML string into a
  440. JSONObject. Some information may be lost in this transformation
  441. because JSON is a data format and XML is a document format. XML uses
  442. elements, attributes, and content text, while JSON uses unordered
  443. collections of name/value pairs and arrays of values. JSON does not
  444. does not like to distinguish between elements and attributes.
  445. Sequences of similar elements are represented as JSONArrays. Content
  446. text may be placed in a "content" member. Comments, prologs, DTDs, and
  447. <code>&lt;[ [ ]]></code> are ignored.
  448. <P>
  449. <DD><DL>
  450. <DT><B>Parameters:</B><DD><CODE>string</CODE> - The source string.
  451. <DT><B>Returns:</B><DD>A JSONObject containing the structured data from the XML string.
  452. <DT><B>Throws:</B>
  453. <DD><CODE><A HREF="../../org/json/JSONException.html" title="class in org.json">JSONException</A></CODE></DL>
  454. </DD>
  455. </DL>
  456. <HR>
  457. <A NAME="toString(java.lang.Object)"><!-- --></A><H3>
  458. toString</H3>
  459. <PRE>
  460. public static java.lang.String <B>toString</B>(java.lang.Object&nbsp;object)
  461. throws <A HREF="../../org/json/JSONException.html" title="class in org.json">JSONException</A></PRE>
  462. <DL>
  463. <DD>Convert a JSONObject into a well-formed, element-normal XML string.
  464. <P>
  465. <DD><DL>
  466. <DT><B>Parameters:</B><DD><CODE>object</CODE> - A JSONObject.
  467. <DT><B>Returns:</B><DD>A string.
  468. <DT><B>Throws:</B>
  469. <DD><CODE><A HREF="../../org/json/JSONException.html" title="class in org.json">JSONException</A></CODE></DL>
  470. </DD>
  471. </DL>
  472. <HR>
  473. <A NAME="toString(java.lang.Object, java.lang.String)"><!-- --></A><H3>
  474. toString</H3>
  475. <PRE>
  476. public static java.lang.String <B>toString</B>(java.lang.Object&nbsp;object,
  477. java.lang.String&nbsp;tagName)
  478. throws <A HREF="../../org/json/JSONException.html" title="class in org.json">JSONException</A></PRE>
  479. <DL>
  480. <DD>Convert a JSONObject into a well-formed, element-normal XML string.
  481. <P>
  482. <DD><DL>
  483. <DT><B>Parameters:</B><DD><CODE>object</CODE> - A JSONObject.<DD><CODE>tagName</CODE> - The optional name of the enclosing tag.
  484. <DT><B>Returns:</B><DD>A string.
  485. <DT><B>Throws:</B>
  486. <DD><CODE><A HREF="../../org/json/JSONException.html" title="class in org.json">JSONException</A></CODE></DL>
  487. </DD>
  488. </DL>
  489. <!-- ========= END OF CLASS DATA ========= -->
  490. <HR>
  491. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  492. <A NAME="navbar_bottom"><!-- --></A>
  493. <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
  494. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  495. <TR>
  496. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  497. <A NAME="navbar_bottom_firstrow"><!-- --></A>
  498. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  499. <TR ALIGN="center" VALIGN="top">
  500. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  501. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  502. <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  503. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XML.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  504. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  505. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  506. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  507. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  508. </TR>
  509. </TABLE>
  510. </TD>
  511. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  512. </EM>
  513. </TD>
  514. </TR>
  515. <TR>
  516. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  517. &nbsp;<A HREF="../../org/json/JSONWriter.html" title="class in org.json"><B>PREV CLASS</B></A>&nbsp;
  518. &nbsp;<A HREF="../../org/json/XMLTokener.html" title="class in org.json"><B>NEXT CLASS</B></A></FONT></TD>
  519. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  520. <A HREF="../../index.html?org/json/XML.html" target="_top"><B>FRAMES</B></A> &nbsp;
  521. &nbsp;<A HREF="XML.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  522. &nbsp;<SCRIPT type="text/javascript">
  523. <!--
  524. if(window==top) {
  525. document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
  526. }
  527. //-->
  528. </SCRIPT>
  529. <NOSCRIPT>
  530. <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
  531. </NOSCRIPT>
  532. </FONT></TD>
  533. </TR>
  534. <TR>
  535. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  536. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  537. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  538. DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  539. </TR>
  540. </TABLE>
  541. <A NAME="skip-navbar_bottom"></A>
  542. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  543. <HR>
  544. </BODY>
  545. </HTML>