Package org.apache.tapestry.util.xml

Examples of org.apache.tapestry.util.xml.DocumentParseException


        while (i.hasNext())
        {
            String name = (String) i.next();

            if (!epi.isKnown(name))
                throw new DocumentParseException(
                    ScriptMessages.unexpectedAttributeInElement(name, _elementName),
                    getLocation(),
                    null);
        }

        // Now check that all required attributes have been specified.

        i = epi.getRequiredNames();
        while (i.hasNext())
        {
            String name = (String) i.next();

            if (!_attributes.containsKey(name))
                throw new DocumentParseException(
                    ScriptMessages.missingRequiredAttribute(name, _elementName),
                    getLocation(),
                    null);
        }
View Full Code Here


        {
            value = Ognl.getValue(expression, _ognlContext, this);
        }
        catch (OgnlException ex)
        {
            throw new DocumentParseException("Expression '" + expression + "' is not valid.", ex);
        }

        if (value == null)
            return false;

        if (value instanceof Boolean)
            return ((Boolean) value).booleanValue();

        if (value instanceof Number)
            return ((Number) value).longValue() != 0;

        if (value instanceof String)
            return ((String) value).length() > 0;

        throw new DocumentParseException("Expression '" + expression + "' evaluates to ("
                + value.getClass().getName() + ") " + value
                + ", which cannot be interpreted as a boolean.");
    }
View Full Code Here

            String name = a.getAttributeValue("name");
            String pattern = a.getTextTrim();

            if (HiveMind.isBlank(pattern))
                throw new DocumentParseException("Pattern is null in " + a);

            if (outputString == null)
                outputString = _response.getOutputString();

            matchRegexp(name, outputString, pattern);
View Full Code Here

            String name = a.getAttributeValue("name");
            String substring = a.getTextTrim();

            if (HiveMind.isBlank(substring))
                throw new DocumentParseException("Substring is null in " + a);

            if (outputString == null)
                outputString = _response.getOutputString();

            matchSubstring(name, outputString, substring);
View Full Code Here

            String name = a.getAttributeValue("name");
            String substring = a.getTextTrim();

            if (HiveMind.isBlank(substring))
                throw new DocumentParseException("Substring is null in " + a);

            if (outputString == null)
                outputString = _response.getOutputString();

            matchNoSubstring(name, outputString, substring);
View Full Code Here

        int subgroup = (value == null) ? 0 : Integer.parseInt(value);

        String pattern = element.getTextTrim();

        if (HiveMind.isBlank(pattern))
            throw new DocumentParseException("Pattern is null in " + element);

        PatternMatcherInput input = new PatternMatcherInput(outputString);

        PatternMatcher matcher = getMatcher();
        Pattern compiled = compile(pattern);
View Full Code Here

    private void copyBindings(String sourceComponentId, IComponentSpecification cs,
            IContainedComponent target)
    {
        IContainedComponent source = cs.getComponent(sourceComponentId);
        if (source == null)
            throw new DocumentParseException(ParseMessages.unableToCopy(sourceComponentId),
                    getLocation(), null);

        Iterator i = source.getBindingNames().iterator();
        while (i.hasNext())
        {
View Full Code Here

        boolean hasCopyOf = HiveMind.isNonBlank(copyOf);

        if (hasCopyOf)
        {
            if (HiveMind.isNonBlank(type))
                throw new DocumentParseException(ParseMessages.bothTypeAndCopyOf(id),
                        getLocation(), null);
        }
        else
        {
            if (HiveMind.isBlank(type))
                throw new DocumentParseException(ParseMessages.missingTypeOrCopyOf(id),
                        getLocation(), null);
        }

        IContainedComponent cc = _factory.createContainedComponent();
        cc.setType(type);
View Full Code Here

    {
        String libraryId = getValidatedAttribute("id", LIBRARY_ID_PATTERN, "invalid-library-id");
        String path = getAttribute("specification-path");

        if (libraryId.equals(INamespace.FRAMEWORK_NAMESPACE))
            throw new DocumentParseException(ParseMessages
                    .frameworkLibraryIdIsReserved(INamespace.FRAMEWORK_NAMESPACE), getLocation(),
                    null);

        ILibrarySpecification ls = (ILibrarySpecification) peekObject();
View Full Code Here

    private void expectElement(String elementName)
    {
        if (_elementName.equals(elementName))
            return;

        throw new DocumentParseException(ParseMessages.incorrectDocumentType(
                _elementName,
                elementName), getLocation(), null);

    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.util.xml.DocumentParseException

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.