<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Thanks Rolf.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>I am able to run </span><b><span style='font-size:10.0pt;font-family:Consolas;color:#7F0055'>new</span></b><span style='font-size:10.0pt;font-family:Consolas'> SAXBuilder(</span><b><span style='font-size:10.0pt;font-family:Consolas;color:#7F0055'>new</span></b><span style='font-size:10.0pt;font-family:Consolas'> XMLReaderSAX2Factory(</span><b><span style='font-size:10.0pt;font-family:Consolas;color:#7F0055'>false</span></b><span style='font-size:10.0pt;font-family:Consolas'>, </span><span style='font-size:10.0pt;font-family:Consolas;color:#2A00FF'>"org.apache.xerces.parsers.SAXParser"</span><span style='font-size:10.0pt;font-family:Consolas'>)); OK.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>I do have xercesImpl and xml-apis in my classpath.  But I cannot yet get the no arg constructor (new SAXBuilder()) to run.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>Is there some advantage to using the no arg constructor?  <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>Thanks, Craig</span><span style='color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> Rolf Lear [mailto:jdom@tuis.net] <br><b>Sent:</b> Tuesday, August 21, 2012 12:39 PM<br><b>To:</b> Craig Christophersen<br><b>Cc:</b> jdom-interest@jdom.org<br><b>Subject:</b> Re: [jdom-interest] jdom2 runtime<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>In JDOM 2.x the new SAXBuilder()   (no arguments) will use regular JAXP API's to get the right SAX Parser for your system.<br><br>The JAXP process is described here: <a href="http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance%28%29">http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance%28%29</a><br><br>In most cases, if you want to use a particular parser (xerces, for example), all you need to do is add the jar to the classpath. As a fallback mechanism, the standard JRE has an XML Parser built in already (an older version of xerces with some customizations - one of which is that it is not in the regular apache package.... so you cannot call it org.apache.xerces.parsers.SAXParser). So, you do not need to have any third-party jar unless you want one. I would still recommend adding xerces to your classpath though (and with it, you will want the xml-apis.jar).<br><br>So, in your 'old' code, if you used to do:<br><br>... = new SAXBuilder("org.apache.xerces.parsers.SAXParser");<br><br>then I suggest you either:<br>   -  add (only) xerces (with xmlapis.jar) to the classpath, and use the plain ... = new SAXBuilder(); constructor....<br>   -  add xerces to the classpath, use ... = new SAXBuilder(new XMLReaderSAX2Factory(false, "org.apache.xerces.parsers.SAXParser"));<br><br>Note though, that the deprecated/'old' constructor new SAXBuilder("org.apache.xerces.parsers.SAXParser"); will still work (with a deprecated warning) if you have the xerces.jar in your classpath.<br><br>I recommend that you use the (newer) JAXP API for constructing SAXBuilders. You can still customize it with a particular library.<br><br>I note that there is a lack of functionality in JDOM for using JAXP with a custom factory.... I will add that.... I think.... see issue #89<br><br>For what it's worth, the documentation on the org.jdom.input.sax is fairly comprehensive: <a href="http://www.jdom.org/docs/apidocs/org/jdom2/input/sax/package-summary.html">http://www.jdom.org/docs/apidocs/org/jdom2/input/sax/package-summary.html</a> even though it does not have an example of what you want (although it has other examples).<br><br>Also, the source code for the deprecated constructor is educational... :<br><a href="https://github.com/hunterhacker/jdom/blob/master/core/src/java/org/jdom2/input/SAXBuilder.java#L266">https://github.com/hunterhacker/jdom/blob/master/core/src/java/org/jdom2/input/SAXBuilder.java#L266</a><br>and<br><a href="https://github.com/hunterhacker/jdom/blob/master/core/src/java/org/jdom2/input/SAXBuilder.java#L288">https://github.com/hunterhacker/jdom/blob/master/core/src/java/org/jdom2/input/SAXBuilder.java#L288</a><br><br>I will consider the usage of a JAXP custom factory using the 'other' JAXP constructor:  <a href="http://docs.oracle.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance%28java.lang.String,%20java.lang.ClassLoader%29">http://docs.oracle.com/javase/6/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance%28java.lang.String,%20java.lang.ClassLoader%29</a><br><br>Issue #89: <a href="https://github.com/hunterhacker/jdom/issues/89">https://github.com/hunterhacker/jdom/issues/89</a><br><br>Rolf<br><br>On 21/08/2012 1:23 PM, Craig Christophersen wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal>Hello;<o:p></o:p></p><p class=MsoNormal>While I now have jdom2 compiling OK in an application, I am running into runtime problems with SAXBuilder.<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>With previous jdom both SAXBuilder builder = new SAXBuilder();  and SAXBuilder builder = new SAXBuilder(“<u><span style='font-size:10.0pt;font-family:Consolas;color:#2A00FF'>org.apache.xerces.parsers.SAXParser</span></u>”);<span style='font-size:10.0pt;font-family:Consolas'>   worked for constructing a SAXBuilder.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>Question:</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>So now to use new SAXBuilder() (which uses JAXP) do I need something additional in my classpath??  </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>Or is there somewhere I can see an example of what is mentioned in the migration guide ---</span>   <b>Deprecated.</b> <i>use <a href="http://www.jdom.org/docs/apidocs/org/jdom2/input/SAXBuilder.html#SAXBuilder%28org.jdom2.input.sax.XMLReaderJDOMFactory%29"><code><span style='font-size:10.0pt'>SAXBuilder(XMLReaderJDOMFactory)</span></code></a> with <a href="http://www.jdom.org/docs/apidocs/org/jdom2/input/sax/XMLReaderSAX2Factory.html#XMLReaderSAX2Factory%28boolean,%20java.lang.String%29"><code><span style='font-size:10.0pt'>XMLReaderSAX2Factory.XMLReaderSAX2Factory(boolean, String)</span></code></a>?</i><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:Consolas'>Thanks,            </span><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>Craig Christophersen<o:p></o:p></p><p class=MsoNormal>Software Developer<o:p></o:p></p><p class=MsoNormal>Synesis7<o:p></o:p></p><p class=MsoNormal><a href="mailto:craigch@synesis7.com">craigch@synesis7.com</a><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br><br><br><o:p></o:p></span></p><pre>_______________________________________________<o:p></o:p></pre><pre>To control your jdom-interest membership:<o:p></o:p></pre><pre><a href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</a><o:p></o:p></pre></blockquote><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p> </o:p></span></p></div></body></html>