Anybody know how to read "xerces"?? and a lot more......

And, what's the relationship between xerces and sun's JAXP? Is jaxp more a interface less an implementation? I found jaxp calls some part of xerces pack. Meanwhile, in xerces pack there sits a jaxp pack. Xerces say it support jaxp, so, is that mean xerces is a implementation of jaxp interface?
Both of the two pack contains some implementation..... I'm confused.
Can anybody give me an insider's view of jaxp package?
"The SAX Plugability classes allow an application programmer to provide an implementation of the
org.xml.sax.DefaultHandler API to a SAXParser implementation and parse XML documents. As the parser processes the XML document, it will call methods on the provided DefaultHandler."
------from jaxp1.2 spec
I'm sorry but English isn't my mother tongue. I'm rather confused by the statements above. Anybody do me a favour to translate it to plain English? Very much thanks.
Also, what does the following code mean? (from javax.xml.parser.SAXParserFactory.java)
class FactoryFinder is in nowhere to be found. Can anybody help explain it?
    public static SAXParserFactory newInstance()
        throws FactoryConfigurationError
        try {
            return (SAXParserFactory) FactoryFinder.find(
                /* The default property name according to the JAXP spec */
                "javax.xml.parsers.SAXParserFactory",
                /* The fallback implementation class name */
                "org.apache.crimson.jaxp.SAXParserFactoryImpl"); //what's this??
        } catch (FactoryFinder.ConfigurationError e) {
            throw new FactoryConfigurationError(e.getException(),
                                                e.getMessage());
    }Moreover, what the relation between SAXParserFactoryImpl and SAXParserFactory?
I wrote a program to validate xml files against dtd or schema. Does the package automatically find dtd or schema files within the xml or i have to offer them in the command line? In my case, it seems to be the latter.

Well, you see, my real problem is that i coded to validate a xml file against xsd or dtd. However, I have to feed the program with a dtd or xsd file in the command line to make it work. Isn't it supposed to find out a proper dtd/xsd in the xml file(when specified)? Or I it isn't properly configured?
Help me, please!
Here is the code:
package xmltool;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import java.io.*;
* This class validate a xml file against its DTD or Schema.
* @version 1.1
* @auther Data Zoe
public class Check extends DefaultHandler
    /** Constants used for JAXP 1.2 */
    static final String JAXP_SCHEMA_LANGUAGE =
        "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
    static final String W3C_XML_SCHEMA =
        "http://www.w3.org/2001/XMLSchema";
     public static void main(String args[])throws Exception
          //tag varible
          boolean dtdValidate = false;
          boolean xsdValidate = false;
          //xml file to be validated
          String fileName = null;
          //Check input
          for(int i=0;i<args.length;i++)
                    if(args.endsWith(".xml")||args[i].endsWith(".XML"))
                         fileName = args[i];
                    else if(args[i].endsWith(".xsd")||args[i].endsWith(".XSD"))
                         xsdValidate = true;
                    else if(args[i].endsWith(".dtd")||args[i].endsWith(".DTD"))
                         dtdValidate = true;
                    else
                              System.err.println("Out put usage infomation.");
          if(fileName!=null)
               SAXParserFactory spf = SAXParserFactory.newInstance();
               spf.setNamespaceAware(true);
               spf.setValidating(dtdValidate||xsdValidate);
               SAXParser saxParser = spf.newSAXParser();
               XMLReader xmlReader = saxParser.getXMLReader();
               xmlReader.setContentHandler(new Check());
               xmlReader.setErrorHandler(new myErrorHandler(System.err));
               xmlReader.parse(fileName);
               if (xsdValidate)
                    try     {saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);}
                    catch (SAXNotRecognizedException x)
                              // This can happen if the parser does not support JAXP 1.2
                              System.err.println(
                                   "Error: JAXP SAXParser property not recognized: "
                                   + JAXP_SCHEMA_LANGUAGE);
                              System.err.println(
                                   "Check to see if parser conforms to JAXP 1.2 spec.");
                              System.exit(1);
          else
               System.err.println("No xml file to validate");
     * Error handler
     private static class myErrorHandler implements ErrorHandler
          /** Error handler output goes here */
          private PrintStream out;
          myErrorHandler(PrintStream out)
               this.out = out;
          * Returns a string describing parse exception details
          private String getParseExceptionInfo(SAXParseException spe)
               String systemId = spe.getSystemId();
               if (systemId == null)
                    systemId = "null";
               String info = "URI=" + systemId +
                    " Line=" + spe.getLineNumber() +
                    ": " + spe.getMessage();
               return info;
          // The following methods are standard SAX ErrorHandler methods.
          // See SAX documentation for more info.
          public void warning(SAXParseException spe) throws SAXException
               out.println("Warning: " + getParseExceptionInfo(spe));
          public void error(SAXParseException spe) throws SAXException
               String message = "Error: " + getParseExceptionInfo(spe);
               throw new SAXException(message);
          public void fatalError(SAXParseException spe) throws SAXException
               String message = "Fatal Error: " + getParseExceptionInfo(spe);
               throw new SAXException(message);

