Package org.apache.tapestry.util.xml

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


        boolean asAttribute = HiveMind.isNonBlank(attributeValue);
        boolean asContent = HiveMind.isNonBlank(contentValue);

        if (asAttribute && asContent)
        {
            throw new DocumentParseException(ParseMessages.noAttributeAndBody(
                    attributeName,
                    _elementName), getLocation(), null);
        }

        if (required && !(asAttribute || asContent))
        {
            throw new DocumentParseException(ParseMessages.requiredExtendedAttribute(
                    _elementName,
                    attributeName), getLocation(), null);
        }

        if (asAttribute)
View Full Code Here


                _parser = _parserFactory.newSAXParser();

            URL resourceURL = resource.getResourceURL();

            if (resourceURL == null)
                throw new DocumentParseException(ParseMessages.missingResource(resource), resource);

            InputStream rawStream = resourceURL.openStream();
            stream = new BufferedInputStream(rawStream);

            _parser.parse(stream, this, resourceURL.toExternalForm());

            stream.close();
            stream = null;

            success = true;
        }
        catch (Exception ex)
        {
            _parser = null;

            throw new DocumentParseException(ParseMessages.errorReadingResource(resource, ex),
                    resource, ex);
        }
        finally
        {
            if (!success)
View Full Code Here

        }

        if (TAPESTRY_DTD_3_0_PUBLIC_ID.equals(publicId))
            return getDTDInputSource("Tapestry_3_0.dtd");

        throw new DocumentParseException(ParseMessages.unknownPublicId(getResource(), publicId),
                getResource());
    }
View Full Code Here

        {
            if (_publicIds[i].equals(publicId))
            {

                if (!name.equals(_rootElement))
                    throw new DocumentParseException(
                        Tapestry.format(
                            "AbstractDocumentParser.incorrect-document-type",
                            _rootElement,
                            name),
                        location);

                return;
            }

        }

        throw new DocumentParseException(
            Tapestry.format("AbstractDocumentParser.unknown-public-id", location, publicId),
            location);
    }
View Full Code Here

        if (StringUtils.isEmpty(text))
            return;

        if (_valueSet)
        {
            throw new DocumentParseException(
                Tapestry.format(
                    "SpecificationParser.no-attribute-and-body",
                    _attributeName,
                    name),
                getResourceLocation());
View Full Code Here

    }

    public void end(String namespace, String name) throws Exception
    {
        if (!_valueSet && _required)
            throw new DocumentParseException(
                Tapestry.format(
                    "SpecificationParser.required-extended-attribute",
                    name,
                    _attributeName),
                getResourceLocation());
View Full Code Here

        String type = getValue(attributes, "type");

        if (StringUtils.isEmpty(copyOf))
        {
            if (StringUtils.isEmpty(type))
                throw new DocumentParseException(
                    Tapestry.format("SpecificationParser.missing-type-or-copy-of", id),
                    getResourceLocation());

            return;
        }

        if (!StringUtils.isEmpty(type))
            throw new DocumentParseException(
                Tapestry.format("SpecificationParser.both-type-and-copy-of", id),
                getResourceLocation());

        IComponentSpecification spec = (IComponentSpecification) digester.getRoot();

        IContainedComponent source = spec.getComponent(copyOf);
        if (source == null)
            throw new DocumentParseException(
                Tapestry.format("SpecificationParser.unable-to-copy", copyOf),
                getResourceLocation());

        IContainedComponent target = (IContainedComponent) digester.peek();
View Full Code Here

    public void begin(String namespace, String name, Attributes attributes) throws Exception
    {
        String id = getValue(attributes, "id");

        if (id.equals(INamespace.FRAMEWORK_NAMESPACE))
            throw new DocumentParseException(
                Tapestry.format(
                    "SpecificationParser.framework-library-id-is-reserved",
                    INamespace.FRAMEWORK_NAMESPACE),
                getResourceLocation());
    }
View Full Code Here

        if (StringUtils.isEmpty(text))
            return;

        if (_value != null)
        {
            throw new DocumentParseException(
                Tapestry.format("SpecificationParser.no-attribute-and-body", "value", name),
                getResourceLocation());
        }

        _value = text.trim();
View Full Code Here

    }

    public void end(String namespace, String name) throws Exception
    {
        if (_value == null)
            throw new DocumentParseException(
                Tapestry.format("SpecificationParser.required-extended-attribute", name, "value"),
                getResourceLocation());

        IPropertyHolder holder = (IPropertyHolder) digester.peek();
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.