PageRenderTime 74ms CodeModel.GetById 26ms app.highlight 37ms RepoModel.GetById 2ms app.codeStats 0ms

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