FileDocCategorySizeDatePackage
NameToken.javaAPI DocGlassfish v2 API3902Fri May 04 22:33:24 BST 2007com.sun.enterprise.tools.verifier

NameToken

public class NameToken extends Object

Fields Summary
static final String
XMLtop
static final String
XMLbottom
private static Logger
logger
Constructors Summary
Methods Summary
public static booleanisNMTOKEN(java.lang.String value)
Determine is value is legal NMToken type

param
value xml element to be checked
return
boolean true if xml element is legal NMToken, false otherwise


                                          
         
/*
        com.sun.enterprise.util.LocalStringManagerImpl smh =
            StringManagerHelper.getLocalStringsManager();
*/
        String XMLdoc = XMLtop + value + XMLbottom;
        logger.log(Level.FINE,
                "com.sun.enterprise.tools.verifier.NameToken.print", // NOI18N
                new Object[]{XMLdoc});

        try {
            InputSource source = new InputSource(
                    new ByteArrayInputStream(XMLdoc.getBytes()));
            SAXParserFactory spf = SAXParserFactory.newInstance();
            spf.setValidating(true);
            // ValidatingParser p = new ValidatingParser();
            XMLReader p = spf.newSAXParser().getXMLReader();
//            XMLErrorHandler eh = new XMLErrorHandler(null);
            p.setErrorHandler(new XMLValidationHandler());
            p.parse(source);
            return true;

        } catch (Exception e) {
            return false;
        }