You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Garth Martinsen <Ga...@Freightliner.com> on 2001/05/31 20:07:16 UTC

Can't find resource for ...regex.message _en_US

I get the subject error when I turn on validation with a SAXParser.
I did not get a response from anybody official, however, one other user
complained of
not finding the message_fr module. I am resubmitting these questions. Would
someone please respond?

> Questions:
> 1. How do I use cygwin to make the xerces tree without the 87 errors I am
getting?
> 2. Is my problem due to not installing with the makefile?
> 3. Am I missing some declaration in my *.xml or *.dtd file?
> 4. If I really need "message_en_US", why is it not in the distribution?
> Where can I get it?
> 5. Can the Java SAXParser validate an XML document based on DTD? If not
> when will that be supported?
> 6. If so, it appears that all I have to do is implement the DeclHandler
> Interface in my XXTemplate  class , correct?
> 

> I get the subject error when I turn on validation with a SAXParser. I have
> looked in the zip file and the resulting 
> directory structure for the missing file. It is not there. I downloaded
> Xerces-J-src.1.4.0.zip and Xerces-J-tools.1.4.0.zip.
> I unzipped the two zip files. I followed the instructions for building
> docs and src on a Windows platform, including downloading and installing
> cygwin. I doubleClicked the cygwin icon, which briefly opened a cmd window
> then closed it. No visible changes were seen.
>   I logged into cygwin, and at the top of the tree, I typed "make docs
apidocs and
> got 87 errors" . Then I typed 
> "make jars " and got 87 errors. I checked my environment variable
> "CLASSPATH". "Environment variable CLASSPATH not defined".
> I am using Borland JBuilder3, so I moved the directory structure to reside
> under my ..\Java\Source directory which is my Source root in JBuilder3.
> Below, I have attached the parsed file (well formed and valid iaw XMLSpy
> before I changed names) and the dtd file on which it is based. I changed
> some names to protect company information. (eg Help is not the right file
> name and JunkSrvr is not the server name.):
>  <<Help052301.xml>>  <<Help.dtd>> 
> ============================================= 
> The stack dump follows:
> org.apache.xerces.validators.datatype.InvalidDatatypeFacetException:
> Installation Problem???  
> Couldn't load messages: can't find resource for
> org.apache.xerces.utils.regex.message_en_US   at
> org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl.
> createDatatypeValidator(DatatypeValidatorFactoryImpl.java:449)
>         at
> org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl.
> 	
> createDatatypeValidator(DatatypeValidatorFactoryImpl.java:403)
>         at
> org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl.
> 		initializeDTDRegistry(DatatypeValidatorFactoryImpl.java:146)
>         at
> org.apache.xerces.validators.common.XMLValidator.initDataTypeValidators(XM
> LValidator.java:1949)
>         at
> org.apache.xerces.validators.common.XMLValidator.setValidationEnabled(XMLV
> alidator.java:511)
>         at
> org.apache.xerces.framework.XMLParser.setValidation(XMLParser.java:393)
>         at
> org.apache.xerces.framework.XMLParser.setFeature(XMLParser.java:1144)
>         at
> org.apache.xerces.parsers.SAXParser.setFeature(SAXParser.java:578)
> 
> which is called from my code.
>       m_saxParser.setFeature( "http://xml.org/sax/features/validation",
> true);
> ===================================================================
> more of my code:
> public class XXTemplate  extends DefaultHandler implements DeclHandler
> {
> ...
>   private SAXParser   m_saxParser          = new SAXParser();
>   public XXTemplate()
>   {
> 
>   }
>   public XXTemplate(String apiName, String apiVersion)
>   {
>     m_sApiName     = apiName;
>     m_sApiVersion  = apiVersion;
>     DTDReader   handler = new DTDReader();
>   try
>     {
>       String fileName = (new File(m_sInputFilePath + m_sApiName
> )).toString();
>       // when parsing is complete the root object, w/hierarchy will be in
> place.
>       FileReader fr  =  new FileReader(fileName);
>       m_saxParser.setContentHandler(this);
>       m_saxParser.setErrorHandler(this);
>       try
>       {
>       m_saxParser.setFeature( "http://xml.org/sax/features/validation",
> true);
>       m_saxParser.setProperty(
> "http://xml.org/sax/properties/declaration-handler", handler );
> 
>       }
>       catch(SAXNotSupportedException snse)
>       {
>          snse.printStackTrace();
>          out.println(snse.getMessage()  );
>       }
>       catch(SAXNotRecognizedException snre)
>       {
>          snre.printStackTrace();
>          out.println(snre.getMessage());
>       }
>       long start = System.currentTimeMillis();
>       m_saxParser.parse(new InputSource(fr));
>       long end =System.currentTimeMillis();
>       long millis = (end - start);
>       out.println("milliSeconds to parse: " + millis);
>     }
>     catch(FileNotFoundException fe)
>     {
>      fe.printStackTrace();
>      out.println(fe.getMessage());
>     }
>     catch(SAXException se)
>     {
>       se.printStackTrace();
>       out.println(se.getMessage());
>     }
>      catch(IOException ioe)
>     {
>       ioe.printStackTrace();
>       out.println(ioe.getMessage());
>     }
>   }
> ...
> }


Re: Can't find resource for ...regex.message _en_US

Posted by Mary Ryan <mr...@stsci.edu>.
Garth Martinsen wrote that he was getting this error:
> > The stack dump follows:
> > org.apache.xerces.validators.datatype.InvalidDatatypeFacetException:
> > Installation Problem???
> > Couldn't load messages: can't find resource for
> > org.apache.xerces.utils.regex.message_en_US   at
> > org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl.
> > createDatatypeValidator(DatatypeValidatorFactoryImpl.java:449)


The directory xerces-1_4_0\src\org\apache\xerces\utils\regex contains
message.properties
message_fr.properties
message_ja.properties

One of the java files it contains is RegexParser.java, and this is where
your error message is coming from:

   public RegexParser() {
        this.setLocale(Locale.getDefault());
    }
    public RegexParser(Locale locale) {
        this.setLocale(locale);
    }

    public void setLocale(Locale locale) {
        try {
            this.resources =
ResourceBundle.getBundle("org.apache.xerces.utils.regex.message",
locale);
        } catch (MissingResourceException mre) {
            throw new RuntimeException("Installation Problem??? 
Couldn't load messages: "
                                       +mre.getMessage());
        }
    }

-----------------------------------------------------------------------------------
So your problem has something to do with your Locale.  Java classes
Locale and ResourceBundle are in java.util.*.  To see what my default
Locale is, I wrote a small program with these lines of code:

        Locale myLocale = Locale.getDefault();
        System.out.println(myLocale.toString());
        ResourceBundle resources;
       try {
            resources =
ResourceBundle.getBundle("org.apache.xerces.utils.regex.message",                              
myLocale);
        } catch (MissingResourceException mre) {
            System.out.println("Installation Problem???  Couldn't load
messages: "
                                       +mre.getMessage());
        }
        System.out.println("Got resource bundle");
-------------------------------------------------------------------------------------
The output was:

en_US
Got resource bundle

I am guessing that since my default locale is en_US, and it's not
complaining that it can't find message_en_US, that it must be picking up
the message.properties file. You could try setting your locale to (en,
US) or perhaps copy the messages.properties file to
messages_en_US.properties.

I cannot help with your other problems, I am not using cygwin to build. 
Can't you just use the xerces.jar file that came with xerces 1.4.0?
Good luck.  
Mary Ryan

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org