Package org.apache.xerces.utils

Examples of org.apache.xerces.utils.URI


     */
    public Object validate(String content, Object state)
    throws InvalidDatatypeValueException
    {
        StringTokenizer parsedList = null;
        URI             uriContent = null;

        if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
            if ( fRegex == null || fRegex.matches( content) == false )
                throw new InvalidDatatypeValueException("Value '"+content+
                                                        "' does not match regular expression facet" + fPattern );
        }

          
        try {
            if( content.trim().length() != 0 ) //Validate non null URI
                uriContent = new URI( content );
            //else it is valid anyway
        } catch URI.MalformedURIException ex ) {
            throw new InvalidDatatypeValueException("Value '"+content+
                                                                        "' is a Malformed URI ");

View Full Code Here


    protected void checkValueSpace (String content) throws InvalidDatatypeValueException {
       
        // check 3.2.17.c0 must: URI (rfc 2396/2723)
        try {
            URI uriContent = null;
            if( content.length() != 0 ) //Validate non null URI
                uriContent = new URI( content );
            //else it is valid anyway
        } catch URI.MalformedURIException ex ) {
            throw new InvalidDatatypeValueException("Value '"+content+"' is a Malformed URI ");
        }
    }
View Full Code Here

            return systemId;
        }

        // if id already expanded, return
        try {
            URI uri = new URI(id);
            if (uri != null) {
                return systemId;
            }
        }
        catch (URI.MalformedURIException e) {
            // continue on...
        }

        // normalize id
        id = fixURI(id);

        // normalize base
        URI base = null;
        URI uri = null;
        try {
            if (currentSystemId == null) {
                String dir;
                try {
                    dir = fixURI(System.getProperty("user.dir"));
                }
                catch (SecurityException se) {
                    dir = "";
                }
                if (!dir.endsWith("/")) {
                    dir = dir + "/";
                }
                base = new URI("file", "", dir, null, null);
            }
            else {
                base = new URI(currentSystemId);
            }

            // expand id
            uri = new URI(base, id);
        }
        catch (Exception e) {
            // let it go through
        }
        if (uri == null) {
            return systemId;
        }
        return uri.toString();
    }
View Full Code Here

            return systemId;
        }

        // if id already expanded, return
        try {
            URI uri = new URI(id);
            if (uri != null) {
                return systemId;
            }
        }
        catch (URI.MalformedURIException e) {
            // continue on...
        }

        // normalize id
        id = fixURI(id);

        // normalize base
        URI base = null;
        URI uri = null;
        try {
            if (currentSystemId == null) {
                String dir;
                try {
                    dir = fixURI(System.getProperty("user.dir"));
                }
                catch (SecurityException se) {
                    dir = "";
                }
                if (!dir.endsWith("/")) {
                    dir = dir + "/";
                }
                base = new URI("file", "", dir, null, null);
            }
            else {
                base = new URI(currentSystemId);
            }

            // expand id
            uri = new URI(base, id);
        }
        catch (Exception e) {
            // let it go through
        }
        if (uri == null) {
            return systemId;
        }
        return uri.toString();
    }
View Full Code Here

    protected void checkValueSpace (String content) throws InvalidDatatypeValueException {
       
        // check 3.2.17.c0 must: URI (rfc 2396/2723)
        try {
            if (fTempURI == null) {
                fTempURI = new URI("http://www.template.com");
            }
            if( content.length() != 0 ) {
                // Support for relative URLs
                // According to Java 1.1: URLs may also be specified with a
                // String and the URL object that it is related to.
                //
                new URI(fTempURI, content );
            }
        } catch URI.MalformedURIException ex ) {
                throw new InvalidDatatypeValueException("Value '"+content+"' is a Malformed URI ");
        }
    }
