PageRenderTime 23ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/api/org/gjt/sp/util/XMLUtilities.html

#
HTML | 289 lines | 242 code | 37 blank | 10 comment | 0 complexity | 7d6333e20af6a47269628f96856fe1fc MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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.5.0_14) on Tue Jul 22 07:14:17 GMT-08:00 2008 -->
  6. <TITLE>
  7. XMLUtilities (jEdit API)
  8. </TITLE>
  9. <META NAME="keywords" CONTENT="org.gjt.sp.util.XMLUtilities class">
  10. <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
  11. <NOSCRIPT>
  12. </NOSCRIPT>
  13. </HEAD>
  14. <BODY BGCOLOR="white" >
  15. <!-- ========= START OF TOP NAVBAR ======= -->
  16. <A NAME="navbar_top"><!-- --></A>
  17. <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
  18. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  19. <TR>
  20. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  21. <A NAME="navbar_top_firstrow"><!-- --></A>
  22. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  23. <TR ALIGN="center" VALIGN="top">
  24. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  25. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  26. <TD BGCOLOR="#00008B" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  27. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XMLUtilities.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  28. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  29. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  30. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  31. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  32. </TR>
  33. </TABLE>
  34. </TD>
  35. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  36. </EM>
  37. </TD>
  38. </TR>
  39. <TR>
  40. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  41. &nbsp;<A HREF="../../../../org/gjt/sp/util/WorkThreadProgressListener.html" title="interface in org.gjt.sp.util"><B>PREV CLASS</B></A>&nbsp;
  42. &nbsp;NEXT CLASS</FONT></TD>
  43. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  44. <A HREF="../../../../index.html?org/gjt/sp/util/XMLUtilities.html" target="_top"><B>FRAMES</B></A> &nbsp;
  45. &nbsp;<A HREF="XMLUtilities.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  46. &nbsp;
  47. <NOSCRIPT>
  48. <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
  49. </NOSCRIPT>
  50. </FONT></TD>
  51. </TR>
  52. <TR>
  53. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  54. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  55. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  56. DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  57. </TR>
  58. </TABLE>
  59. <A NAME="skip-navbar_top"></A>
  60. <!-- ========= END OF TOP NAVBAR ========= -->
  61. <HR>
  62. <!-- ======== START OF CLASS DATA ======== -->
  63. <H2>
  64. <FONT SIZE="-1">
  65. org.gjt.sp.util</FONT>
  66. <BR>
  67. Class XMLUtilities</H2>
  68. <PRE>
  69. java.lang.Object
  70. <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.gjt.sp.util.XMLUtilities</B>
  71. </PRE>
  72. <HR>
  73. <DL>
  74. <DT><PRE>public class <B>XMLUtilities</B><DT>extends java.lang.Object</DL>
  75. </PRE>
  76. <P>
  77. XML utility methods that only depend on the JDK.
  78. <P>
  79. <P>
  80. <DL>
  81. <DT><B>Since:</B></DT>
  82. <DD>4.3pre6</DD>
  83. </DL>
  84. <HR>
  85. <P>
  86. <!-- ========== METHOD SUMMARY =========== -->
  87. <A NAME="method_summary"><!-- --></A>
  88. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  89. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  90. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  91. <B>Method Summary</B></FONT></TH>
  92. </TR>
  93. <TR BGCOLOR="white" CLASS="TableRowColor">
  94. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  95. <CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
  96. <TD><CODE><B><A HREF="../../../../org/gjt/sp/util/XMLUtilities.html#charsToEntities(java.lang.String, boolean)">charsToEntities</A></B>(java.lang.String&nbsp;str,
  97. boolean&nbsp;xml11)</CODE>
  98. <BR>
  99. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Converts &lt;, &gt;, &amp; in the string to their HTML entity
  100. equivalents.</TD>
  101. </TR>
  102. <TR BGCOLOR="white" CLASS="TableRowColor">
  103. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  104. <CODE>static&nbsp;org.xml.sax.InputSource</CODE></FONT></TD>
  105. <TD><CODE><B><A HREF="../../../../org/gjt/sp/util/XMLUtilities.html#findEntity(java.lang.String, java.lang.String, java.lang.Class)">findEntity</A></B>(java.lang.String&nbsp;systemId,
  106. java.lang.String&nbsp;test,
  107. java.lang.Class&nbsp;where)</CODE>
  108. <BR>
  109. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tries to find the given systemId in the context of the given
  110. class.</TD>
  111. </TR>
  112. <TR BGCOLOR="white" CLASS="TableRowColor">
  113. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  114. <CODE>static&nbsp;boolean</CODE></FONT></TD>
  115. <TD><CODE><B><A HREF="../../../../org/gjt/sp/util/XMLUtilities.html#parseXML(java.io.InputStream, org.xml.sax.helpers.DefaultHandler)">parseXML</A></B>(java.io.InputStream&nbsp;in,
  116. org.xml.sax.helpers.DefaultHandler&nbsp;handler)</CODE>
  117. <BR>
  118. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convenience method for parsing an XML file.</TD>
  119. </TR>
  120. </TABLE>
  121. &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
  122. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  123. <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
  124. <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
  125. </TR>
  126. <TR BGCOLOR="white" CLASS="TableRowColor">
  127. <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
  128. </TR>
  129. </TABLE>
  130. &nbsp;
  131. <P>
  132. <!-- ============ METHOD DETAIL ========== -->
  133. <A NAME="method_detail"><!-- --></A>
  134. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  135. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  136. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  137. <B>Method Detail</B></FONT></TH>
  138. </TR>
  139. </TABLE>
  140. <A NAME="charsToEntities(java.lang.String, boolean)"><!-- --></A><H3>
  141. charsToEntities</H3>
  142. <PRE>
  143. public static java.lang.String <B>charsToEntities</B>(java.lang.String&nbsp;str,
  144. boolean&nbsp;xml11)</PRE>
  145. <DL>
  146. <DD>Converts &lt;, &gt;, &amp; in the string to their HTML entity
  147. equivalents.
  148. <p>If <code>xml11</code> is true, then character entities
  149. are used to convert illegal XML characters (mainly ASCII
  150. control characters).</p>
  151. <P>
  152. <DD><DL>
  153. <DT><B>Parameters:</B><DD><CODE>str</CODE> - The string<DD><CODE>xml11</CODE> - Whether to allow XML 1.1 constructs.</DL>
  154. </DD>
  155. </DL>
  156. <HR>
  157. <A NAME="parseXML(java.io.InputStream, org.xml.sax.helpers.DefaultHandler)"><!-- --></A><H3>
  158. parseXML</H3>
  159. <PRE>
  160. public static boolean <B>parseXML</B>(java.io.InputStream&nbsp;in,
  161. org.xml.sax.helpers.DefaultHandler&nbsp;handler)
  162. throws java.io.IOException</PRE>
  163. <DL>
  164. <DD>Convenience method for parsing an XML file. This method will
  165. wrap the resource in an InputSource and set the source's
  166. systemId to "jedit.jar" (so the source should be able to
  167. handle any external entities by itself).
  168. <p>SAX Errors are caught and are not propagated to the caller;
  169. instead, an error message is printed to jEdit's activity
  170. log. So, if you need custom error handling, <b>do not use
  171. this method</b>.
  172. <p>The given stream is closed before the method returns,
  173. regardless whether there were errors or not.</p>
  174. <P>
  175. <DD><DL>
  176. <DT><B>Returns:</B><DD>true if any error occured during parsing, false if success.
  177. <DT><B>Throws:</B>
  178. <DD><CODE>java.io.IOException</CODE></DL>
  179. </DD>
  180. </DL>
  181. <HR>
  182. <A NAME="findEntity(java.lang.String, java.lang.String, java.lang.Class)"><!-- --></A><H3>
  183. findEntity</H3>
  184. <PRE>
  185. public static org.xml.sax.InputSource <B>findEntity</B>(java.lang.String&nbsp;systemId,
  186. java.lang.String&nbsp;test,
  187. java.lang.Class&nbsp;where)</PRE>
  188. <DL>
  189. <DD>Tries to find the given systemId in the context of the given
  190. class. If the given systemId ends with the given test string,
  191. then try to load a resource using the Class's
  192. <code>getResourceAsStream()</code> method using the test string
  193. as the resource.
  194. <p>This is used a lot internally while parsing XML files used
  195. by jEdit, but anyone is free to use the method if it sounds
  196. usable.</p>
  197. <P>
  198. <DD><DL>
  199. </DL>
  200. </DD>
  201. </DL>
  202. <!-- ========= END OF CLASS DATA ========= -->
  203. <HR>
  204. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  205. <A NAME="navbar_bottom"><!-- --></A>
  206. <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
  207. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  208. <TR>
  209. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  210. <A NAME="navbar_bottom_firstrow"><!-- --></A>
  211. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  212. <TR ALIGN="center" VALIGN="top">
  213. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  214. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  215. <TD BGCOLOR="#00008B" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  216. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XMLUtilities.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  217. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  218. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  219. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  220. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  221. </TR>
  222. </TABLE>
  223. </TD>
  224. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  225. </EM>
  226. </TD>
  227. </TR>
  228. <TR>
  229. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  230. &nbsp;<A HREF="../../../../org/gjt/sp/util/WorkThreadProgressListener.html" title="interface in org.gjt.sp.util"><B>PREV CLASS</B></A>&nbsp;
  231. &nbsp;NEXT CLASS</FONT></TD>
  232. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  233. <A HREF="../../../../index.html?org/gjt/sp/util/XMLUtilities.html" target="_top"><B>FRAMES</B></A> &nbsp;
  234. &nbsp;<A HREF="XMLUtilities.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  235. &nbsp;
  236. <NOSCRIPT>
  237. <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
  238. </NOSCRIPT>
  239. </FONT></TD>
  240. </TR>
  241. <TR>
  242. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  243. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  244. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  245. DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  246. </TR>
  247. </TABLE>
  248. <A NAME="skip-navbar_bottom"></A>
  249. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  250. <HR>
  251. </BODY>
  252. </HTML>