BUG? using own EntityResolver with SAX doesn't work

Hello,
I was experimenting with the oracle.xml.parser.XMLParser using
the SAX interface.
I've written a test program that instantiates a driver and
registers my own handlers (which just print to System.out).
I also have my own org.xml.sax.EntityResolver, it looks like
this:
public class SAXEntityResolver implements EntityResolver {
public InputSource resolveEntity(String publicId,
String systemId) throws SAXException, IOException {
System.out.println("<<Call to resolveEntity>>");
try { //assume it's a URL of some sort
URL url=new URL(systemId);
return new InputSource(url.openStream());
catch (MalformedURLException e1) {
try { //it's not a URL, assume a file spec
FileInputStream fin=new FileInputStream(systemId);
return new InputSource(fin);
catch (FileNotFoundException e2) {
return null;
//don't understand it, let the parser handle it.
when I parse the following xml file:
<?xml version="1.0"?>
<!DOCTYPE dinner SYSTEM "dinner.dtd">
<dinner>
<location planet="Earth">Alma 3</location>
<time>12:30</time>
<date>Vandaag</date>
</dinner>
The parser generates an error to my org.xml.sax.ErrorHandler
which prints it to the screen. The output looks like this:
[C:\temp\xml]java -cp c:\TEMP\xml\oracle\lib\xmlparser.jar;.
SAXParseXML oracle.xml.parser.XMLParser dinner.xml
Locater accepted: oracle.xml.parser.SAXLocator@6ba51a96
document parsing start
[error: Couldn't find external DTD 'dinner.dtd']
element dinner start: null:4:1
(other output follows with no more errors)
It seems as if the Oracle XMLParser doesn't use my EntityResolver
to resolve it's external entities (the dinner.dtd file in this
case, the file is indeed there, trust me!), otherwise it would
have printed the message seen in the code above (<<Call to
resolveEntity>>). If you're wondering how I configured the
systemId in the SAX parser, here's how:
File f=new File(args[1]);
InputSource src=new InputSource(new FileInputStream(f));
src.setSystemId(f.toURL().toString());
p.parse(src);
Can you tell me why this is? (I use NT4 with jdk 1.2)
I've tested the same thing with the IBM, Microstar and Sun
parsers, and they all seem to work fine with this example...
Hope to hear from you! (cc in with mail please)
Erwin.
null

Thanks for the post. You have identified a bug which will be
fixed in a maintenance release. Until that time you can parse a
String type rather than a InputSource type in SAXParseXML.java as
a workaround.
Oracle XML Team
http://technet.oracle.com
Erwin Vervaet (guest) wrote:
: Oracle XML Team wrote:
: : Which version of the parser are you using? If not 1.0.0.3
(the
: : latest) try that version. If the problem still exists it
would
: : help if you could provide your test program.
: The readme.html in the xmlparser_v1_0_0_3.zip file (I download
it
: on monday 8/2/1999) says: 'Oracle XML Parser 1.0.0.3.0'.
: So that's not the problem, below are all the files of the test
: program. The command I use to start the program is the
following
: (note that there cannot be a classpath clash problem!, I use
Sun
: jdk1.2 on NT4 SP4):
: [C:\temp\xml]dir
: Volume in drive C is unlabeled Serial number is 2C90:8BDE
: Directory of C:\temp\xml\*
: 11/02/99 10:50 <DIR> .
: 11/02/99 10:50 <DIR> ..
: 9/02/99 16:34 <DIR> aelfred
: 9/02/99 21:56 <DIR> oracle
: 8/02/99 17:44 <DIR> xml-ea2
: 8/02/99 14:10 <DIR> xml4j
: 9/02/99 22:44 <DIR> xp
: 9/02/99 16:42 215 dinner.dtd
: 9/02/99 23:03 167 dinner.xml
: 8/02/99 15:23 438 ParseXml.java
: 11/02/99 10:50 2.402 SAXDocHandler.class
: 9/02/99 21:14 1.585 SAXDocHandler.java
: 11/02/99 10:50 1.129 SAXEntityResolver.class
: 9/02/99 22:04 737 SAXEntityResolver.java
: 11/02/99 10:50 976 SAXErrHandler.class
: 9/02/99 15:39 495 SAXErrHandler.java
: 11/02/99 10:50 1.261 SAXParseXML.class
: 9/02/99 22:09 629 SAXParseXML.java
: 10.034 bytes in 11 files and 7 dirs 12.800 bytes
: allocated
: 201.152.512 bytes free
: [C:\temp\xml]java -cp c:\temp\xml\oracle\lib\xmlparser.jar;.
: SAXParseXML oracle.xml.parser.XMLParser dinner.xml
: Here are the files:
: //file SAXErrHandler.java
: import org.xml.sax.*;
: public class SAXErrHandler implements ErrorHandler {
: public void warning(SAXParseException exception) throws
: SAXException {
: System.err.println("[warning: " + exception +
: public void error(SAXParseException exception) throws
: SAXException {
: System.err.println("[error: " + exception + "]");
: public void fatalError(SAXParseException exception)
: throws SAXException {
: System.err.println("[fatal error: " + exception + "]");
: //file SAXEntityResolver.java
: import org.xml.sax.*;
: import java.net.*;
: import java.io.*;
: public class SAXEntityResolver implements EntityResolver {
: public InputSource resolveEntity(String publicId, String
: systemId) throws SAXException, IOException {
: System.out.println("<<Call to resolveEntity>> " + publicId + "
: + systemId);
: try { //assume it's a URL of some sort
: URL url=new URL(systemId);
: return new InputSource(url.openStream());
: catch (MalformedURLException e1) {
: try { //it's not a URL, assume a file
: spec
: FileInputStream fin=new
: FileInputStream(systemId);
: return new InputSource(fin);
: catch (FileNotFoundException e2) {
: return null; //don't understand
: it, let the parser handle it.
: //file SAXDocHandler.java
: import org.xml.sax.*;
: public class SAXDocHandler implements DocumentHandler {
: private Locator locator=null;
: public void startDocument() throws SAXException {
: System.out.println("document parsing start");
: public void setDocumentLocator(Locator locator) {
: System.out.println("Locater accepted: " + locator);
: this.locator=locator;
: public void startElement(String name, AttributeList atts)
: throws SAXException {
: System.out.println("element " + name + " start: "
: + locate());
: for (int i = 0; i < atts.getLength(); i++)
: System.out.println("attribute " +
: atts.getName(i) + "=" + atts.getValue(i) + " (" +
atts.getType(i)
: + ")");
: public void characters(char[] ch, int start, int length)
: throws SAXException {
: System.out.println("char data: " + new
: String(ch,start,length));
: public void ignorableWhitespace(char[] ch, int start, int
: length) throws SAXException {
: System.out.println("ignoring some whitespace: " +
: new String(ch,start,length));
: public void endElement(String name) throws SAXException {
: System.out.println("element " + name + " end: " +
locate());
: public void processingInstruction(String target, String
: data) throws SAXException {
: System.out.println("PI: " + target + "=" + data);
: public void endDocument() throws SAXException {
: System.out.println("document parsing end");
: private String locate() {
: if (locator!=null) {
: return locator.getSystemId() + ":" +
: locator.getLineNumber() + ":" + locator.getColumnNumber();
: return "";
: //file SAXParseXML.java
: import org.xml.sax.*;
: import org.xml.sax.helpers.ParserFactory;
: import java.io.*;
: public class SAXParseXML {
: public static void main(String[] args) {
: if (args.length>1) {
: try {
: Parser
: p=ParserFactory.makeParser(args[0]);
: p.setDocumentHandler(new
: SAXDocHandler());
: p.setErrorHandler(new
: SAXErrHandler());
: p.setEntityResolver(new
: SAXEntityResolver());
: File f=new File(args[1]);
: InputSource src=new
: InputSource(new FileInputStream(f));
: src.setSystemId(f.toURL().toString());
: p.parse(src);
: catch (Exception e) {
: e.printStackTrace();
: //file dinner.xml
: <?xml version="1.0"?>
: <!DOCTYPE dinner SYSTEM "dinner.dtd">
: <dinner>
: <location planet="Earth">Alma 3</location>
: <time>12:30</time>
: <date>Vandaag</date>
: </dinner>
: //file dinner.dtd
: <?xml version="1.0" encoding="UTF-8"?>
: <!ELEMENT dinner (location, time, date?)>
: <!ELEMENT location (#PCDATA)>
: <!ELEMENT time (#PCDATA)>
: <!ELEMENT date (#PCDATA)>
: <!ATTLIST location country CDATA "Belgium">
Oracle Technology Network
null

Similar Messages

  • I use an online application that doesn't work with FF, but I had been able to use an IE plugin within FF and it worked fine. After the last update (3.6.12), it says plugin is not compatable with version. Help?

    I use an online application that doesn't work with FF, but I had been able to use an IE plugin within FF and it worked fine. After the last update (3.6.12), it says plugin is not compatable with version. Help

    go to '''TOOLS '''then '''OPTIONS''' then '''ADVANCED''' then '''NETWORK tab''' then '''SETTINGS tab''' and select the options '''NO PROXY''' click '''OK''' and '''OK '''again in the next screen. With that you have disabled the proxy settings.
    ''if you like to not disable the proxy settings choose'' : '''Auto-detect proxy settings for this network''' (it is in the same session)
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • My VGA output using Mini DisplayPort to VGA doesn't work.

    Since I upgraded to Mavericks, my VGA output using Mini DisplayPort to VGA doesn't work. When I was using Mountain Lion, as soon as you plugged in the Mini adaopter into the mini display port, the screen would shrink and format to where it would project via a RGB cable to a projector. No such luck since Mavericks! Also, I had a lot of trouble with the DVD player when I tried to play a DVD and project it via a projector. It all worked seamlessly with Mountain Lion. Can anyone help me?

    I think if you go to System Preferences >> Displays and Option-click on the "Scaled" radio button, it will show you all of the resolutions that you would have had before under Mountain Lion. I just upgraded to Maverick and my resolution preferences (mirrored on a TV using the Mini DisplayPort to VGA adapter, using 1280x768) were completely reset (my display was no longer mirrored, and the resolution on my main iMac screen became 2560x1440). I found my answer here: https://discussions.apple.com/message/23599645#23599645. Hope that helps.

  • Cropping pictures with Viewer doesn't work.

    Cropping pictures with Viewer doesn't work.
    Selecting < or ~ 12 pictures. (picture size are Snapshots with iphone resolution) ->Viewers opens and display them. -> Russian roullette between cmd+k or the little crop button. No indication which one will process a crop or which not. -> Both result in picture selection disappear with no crop.
    Selecting > 12 pictures. (picture size are Snapshots with iphone resolution) -> Viewer opens and display them. I crop them one by one with same Russian roulllette behavior between cmd+k or the little crop button. -> Closing Viewer. -> Pictures remain like they've been before. Not cropped.

    I just tried what you described (although I can't really fathom why you would describe it as Russian roulette (with a variable number of L's). Unless you've been drinking a lot, which is what people are usually doing when they are playing Russian roulette. Your post was hard enough to decipher without that.
    Anyway, my cropping was saved each time. I think there's something wrong with your Preview.app. Have you changed anything about the autosave functions of OSX?
    I would try:
    Boot into your recovery partition (restart, hold down ⌘R until you see the Apple logo), and use Disk Utility to repair your hard drive. Repair permissions too while you're there. OS X: About OS X Recovery
    if that doesn't help, then I'd reinstall Mavericks over your current installation.

  • Firefox sent an update but it wouldn't download because it said it came through an e mail improperly coded or tried to use adobe acrobat and that doesn't work. what do I do

    firefox sent an update to my imac but I couldn't download it because it said it came through an email improperly coded or tried to use adobe acrobat and that doesn't work. what do I do??

    What to Do When Your iPad Won't Turn On
    http://ipad.about.com/od/iPad_Troubleshooting/ss/What-To-Do-When-Your-Ipad-Wo-No t-Turn-On.htm
    iOS: Not responding or does not turn on
    http://support.apple.com/kb/TS3281
    iPad Frozen? How to Force Quit an App, Reset or Restart Your iPad
    http://ipadacademy.com/2010/11/ipad-frozen-how-to-force-quit-an-app-reset-or-res tart-your-ipad
    iPad: Basic troubleshooting
    http://support.apple.com/kb/TS3274
    Update and restore alert messages on iPhone, iPad, and iPod touch
    http://www.buybuyla.com/tech/view/012953a0d412000e.shtml
    iOS: Resolving update and restore alert messages
    http://support.apple.com/kb/TS1275
    iPad: Unable to update or restore
    http://support.apple.com/kb/ht4097
    iTunes: Specific update-and-restore error messages and advanced troubleshooting
    http://support.apple.com/kb/TS3694
     Cheers, Tom

  • Cs4 and w7 use default masks on adjustament doesn't work

    Hi
    i installed cs4 on a fresh install of w7
    and use default masks on adjustament doesn't work
    enabled or disabled ,every time i add an adjustamen layer ,photoshop add a blanck white mask
    thanks
    is there a cure?

    wrong look the screenshot
    i resized the screenshots

  • If I use my own domain with mobileme, does it work with google search?

    I've noticed something, I used to only access my page with web.me.com/NAME and it shows up relatively at the top of of the google search results when I search for NAME or things related to me.
    Since then I have started using my own domain which I have bought from godaddy.com. Now I'm not sure if I am doing it right, but at godaddy, I setup this forward to web.me.com/NAME as a 301 site move. When I type in my own domain, it gets redirected ok but the problem is it never shows up in google. It doesn't show up if i search for "mydomainname" or "mydomainname.com" or anything.
    Any ideas? Does forwarding (cloak) does not work with search engines?

    You are referring to IP addresses and Nameservers. You DON'T need these if you are using CNAME forwarding. They are not required.
    Normally, when you set up CNAME forwarding you would delete the A record and set-up CNAME in its place. At least this is what I had to do when I used CNAME forwarding with MobileMe. I went to my DNS settings and there were A records against both @ and www. I had to delete both of these and set up new records, one for @ with CNAME that pointed to web.me.com and then the other for www, CNAME that also pointed to web.me.com.
    What you have done sounds right, in that your domain name is pointing to web.me.com that is where your new website is with iWeb/MobileMe.
    I think your problem is due to your old website that you created with Microsoft Office Live. You seem to have used the same domain name with this? If so, have you deleted your old site that you created with Microsoft Office Live?
    I don't quite know how Microsoft Office Live works, but I know that you can create a site with them quite quickly using their templates and colour themes, although it is limited as to what you can do and probably is not as good as iWeb. Did you register the domain name through them and then publish? How do you publish to their server? You need to remove this site totally from the server so that your domain name will just be linked to your iWeb/MobileMe site.
    I think the problem lies with your old site and Microsoft Office Live rather than your CNAME settings at GoDaddy. Investigate this first.

  • Since using Castor, SAX doesn't work anymore

    Hello!
    I have some problems with my libraries. I use castor.exolab for working with SOM and I use the SaxFactory
    of Jdk1.5 beta for validating my XML-files. Since I use the castor library I have problems with SAX and Xerces. It gives an AbstractMethodException when I call the function
    getEncoding() for a Document Node
    and when I set the validating property for validating my Document with SAX:
    org.xml.sax.SAXNotRecognizedException: http://java.sun.com/xml/jaxp/properties/schemaSource
         at org.apache.xerces.parsers.AbstractSAXParser.setProperty(AbstractSAXParser.java:1691)
         at org.apache.xerces.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:205)
    I got stuck of these problems... which libraries can I use to get it work together with the castor libraries?
    Thanx for help!

    It were the libraries. I took the newest Xerces library (XercesImpl.jar) and then it worked!

  • Possible bug using go tag with redirection under SSL?

    I've been testing an application under SSL and have noticed that some links "pop-out of SSL". Upon further inspection I noticed the links were using <go> tags with redirect set to true.
    Does anyone know where <go> gets the URL it uses? I'm wondering if this might be a webcache configuration issue or appserver config issue.
    note: using AS 10g 9.0.4.1.1
    Thanks in advance!
    /SFL

    Hi all,
    Just thought I'd update on resolution. As suspected, an AS config issue was responsible for this glitch. Long story short WebCache can communicate in 2 ways w/ an origin server (HTTP or HTTPS). You can have WebCache use SSL w/ the client and still communicate with the origin server using HTTP (which was our case). PITFALL: the origin server is unaware of the use of SSL by the client (WebCache only "knows"). SINCE THE ORIGIN SERVER IS THE ONE EXECUTING THE <GO> TAG, when using redirect=true attribute with the tag, the URL generated by the rewrite routine is HTTP and not HTTPS as one might expect when accessing the app via SSL.
    Hope I can spare someone else the headache...
    Cheers!
    /SFL

  • Printing PDDoc with AFExecuteThisScript() doesn't work after an upgrade from SDK 5 to SDK8

    Hello,
    I have made an upgrade of my plug-in which was developed with the Acrobat 5 SDK. I upgrade it to Acrobat 8 SDK and my print function doesn't work anymore.
    Actually I print my document using a javascript trusted function instead the function provided by the C++ library for internal reason.
    Here below is the code used to print my document :
    char szJavaPrint[6000];
    sprintf(szJavaPrint,
    "pp = this.getPrintParams(); \r\n"
    // fill pp with parameters
    "pp.interactive = pp.constants.interactionLevel.silent; \r\n"
    "\r\n"
    "this.trustedPrint(this, pp);"
    PDDoc pdDoc = AVDocGetPDDoc(avDoc);
    AFExecuteThisScript(pdDoc, szJavaPrint, NULL);
    It was working with the Acrobat 5 SDK but the print seems to have no effect using the Acrobat 8 SDK. I know that there is a change between Acrobat 5 and 8 concerning the Character Set (currently I set the Character Set to "Not Set" in the Configuration Properties of the project) but I don't think that my problem comes from the Character Set.
    All ideas to resolve this problem are welcome.
    Kind regards,
    Joe

    See what happens if you remove the "setting of interactive to silent"...
    There is a restriction on silent printing in Acrobat, but I would not have expected that to be passed into this method - but it could have been overlooked and be a bug.
    Also, I don't recall a trustedPrint() method in Acrobat JS - check the documentation for the correct name of this function...

  • Mailing with SMTP doesn't work anymore, 10.6.2

    Hi all,
    after reading so many posts regarding Mail and how sending emails doesn't work with 10.6.2, there still seems to be no solution that works for everyone.
    After Updating to 10.6.2 I cannot send emails through ANY smtp server.
    I also have a windows 7 machine running thunderbird and everything works there.
    I tried all suggested solutions,i.e.
    1.) I checked connection doctor and everything seems to be fine (including the detailed messages)
    2.) I tried all sort of settings, with, w/o SSL, all sorts of ports
    3.) I "reset" the keychain
    4.) I "reset" Mail preferences by deleting com.apple.mail.plist in library\preferences
    still, I can only receive emals but not send. any solutions are greatly appreciated, thank you in advance!

    Hi - here is a bizarre solution (possible bug); I hadn't been able to ever send any with my 3 month old MacBookPro through Apple Mail 4.2, similar to what you say. That was under 10.6, 10.6.1 and 10.6.2. I was using my Win PC to send emails, or via Web clients in Safari off the MacBookPro, but finally I reached the time to call Orange UK, my ISP...
    I have just had a great experience with their technical support, but the solution reached was NOT logical - let me explain it, perhaps it might work for you.
    The logical background is this:
    Define an SMTP server; if you have Orange broadband, you HAVE to use theirs (as they block other servers form using the standard ports 25, 465 and 587 - apparently for SPAM reasons, or perhaps they are now required to keep an eye on everything... who knows.
    So, in Apple Mail 4.2; we went to the menus, and Mail -> Preferences
    highlight any account on the left, and at the bottom of the right hand pane, in the Account Information tab, click and define the SMTP server (click the box, choose Edit server, create an SMTP server - for Orange UK, I had to put in
    smtp.orangehome.co.uk
    then ensure this is the only SMTP server Apple Mail uses, by checking the box in Account Information tab, Use only this server.
    Go back into Advanced tab, and here is where the logic starts to end...
    To recap: Mail -> Preferences -> Click on the Orange SMTP server button -> click "Edit SMTP server list..." (again) and go to the Advanced tab.
    In this tab are two main choices:
    Use Default Ports (25,465,587)
    Use Custom Port (by default this is a completely blank box)
    Now, logic dictates that you would leave the 'use default ports' option checked, then try all other manner of parameter changes. But, we tried forcing 25 into Use Custom Port.
    Use Custom Port - 25
    but this too didn't work.
    Then I tried, for fun:
    Use Custom Port - 587 (no SSL checked, and Authentication - none; again illogical as 587 should be an SSL port, as is 465)
    And... suddenly my mail sent, for the first time ever!
    mmm... When I looked again at this tab, though, the Use Custom Port box had reverted to saying...
    Use Custom Port - 25 (???) but who cares, it worked. Why it didn't work the first time, I have no clue.
    NB Between each try, I quit Apple Mail, deleted my test Outbox sending messages, and essentially made sure nothing was trying to be sent. This was between each 'attempt'. This might have been an important thing to do, but I don't know.
    So, my best guess is to just try forcing the Custom Port to be 25, then 587... and keep trying. My emails still take about 5-10 secs to send, rather than almost immediately like they used to before I started with Orange Broadband (which I am, interestingly, finding to be a faster service than my previous ISP, and as yet, appears just as reliable...) It’s all so Weird! It’s the only thing that has really annoyed me with this my first Mac, so that’s good going!
    Good luck!

  • Fit the window with mouse doesn't work after new update 10.9.2

    Hi, I could fit a windows using my mouse wheel or two finger(on trackpad), doesn't work after I set up new Mavericks update(10.9.2) I'm using Haswell rMBP. Can anyone help me please? Thanks a lot. (Also, minimize with mouse wheel doesn't work too.)

    Doesn't anyone having this issue?

  • "Store presets with catalog" doesn't work with web galleries

    I reinstalled Windows 7 and copied over my LR4 presets and galleries over to the new install.  I decided to try ""Store presets with catalog" to keep things simpler next time since I do periodic backups of the catalog folder anyway, so in the future all presets are backed up at the same time as the catalog.  I put the presets including a couple web gallery presets in the proper folders.  LR4 recognized all presets except for the web gallery presets--when I went to the Web module it didn't list them as options.  I then copied those web gallery presets to the default LR4 settings folder (C:\User\XYZ\AppData\Etc-so-on-so-forth) at which point it recognized the presets and listed them in the Web module.
    So it seems that LR4 doesn't respect the "Store presets with catalog" setting when looking for web gallery presets.  Am I missing something?

    MentatYP wrote:
    Yeah, I have 1 gigantic catalog so it makes sense for me to keep presets with the catalog file for backup purposes.
    I disagee. You've already discovered that Web Galleries remain in the default location when you use "Store Presets with Catalog", and there are other things as well which remain in the default location. So if you want to backup your entire Lightroom environment, including settings, now you have to backup not only the Lightroom Settings folder adjacent to the catalog, but also the Lightroom folder in the appdata area of your user profile. It's far simpler to leave everything in the default location (cos you still have to back it up, right), than mess about with backing up partial sets of settings.
    Plus, as Sean says, leaving them in the default location means any new catalog (e.g. for testing) gets access to your presets irrespective of where you locate it.
    To be honest, I don't think the "Store Presets with Catalog" was the development team's finest hour, as it's implementation seems muddled and inconsistent. We've had to bail out so many people over at Lightroomforums.net ("help, my presets are missing!") that we ended up documenting the implications of using that setting: http://www.lightroomforums.net/showthread.php?14169-What-is-the-purpose-of-the-quot-Store- Presets-with-Catalog-quot-option

  • 'Alt' with + or - doesn't work

    The adjustment increment of several of the sliders is supposed to be reduced by holding the Alt key down while the + or - key. This doesn't work on my system. I've tried tested both Alt keys with both + and - keys on my keyboard. No luck. All I get is the Windows error tone. Using the Shift key to increase the adjustment increment works as it should. Any ideas out there? TIA, njb

    I consider it's working OK on Windows
    But it's platform dependent !
    To resume :
    Windows   + and -  give  small  increments , shift and + and - give   big increments
    Mac          + and - give  big increments ,  alt and + and - give small increments.
    And the Martin Evenings book is the best LR book for me, though here he's may be not clear enough.

  • RowBanding with BC4J doesn't work

    I want to use rowBanding in a table with a viewObject as its source.
    It doesn't work.
    Could anybody help me?
    TIA
    Francisco Bosch

    Francisco:
    Could you tell me what you mean by "rowBanding?" Are you referring to Swing (JClient) client or HTML client?
    Thanks.
    Sung

Maybe you are looking for