View Full Code Here

     */
    public Object validate(String content, Object state)
    throws InvalidDatatypeValueException
    {
        StringTokenizer parsedList = null;
        URI             uriContent = null;

        if ( fDerivedByList == true  ) { //derived by list


            parsedList = new StringTokenizer( content );
            try {
                while ( parsedList.hasMoreTokens() ) {
                    //checkContentList( parsedList.nextToken() ); TODO
                }
            } catch ( NoSuchElementException e ) {
                e.printStackTrace();
            }
        } else { //derived by constraint
            //
            if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
                if ( fRegex == null || fRegex.matches( content) == false )
                    throw new InvalidDatatypeValueException("Value '"+content+
                                                            "' does not match regular expression facet" + fPattern );
            }

          
            try {
                uriContent = new URI( content );
               
            } catch URI.MalformedURIException ex ) {
                throw new InvalidDatatypeValueException("Value '"+content+
                                                                           "' is a Malformed URI ");

View Full Code Here

            return systemId;
        }

        // if id already expanded, return
        try {
            URI uri = new URI(id);
            if (uri != null) {
                return systemId;
            }
        }
        catch (URI.MalformedURIException e) {
            // continue on...
        }

        // normalize id
        id = fixURI(id);

        // normalize base
        URI base = null;
        URI uri = null;
        try {
            if (currentSystemId == null) {
                String dir;
                try {
                    dir = fixURI(System.getProperty("user.dir"));
                }
                catch (SecurityException se) {
                    dir = "";
                }
                if (!dir.endsWith("/")) {
                    dir = dir + "/";
                }
                base = new URI("file", "", dir, null, null);
            }
            else {
                base = new URI(currentSystemId);
            }

            // expand id
            uri = new URI(base, id);
        }
        catch (Exception e) {
            // let it go through
        }
        if (uri == null) {
            return systemId;
        }
        return uri.toString();
    }
View Full Code Here

     */
    public Object validate(String content, Object state)
    throws InvalidDatatypeValueException
    {
        StringTokenizer parsedList = null;
        URI             uriContent = null;
        int length=content.length();
        if ( (fFacetsDefined & DatatypeValidator.FACET_PATTERN ) != 0 ) {
            if ( fRegex == null || fRegex.matches( content) == false )
                throw new InvalidDatatypeValueException("Value '"+content+
                                                        "' does not match regular expression facet" + fPattern );
        }
        if ( (fFacetsDefined & DatatypeValidator.FACET_MAXLENGTH) != 0 ) {
            if ( length > fMaxLength ) {
                throw new InvalidDatatypeValueException("Value '"+content+
                                                        "' with length '"+content.length()+
                                                        "' exceeds maximum length facet of '"+fMaxLength+"'.");
            }
        }
        if ( (fFacetsDefined & DatatypeValidator.FACET_MINLENGTH) != 0 ) {
            if ( length < fMinLength ) {
                throw new InvalidDatatypeValueException("Value '"+content+
                                                        "' with length '"+content.length()+
                                                        "' is less than minimum length facet of '"+fMinLength+"'." );
            }
        }

        if ( (fFacetsDefined & DatatypeValidator.FACET_LENGTH) != 0 ) {
            if ( length != fLength ) {
                throw new InvalidDatatypeValueException("Value '"+content+
                                                        "' with length '"+content.length()+
                                                        "' is not equal to length facet '"+fLength+"'.");
            }
        }
          
        try {
            if( length != 0 ) //Validate non null URI
                uriContent = new URI( content );
            //else it is valid anyway
        } catch URI.MalformedURIException ex ) {
            throw new InvalidDatatypeValueException("Value '"+content+
                                                                        "' is a Malformed URI ");

View Full Code Here

            return "";
        }

        // if id already expanded, return
        try {
            URI uri = new URI(id);
            if (uri != null) {
                return systemId;
            }
        }
        catch (URI.MalformedURIException e) {
            // continue on...
        }

        // normalize id
        id = fixURI(id);

        // normalize base
        URI base = null;
        URI uri = null;
        try {
            if (currentSystemId == null) {
                String dir;
                try {
                    dir = fixURI(System.getProperty("user.dir"));
                }
                catch (SecurityException se) {
                    dir = "";
                }
                if (!dir.endsWith("/")) {
                    dir = dir + "/";
                }
                base = new URI("file", "", dir, null, null);
            }
            else {
                base = new URI(currentSystemId);
            }

            // expand id
            uri = new URI(base, id);
        }
        catch (Exception e) {
            // let it go through
        }
        if (uri == null) {
            return systemId;
        }
        return uri.toString();
    }
View Full Code Here

TOP

Related Classes of org.apache.xerces.utils.URI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.