Package org.apache.cocoon.xml

Examples of org.apache.cocoon.xml.AttributesImpl


                while ( enumeration.hasMoreElements() ) {
                    final String pName = (String)enumeration.nextElement();
                    final String[] pValues = pars.getParameterValues(pName);
                    for(int k=0; k<pValues.length; k++) {
                        final String pValue = pValues[k];
                        AttributesImpl hiddenAttrs = new AttributesImpl();
                        hiddenAttrs.addCDATAAttribute("type", "hidden");
                        hiddenAttrs.addCDATAAttribute("name", pName);
                        hiddenAttrs.addCDATAAttribute("value", pValue);
                        this.startElement("", "input", "input", hiddenAttrs);
                        this.endElement("", "input", "input");
                    }
                }
View Full Code Here


        }
    }

    protected void createAnchorEvent(Attributes attributes)
    throws SAXException {
        AttributesImpl newAttributes = new AttributesImpl(attributes);
        newAttributes.removeAttribute("href");
        newAttributes.removeAttribute("external");
        String link = attributes.getValue("href");

        CopletInstanceData cid = this.getCopletInstanceData();
        link = this.getLink((String)cid.getTemporaryAttribute(this.attributeName), link);

        newAttributes.addCDATAAttribute("path", this.jxPath);
        newAttributes.addCDATAAttribute("value", link);
        newAttributes.addCDATAAttribute("coplet", cid.getId());
        newAttributes.addCDATAAttribute("format", "html-link");
        this.xmlConsumer.startPrefixMapping("coplet", CopletTransformer.NAMESPACE_URI);
        this.xmlConsumer.startElement(CopletTransformer.NAMESPACE_URI,
                                      CopletTransformer.LINK_ELEM,
                                      "coplet:" + CopletTransformer.LINK_ELEM,
                                      newAttributes);
View Full Code Here

                                      newAttributes);
    }

    protected void createFormEvent(Attributes attributes)
    throws SAXException {
        AttributesImpl newAttributes = new AttributesImpl(attributes);
        newAttributes.removeAttribute("action");
        String link = attributes.getValue("action");

        CopletInstanceData cid = this.getCopletInstanceData();
        link = this.getLink((String)cid.getTemporaryAttribute(this.attributeName), link);

        newAttributes.addCDATAAttribute("path", this.jxPath);
        newAttributes.addCDATAAttribute("value", link);
        newAttributes.addCDATAAttribute("coplet", cid.getId());
        newAttributes.addCDATAAttribute("format", "html-form");
        if ( newAttributes.getIndex("method") == -1 ) {
            newAttributes.addCDATAAttribute("method", "POST");
        }

        this.xmlConsumer.startPrefixMapping("coplet", CopletTransformer.NAMESPACE_URI);
        this.xmlConsumer.startElement(CopletTransformer.NAMESPACE_URI,
                CopletTransformer.LINK_ELEM,
View Full Code Here

    public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
        String pattern = getDateFormat(locale).toPattern();

        if (pattern != null) {
            AttributesImpl attrs = new AttributesImpl();
            attrs.addCDATAAttribute("pattern", pattern);
            attrs.addCDATAAttribute("variant", this.variant);
            contentHandler.startElement(Constants.INSTANCE_NS, CONVERTOR_EL, Constants.INSTANCE_PREFIX_COLON + CONVERTOR_EL, attrs);
            contentHandler.endElement(Constants.INSTANCE_NS, CONVERTOR_EL, Constants.INSTANCE_PREFIX_COLON + CONVERTOR_EL);
        }
    }
View Full Code Here

    }

    private static final String DATATYPE_EL = "datatype";

    public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
        AttributesImpl attrs = new AttributesImpl();
        attrs.addCDATAAttribute("type", getDescriptiveName());
        contentHandler.startElement(Constants.INSTANCE_NS, DATATYPE_EL, Constants.INSTANCE_PREFIX_COLON + DATATYPE_EL, attrs);
        getConvertor().generateSaxFragment(contentHandler, locale);
        contentHandler.endElement(Constants.INSTANCE_NS, DATATYPE_EL, Constants.INSTANCE_PREFIX_COLON + DATATYPE_EL);
    }
View Full Code Here

       
        final PreparedConfiguration config = (PreparedConfiguration)context.getAspectConfiguration();

        Map parameter = layout.getParameters();
        if (parameter.size() > 0) {
            AttributesImpl attributes = new AttributesImpl();
            Map.Entry entry;
            for (Iterator iter = parameter.entrySet().iterator(); iter.hasNext();) {
                entry = (Map.Entry) iter.next();
                attributes.addCDATAAttribute((String)entry.getKey(), (String)entry.getValue());
            }
            XMLUtils.startElement(contenthandler, config.tagName, attributes);
        } else {
            XMLUtils.startElement(contenthandler, config.tagName);
        }
