Package org.xml.sax

Examples of org.xml.sax.Attributes


        in.addAttribute(null, "class", null, "CDATA", "something nostatic");
        transformer.startElement(null, "link", null, in);

        verify(handler, only()).startElement(isNull(String.class), eq("link"), isNull(String.class),
                attributesCaptor.capture());
        Attributes out = attributesCaptor.getValue();
        assertEquals("/etc/clientlib/test.css", out.getValue(0));
    }
View Full Code Here


        in.addAttribute(null, "href", null, "CDATA", "/content/clientlib/test.css");
        transformer.startElement(null, "link", null, in);

        verify(handler, only()).startElement(isNull(String.class), eq("link"), isNull(String.class),
                attributesCaptor.capture());
        Attributes out = attributesCaptor.getValue();
        assertEquals("/content/clientlib/test.css", out.getValue(0));
    }
View Full Code Here

        in.addAttribute(null, "href", null, "CDATA", "/etc/clientlib/testA.css");
        transformer.startElement(null, "link", null, in);

        verify(handler, only()).startElement(isNull(String.class), eq("link"), isNull(String.class),
                attributesCaptor.capture());
        Attributes out = attributesCaptor.getValue();
        assertEquals("//static2.host.com/etc/clientlib/testA.css", out.getValue(0));
    }
View Full Code Here

        in.addAttribute(null, "src", null, "CDATA", "/etc/clientlib/testABC.css");
        transformer.startElement(null, "link", null, in);

        verify(handler, only()).startElement(isNull(String.class), eq("link"), isNull(String.class),
                attributesCaptor.capture());
        Attributes out = attributesCaptor.getValue();
        assertEquals("/etc/clientlib/testABC.css", out.getValue(0));
    }
View Full Code Here

        in.addAttribute(null, "src", null, "CDATA", "/etc/clientlib/testABC.css");
        transformer.startElement(null, "iframe", null, in);

        verify(handler, only()).startElement(isNull(String.class), eq("iframe"), isNull(String.class),
                attributesCaptor.capture());
        Attributes out = attributesCaptor.getValue();
        assertEquals("/etc/clientlib/testABC.css", out.getValue(0));
    }
View Full Code Here

    @Mock
    private Locator locator;
   
    @Test
    public void test_adapted_methods() throws Exception {
        final Attributes attrs = new AttributesImpl();
        final char[] characters = new char[0];
        final char[] whitespace = new char[0];
       
        DefaultHandler adapter = new ContentHandlerAdapter(handler);
        adapter.setDocumentLocator(locator);
View Full Code Here

   *      java.lang.String)
   */
  @Override
  public void end(String namespace, String name) {
    // Get the element attributes and body text
    Attributes attributes = (Attributes) digester.pop(ATTRIBUTES_STACK);
    String bodyText = (String) digester.pop(BODY_TEXT_STACK);

    // Call all of the CallParamRule methods
    try {
      super.begin(attributes);
View Full Code Here

        public void visit(Node.UninterpretedTag n) throws JasperException {
            if (n.getNamedAttributeNodes().size() != 0) {
                err.jspError(n, "jsp.error.namedAttribute.invalidUse");
            }

            Attributes attrs = n.getAttributes();
            if (attrs != null) {
                int attrSize = attrs.getLength();
                Node.JspAttribute[] jspAttrs = new Node.JspAttribute[attrSize];
                for (int i = 0; i < attrSize; i++) {
                    jspAttrs[i] = getJspAttribute(null, attrs.getQName(i),
                            attrs.getURI(i), attrs.getLocalName(i), attrs
                                    .getValue(i), java.lang.Object.class, n,
                            false);
                }
                n.setJspAttributes(jspAttrs);
            }
View Full Code Here

             * that the same attribute is not specified in both attributes or
             * named attributes.
             */
            TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
            String customActionUri = n.getURI();
            Attributes attrs = n.getAttributes();
            int attrsSize = (attrs == null) ? 0 : attrs.getLength();
            for (int i = 0; i < tldAttrs.length; i++) {
                String attr = null;
                if (attrs != null) {
                    attr = attrs.getValue(tldAttrs[i].getName());
                    if (attr == null) {
                        attr = attrs.getValue(customActionUri, tldAttrs[i]
                                .getName());
                    }
                }
                Node.NamedAttribute na = n.getNamedAttributeNode(tldAttrs[i]
                        .getName());
View Full Code Here

            visitBody(n);
        }

        public void visit(Node.JspElement n) throws JasperException {

            Attributes attrs = n.getAttributes();
            if (attrs == null) {
                err.jspError(n, "jsp.error.jspelement.missing.name");
            }
            int xmlAttrLen = attrs.getLength();

            Node.Nodes namedAttrs = n.getNamedAttributeNodes();

            // XML-style 'name' attribute, which is mandatory, must not be
            // included in JspAttribute array
            int jspAttrSize = xmlAttrLen - 1 + namedAttrs.size();

            Node.JspAttribute[] jspAttrs = new Node.JspAttribute[jspAttrSize];
            int jspAttrIndex = 0;

            // Process XML-style attributes
            for (int i = 0; i < xmlAttrLen; i++) {
                if ("name".equals(attrs.getLocalName(i))) {
                    n.setNameAttribute(getJspAttribute(null, attrs.getQName(i),
                            attrs.getURI(i), attrs.getLocalName(i), attrs
                                    .getValue(i), java.lang.String.class, n,
                            false));
                } else {
                    if (jspAttrIndex < jspAttrSize) {
                        jspAttrs[jspAttrIndex++] = getJspAttribute(null, attrs
                                .getQName(i), attrs.getURI(i), attrs
                                .getLocalName(i), attrs.getValue(i),
                                java.lang.Object.class, n, false);
                    }
                }
            }
            if (n.getNameAttribute() == null) {
View Full Code Here

TOP

Related Classes of org.xml.sax.Attributes

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.