Similar Messages

  • Do anybody know how to read file...

    Hello,
    I have a problem with reading config file. Do anybody know how to read config file from the same dir as class.
    Now the situation is like:
    filePath I hardcoded like:
    fileName = "C:\\apache-tomcat-5.5.17\\webapps\\ROOT\\WEB-INF\\classes\\config.sales";
    Is it possibility to read config file wich is used by java classes (in prj) from the same dir as classes are?
    Thanks in advance.

    If the file is in the class path you should be able to access it using the Class.getResourceAsStream method. It is the same concept as loading a properties file:
    http://www.javaworld.com/javaqa/2003-08/01-qa-0808-property_p.html

  • Does anybody know how to read from a .doc???

    This isn't for a project or anything, just simple curiosity.

    Not sure, I never used it directly. I can tell you that I used JasperReports, and it can output a report to Excel XLS format with all the formating of the original report.
    Best bet would be to read the docs at the URL I provided. It would tell you the specifics better than I can.

  • Does anyone know how to read .data and/or .response files on/through Dreamweaver?

    Or any other safe program?
    I really need to get the code asap.  If you can help it would be much appreciated.

    Hi,
    I concur with Nancy in that you'll want to open/read the file in those suggested plain text editors if needing access to the code. 
    Kind regards,
    -Sidney

  • I need to erase the contents of my phone and restore to factory settings. Does anybody know how to save your texts so you don't lose them?  Can I back those up to iCloud?  My phone was very likely hacked (Apple's advice was to call the police!)

    "I need to erase the contents of my phone and restore to factory settings. Does anybody know how to save your texts so you don't lose them?  Can I back those up to iCloud?  My phone was very likely hacked (Apple's advice was to call the police!)"
    That was all I could put in the initial "box."  Then it brought me to this page with instructions on how to write a good sentence.
    Proceeding ...
    After going back and forth between Apple, AT&T and the police (all telling me to go to the other two) I took AT&Ts suggestion and got a new number. One tech warned against doing a backup, especially on my Mac, saying if my phone had been hacked then whatever bug was there would then invade my computer. But nobody knows how to determine if the phone has been hacked or a virus was planted there. Unfortunately I know who would have reason to do such a thing and all I can say is that he is at the top technologically and could easily do it. Almost impossible to prove, however.
    So I need to preserve my text messages and my emails as well. I backed up my photos to that Microsoft product (One-Drive) and it froze (Surprise, Surprise) with four short videos to go, and no way of stopping that (when I tried it crashed repeatedly) so I'm in crisis mode here.
    Help ...
    Running 8.0 on 5S
    Thanks!

    Betty I don't know if you fixed your hacking problem but I feel your pain. I've seen some strange things going on between my iMac and my iPhone and Apple has told me the same thing, call the police which I have done. The hackers have stole 500.00 out of my checking account have access to every internet account I use and no matter how often I change the password their right back on the account. I closed my FB account 3 times only to have someone reopen it. Right now I've got a link in my reading list (Safari) that if I click on it, it allows me to log onto my FB account anonymously.
    I've seen a green folder come out of no where while I was trying to delete my passwords out of keychain when that green folder was put into the key chain I was immediately locked out. I than went into system preferences to try to make changes to my security settings, when I clicked on the icon it wouldn't open. I've seen log files of automator receiving commands and sending out my personal information thats on my computer.
    I have a legitamate program called iExplorer that allows you to look at the contents of your iPhone back ups and saw a transaction someone made at the Apple store for some full length movies, some albums, ibooks and other apps but when I called the iTunes store and they said none of those items were showing up on my account. If their not on my account how can they be on my iPhone 6? One day someone was using my gmail account and unknowingly used google maps to search for an Italian restaurant, than a Mexican restaurant than a coffee shop and their search showed up on my iPhone but I didn't have my gmail account installed on my iPhone 6. Using my computer I logged onto my gmail account and looked at the maps history and sure enough there were the searches when I'd hover my curser over the link it gave me the longitude and latitude of the where the hacker was when he was using google maps. I know whoever reads this thinks Im crazy but I've documented everything and can prove the things that I have mentioned in this post actually happened.
    One day I had my laptop (pc) and my iMac next to each other as I was using both. when I clicked on airport it showed that my laptop and my iMac had made a connection and were actually communicating with each other. I know I didn't do it I don't know how. The iMac was logged into my iCloud account while my laptop wasn't. I have formatted my iPhone at least a dozen times, Apple and an Apple retailer have formatted my hard drive not to mention the numerous times I have formatted it but the hackers keep getting on my devices. Im formatting my lap top at this very second because during the course of the night I left the ethernet cable plugged into it and they locked me out of my c: drive, and configured the system so I can't download any updates from Microsoft, overtime I type in www.microsoft.com it changes to ww38.microsoft.com which takes me to a blank page. I right clicked on the page I was redirected to and read the java script and couldn't believe that someone had actually configured Internet Explorer to redirect me to a blank page when I tried to go to Microsoft. Apples answer to all this is there was nothing wrong with my iPhone or my iMac and if I thought there was a problem to call the police which I have done.
    Theres no doubt the hackers are reading this while I type it or will read it and I simply don't care anymore. I no longer email anyone, don't use my iCloud account and have taken precautions to protect my credit but if I ever find out who has invaded my privacy to this extreme the police are going to want to talk to me because Im going to hurt them like they've never been hurt before

  • I have 2 iPhones - one for personal use and one for work. They are currently connected with the same Apple ID. I would like to separate the two accounts. Does anybody know how to do this?

    I have 2 iPhones - one for personal use and one for work. They are currently connected with the same Apple ID. I would like to separate the two accounts. Does anybody know how to do this?

    Just create a new AppleID for your work.
    As Allan suggested, items purchased on one iTunes account cannot be moved to the other account.
    However, you can put items purchased on on account onto the other iPhone.

  • I just got my dads old iPhone 4. I restored it to factory settings and set it up with my apple id. The albums in my music are fine in iTunes but on my phone the albums are split and each song is its own album. Does anybody know how to fix this?

    My dad has recently gotten a new phone and I got his old one. With his permission I restored it to factory settings and set up the iPhone 4 as a new phone with my apple id. Everything has downloaded fine but I have had many problems with my music. First it was where my phone didnt recognise my apple id, but I  figured that out. Then it was where iTunes took one of my albums and split it so all the songs where their own albums. I fixed the album split on iTunes but its still like that on my iPhone. I have looked online everywhere and I still haven't found a solution! I'm getting super frustrated! Does anybody know how to fix this?

    No it's not stealing. They have an allowance that you can share with so many computers/devices. You'll have to authorize her computer to play/use anything bought on your acct. You can do this under the Store menu at top when iTunes is open on her computer.
    As far as getting it all on her computer....I think but I am not sure (because I don't use the feature) but I think if you turn on Home Sharing in iTunes it may copy the music to her computer. I don't know maybe it just streams it. If nothing else you can sign into your acct on her computer and download it all to her computer from the cloud. Not sure exactly how to go about that, I haven't had to do that yet. I wonder if once you authorize her computer and then set it up for automatic downloads (under Edit>Preferences>Store) if everything would download. Sorry I'm not much help on that.

  • Hey, does anybody know how can i have two different apple ids on my mac imessages, because i have two mobile phones with different ids and i would like to be able to send imessages from both accounts on my mac. Tnx

    Hey does anybody know how to set up 2 apple ID on mac imessages? Because i have 2 different iphones and i would like to send imessages fron both accounts on my mac...

    Associate your mobile numbers with your Apple ID, if you haven't already done so.
    Sign out of iMessage on the Mac:
    Messages ▹ Preferences ▹ Accounts ▹ Sign out
    and on the iPhone:
    Settings ▹ Messages ▹ Send & Receive ▹ Apple ID ▹ Sign out
    Then, on the phone, tap
    Use Your Apple ID for iMessage
    Sign back into iMessage on both devices and test. If there's no change, you may have to wait for a change in network conditions.
    Credit for this solution to ASC member SmittyLove and to Glenn Fleishman of tidbits.com.

  • The screen resolution in 1920x1200 dropped on my MacBook Pro 17". Seems like I have not the same pixels. There are also vertical, thin lines on the screen. Makes the screen look milky. Anybody knows what's going on and how to fix it?

    The screen resolution in 1920x1200 dropped on my MacBook Pro 17". Seems like I have not the same pixels. There are also vertical, thin lines on the screen. Makes the screen look milky. Anybody knows what's going on and how to fix it?

    Take it to an Apple Store or other service provider for testing.

  • Suddenly, time machine is very slow. Used to take up a minute and now more than half an hour. Does anybody know how this can happen? Indexing the back-up disk is off, but Timde Machine keeps on indexing!

    Suddenly, time machine is very slow. Used to take up a minute and now more than half an hour. Does anybody know how this can happen? Indexing the back-up disk is off, but Timde Machine keeps on indexing!

    same issue here...

  • I have a problem with the keyboard on my MacBook. The letters are typing as symbols and the delete and return/enter buttons do not work. Does anybody know how to fix this?

    I have a problem with the keyboard on my MacBook. The letters are typing as symbols and the delete and return/enter buttons do not work. Does anybody know how to fix this?

    Hey skyshade13,
    Thanks for the question. The following article outlines how to restore a previous iTunes library should there be no content after updating. While the article does not speak specifically to your symptoms, attempting the steps by utilizing the "Previous iTunes Libraries" folder may resolve your issue.
    No content shows up in iTunes after updating
    http://support.apple.com/kb/TS1967
    For further information see the following information:
    OS X Lion: iTunes opens to "created by a newer version" alert
    http://support.apple.com/kb/TS3918
    iTunes: How to re-create your iTunes library and playlists
    http://support.apple.com/kb/HT1451
    Thanks,
    Matt M.

  • Hi, my trial version of Lightroom 5 has recently expired and I have now fully bought it. I have uploaded the CD onto my Mac, but when I open the Lightroom application again, it still says the trial has expired. Does anybody know how I can update it so I c

    Hi, my trial version of Lightroom 5 has recently expired and I have now fully bought it. I have uploaded the CD onto my Mac, but when I open the Lightroom application again, it still says the trial has expired. Does anybody know how I can update it so I can finally use it again? I really appreciate any help!! Thank you!

    Joanne please remove your current installation of Photoshop Lightroom using the uninstallers located in the Applications/Utilities/Adobe Installers.
    You will then want to download Adobe Photoshop Lightroom 5.7.1 from Adobe - Lightroom : For Macintosh.  The update contains the entire application.  Photoshop Lightroom can not be installed through the Adobe Creative Cloud Desktop application and still be licensed with a serial number.

  • I just updated the software on my Apple TV, and now the closed captioning is not working. Somebody had the same problem? Anybody knows how to fix it?

    I just updated the software on my Apple TV, and now the closed captioning is not working. Somebody had the same problem? Anybody knows how to fix it?

    I just updated the software on my Apple TV, and now the closed captioning is not working. Somebody had the same problem? Anybody knows how to fix it?

  • I got a serial number from Leica. After registered and downloaded LR from adobe, it said "the serial number is invalid". Anybody knows how this happens?

    I got a serial number from Leica. After registered and downloaded LR from adobe, it said “the serial number is invalid”. Anybody knows how this happens?
    thanks!

    Did you get a serial number for Lightroom, or a redemption code?
    Please read Find your serial number quickly

  • I just upgraded my iPad to ios6. Now my Epson iPrint crashes all the time. I called Epson and they had no answer...said to use AirPrint instead. But AirPrint stinks because you cannot change printer settings. Anybody know how to make iPrint work on ios6?

    Anybody know how to make Epson iPrint work on ios6? Epson told me to use AirPrint, which stinks because you cannot change printer settings.

    Epson needs an update to their app to support ios6. I'm sure they will in time.
    Try deleting it and re download it. If that doesn't work, it's what I said above. :(

Maybe you are looking for

  • My phone is not working after updating to OS 4.3

    Hi there. I'm running Windows 7 Ultimate 64-bit. I have the latest version of iTunes which I downloaded today before updating my phone. So I updated my iPhone 4 from 4.2.# OS to 4.3 OS as iTunes recommended me to. Everything was going fine, but as th

  • Display multiple parameters in report header

    i am attempting to display a multiple parameter selection in my report header i user join({?parameter},",") in the stored proc it is a varchar in the formula editor i receive this error a string array is required here what do i need to do to display

  • Pc won't recognize ipad

    My iPad is not recognized on any computer, when plugging it in using the USB cable.  I've tried several different cords, and PC's, with and without iTunes.  When I plug it in, nothing happens.  It will charge with the plug-in adapter, although, not t

  • Wl6.0 clustering error

              Hi,           I have two weblogic servers on different m/cs in a cluster.When the request is going           to one server it is showing the following error.What could be the reason?           weblogic.cluster.replication.NotFoundException:

  • Urgent Need for creating 100 tables in Oracle.

    Hello All, I need to create 100 tables in oracle using a loop. Please suggest . Advance thanks for your efforts. ANto