View Full Code Here

            final String value = res.toString();
           
            // stream out the include for the serializer
            IncludingHTMLSerializer.addPortlet(portlet, value);
            contentHandler.startPrefixMapping("portal", IncludingHTMLSerializer.NAMESPACE);
            AttributesImpl attr = new AttributesImpl();
            attr.addCDATAAttribute("portlet", portlet);
            contentHandler.startElement(IncludingHTMLSerializer.NAMESPACE,
                                        "include", "portal:include", attr);
            contentHandler.endElement(IncludingHTMLSerializer.NAMESPACE,
                                      "include", "portal:include");
            contentHandler.endPrefixMapping("portal");
View Full Code Here

     * @param handler SAX event handler
     */
    protected void createCInclude(String source, ContentHandler handler)
    throws SAXException {
        handler.startPrefixMapping(PREFIX, NAMESPACE);
        AttributesImpl attributes = new AttributesImpl();
        attributes.addCDATAAttribute("src", source);
        handler.startElement(NAMESPACE, ELEMENT, QELEMENT, attributes);
        handler.endElement(NAMESPACE, ELEMENT, QELEMENT);
        handler.endPrefixMapping(PREFIX);
    }
View Full Code Here

  /* (non-Javadoc)
   * @see org.xml.sax.ContentHandler#startDocument()
   */
  public void startDocument() throws SAXException {
    super.startDocument();
    AttributesImpl a = new AttributesImpl();
   
    // took the div-tag as root, because it does not matter in the output, if it passes the xsl transformation
    super.startPrefixMapping("i18n", "http://apache.org/cocoon/i18n/2.1");
    super.startElement("", "div","div", a);
    super.startElement("", "tab-layout", "tab-layout", a);
      Collection tools = pm.getToolsWithFunctions();
      for(Iterator it = tools.iterator(); it.hasNext();) {
        AttributesImpl attr = new AttributesImpl();
        PortalTool pt = (PortalTool) it.next();
        attr.addCDATAAttribute("parameter", "tools/functions/" + pt.getId());
        attr.addCDATAAttribute("name", pt.getName());
        attr.addCDATAAttribute("http://apache.org/cocoon/i18n/2.1", "attr", "i18n:attr", "name");
        if(selected != null) {
            if(selected.equals(pt.getId())) {
                attr.addCDATAAttribute("selected", "true");
            }
        }
        super.startElement("","named-item", "named-item", attr);
        super.endElement("", "named-item", "named-item");
      }
    super.endElement("", "tab-layout", "tab-layout");
    if(selected != null) {
      PortalTool ct = pm.getTool(selected);
      if(ct != null) {
        super.startElement("", "tool-functions", "tool-functions", a);
        Collection funs = ct.getFunctions();
        for(Iterator it = funs.iterator();it.hasNext();) {
            PortalToolFunction ptf = (PortalToolFunction) it.next();
            AttributesImpl attr = new AttributesImpl();
            attr.addCDATAAttribute("parameter", "tools/plugins/" + ct.getId() + "/" + ptf.getFunction());
            attr.addCDATAAttribute("name", ptf.getName());
            attr.addCDATAAttribute("http://apache.org/cocoon/i18n/2.1", "attr", "i18n:attr", "name");            super.startElement("", "function", "function", attr);
            super.endElement("", "function", "function");
        }
        super.endElement("", "tool-functions", "tool-functions");
      }
      }
View Full Code Here

    throws ProcessingException, IOException, SAXException {
        if ( UPLOAD_ITEM_ELEMENT.equals(name) ) {
            this.uploadElements.add(attr.getValue("name"));
            this.startElement("", "input", "input", attr);
        } else if ( UPLOAD_FORM_ELEMENT.equals(name) ) {
            AttributesImpl ai = new AttributesImpl(attr);
            PortalService service = null;
            String parameters;
            try {
                service = (PortalService)this.manager.lookup(PortalService.ROLE);
                Event e = new UploadItemEvent(this.basketManager.getFolder(), this.uploadElements);
                parameters = service.getComponentManager().getLinkService().getLinkURI(e);
                int pos = parameters.indexOf('?');
                ai.addCDATAAttribute("action", parameters.substring(0, pos));
                parameters = parameters.substring(pos+1);
            } catch (ServiceException se) {
                throw new SAXException("Unable to lookup portal service.", se);
            } finally {
                this.manager.release(service);
            }
            this.startElement("", "form", "form", ai);
            if ( parameters != null && parameters.length() > 0 ) {
                // create hidden input fields
                RequestParameters pars = new RequestParameters(parameters);
                Enumeration enumPars = pars.getParameterNames();
                while ( enumPars.hasMoreElements() ) {
                    String pName = (String)enumPars.nextElement();
                    String pValue = pars.getParameter(pName);
                    AttributesImpl hiddenAttrs = new AttributesImpl();
                    hiddenAttrs.addCDATAAttribute("type", "hidden");
                    hiddenAttrs.addCDATAAttribute("name", pName);
                    hiddenAttrs.addCDATAAttribute("value", pValue);
                    this.startElement("", "input", "input", hiddenAttrs);
                    this.endElement("", "input", "input");
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.xml.AttributesImpl

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.