Search in sources :

Example 36 with Attributes

use of org.xml.sax.Attributes in project sling by apache.

the class Parser method parseAttributeDirective.

/*
     * Parses a attribute directive with the following syntax:
     * AttributeDirective ::= ( S Attribute)*
     */
private void parseAttributeDirective(Node parent) throws JasperException {
    Attributes attrs = parseAttributes();
    Node.AttributeDirective n = new Node.AttributeDirective(attrs, start, parent);
}
Also used : Attributes(org.xml.sax.Attributes)

Example 37 with Attributes

use of org.xml.sax.Attributes in project sling by apache.

the class Parser method parseSetProperty.

/*
     * For SetProperty: StdActionContent ::= Attributes EmptyBody
     */
private void parseSetProperty(Node parent) throws JasperException {
    Attributes attrs = parseAttributes();
    reader.skipSpaces();
    Node setPropertyNode = new Node.SetProperty(attrs, start, parent);
    parseOptionalBody(setPropertyNode, "jsp:setProperty", TagInfo.BODY_CONTENT_EMPTY);
}
Also used : Attributes(org.xml.sax.Attributes)

Example 38 with Attributes

use of org.xml.sax.Attributes in project sling by apache.

the class Parser method parseTaglibDirective.

/*
     * Parses a taglib directive with the following syntax: Directive ::= ( S
     * Attribute)*
     */
private void parseTaglibDirective(Node parent) throws JasperException {
    Attributes attrs = parseAttributes();
    String uri = attrs.getValue("uri");
    String prefix = attrs.getValue("prefix");
    if (prefix != null) {
        Mark prevMark = pageInfo.getNonCustomTagPrefix(prefix);
        if (prevMark != null) {
            err.jspError(reader.mark(), "jsp.error.prefix.use_before_dcl", prefix, prevMark.getFile(), "" + prevMark.getLineNumber());
        }
        if (uri != null) {
            String uriPrev = pageInfo.getURI(prefix);
            if (uriPrev != null && !uriPrev.equals(uri)) {
                err.jspError(reader.mark(), "jsp.error.prefix.refined", prefix, uri, uriPrev);
            }
            if (pageInfo.getTaglib(uri) == null) {
                TagLibraryInfoImpl impl = null;
                String[] location = ctxt.getTldLocation(uri);
                impl = new TagLibraryInfoImpl(ctxt, parserController, pageInfo, prefix, uri, location, err);
                pageInfo.addTaglib(uri, impl);
            }
            pageInfo.addPrefixMapping(prefix, uri);
        } else {
            String tagdir = attrs.getValue("tagdir");
            if (tagdir != null) {
                String urnTagdir = URN_JSPTAGDIR + tagdir;
                if (pageInfo.getTaglib(urnTagdir) == null) {
                    pageInfo.addTaglib(urnTagdir, new ImplicitTagLibraryInfo(ctxt, parserController, pageInfo, prefix, tagdir, err));
                }
                pageInfo.addPrefixMapping(prefix, urnTagdir);
            }
        }
    }
    new Node.TaglibDirective(attrs, start, parent);
}
Also used : Attributes(org.xml.sax.Attributes)

Example 39 with Attributes

use of org.xml.sax.Attributes in project sling by apache.

the class Parser method parseIncludeDirective.

/*
     * Parses an include directive with the following syntax: IncludeDirective
     * ::= ( S Attribute)*
     */
private void parseIncludeDirective(Node parent) throws JasperException {
    Attributes attrs = parseAttributes();
    // Included file expanded here
    Node includeNode = new Node.IncludeDirective(attrs, start, parent);
    processIncludeDirective(attrs.getValue("file"), includeNode);
}
Also used : Attributes(org.xml.sax.Attributes)

Example 40 with Attributes

use of org.xml.sax.Attributes in project sling by apache.

the class Parser method parseDoBody.

private void parseDoBody(Node parent) throws JasperException {
    Attributes attrs = parseAttributes();
    reader.skipSpaces();
    Node doBodyNode = new Node.DoBodyAction(attrs, start, parent);
    parseEmptyBody(doBodyNode, "jsp:doBody");
}
Also used : Attributes(org.xml.sax.Attributes)

Aggregations

Attributes (org.xml.sax.Attributes)274 DefaultHandler (org.xml.sax.helpers.DefaultHandler)70 SAXException (org.xml.sax.SAXException)66 Test (org.junit.Test)59 AttributesImpl (org.xml.sax.helpers.AttributesImpl)50 SAXParser (javax.xml.parsers.SAXParser)48 POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)37 InputSource (org.xml.sax.InputSource)31 SAXParserFactory (javax.xml.parsers.SAXParserFactory)30 IOException (java.io.IOException)29 File (java.io.File)22 ByteArrayInputStream (java.io.ByteArrayInputStream)19 ArrayList (java.util.ArrayList)17 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)17 InputStream (java.io.InputStream)16 ContentHandler (org.xml.sax.ContentHandler)15 XMLReader (org.xml.sax.XMLReader)15 StringReader (java.io.StringReader)10 Transformer (org.apache.sling.rewriter.Transformer)10 MockBundle (org.apache.sling.commons.testing.osgi.MockBundle)9