FileDocCategorySizeDatePackage
QNameDV.javaAPI DocJava SE 6 API4213Tue Jun 10 00:22:42 BST 2008com.sun.org.apache.xerces.internal.impl.dv.xs

QNameDV

public class QNameDV extends TypeValidator
Represent the schema type "QName" and "NOTATION"
xerces.internal
author
Neeraj Bajaj, Sun Microsystems, inc.
author
Sandy Gao, IBM
version
$Id: QNameDV.java,v 1.2.6.1 2005/09/06 11:43:08 neerajbj Exp $

Fields Summary
private static final String
EMPTY_STRING
Constructors Summary
Methods Summary
public java.lang.ObjectgetActualValue(java.lang.String content, com.sun.org.apache.xerces.internal.impl.dv.ValidationContext context)


        // "prefix:localpart" or "localpart"
        // get prefix and local part out of content
        String prefix, localpart;
        int colonptr = content.indexOf(":");
        if (colonptr > 0) {
            prefix = context.getSymbol(content.substring(0,colonptr));
            localpart = content.substring(colonptr+1);
        } else {
            prefix = EMPTY_STRING;
            localpart = content;
        }

        // both prefix (if any) a nd localpart must be valid NCName
        if (prefix.length() > 0 && !XMLChar.isValidNCName(prefix))
            throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "QName"});

        if(!XMLChar.isValidNCName(localpart))
            throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "QName"});

        // resove prefix to a uri, report an error if failed
        String uri = context.getURI(prefix);
        if (prefix.length() > 0 && uri == null)
            throw new InvalidDatatypeValueException("UndeclaredPrefix", new Object[]{content, prefix});

        return new XQName(prefix, context.getSymbol(localpart), context.getSymbol(content), uri);

    
public shortgetAllowedFacets()


       
        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE);
    
public intgetDataLength(java.lang.Object value)

        return ((XQName)value).rawname.length();