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