Examples of AttributesImpl


Examples of com.dotcms.repackage.org.xml.sax.helpers.AttributesImpl

                }

                // no else because a removed part can just be closed and a new
                // part can start
                if (!newStarted && mod.getType() == ModificationType.ADDED) {
                    AttributesImpl attrs = new AttributesImpl();
                    attrs.addAttribute("", "class", "class", "CDATA",
                            "diff-html-added");
                    if (mod.isFirstOfID()) {
                        attrs.addAttribute("", "id", "id", "CDATA", mod
                                .getType()
                                + "-" + prefix + "-" + mod.getID());
                    }

                    addAttributes(mod, attrs);

                    handler.startElement("", "span", "span", attrs);
                    newStarted = true;
                } else if (!changeStarted
                        && mod.getType() == ModificationType.CHANGED) {
                    AttributesImpl attrs = new AttributesImpl();
                    attrs.addAttribute("", "class", "class", "CDATA",
                            "diff-html-changed");
                    if (mod.isFirstOfID()) {
                        attrs.addAttribute("", "id", "id", "CDATA", mod
                                .getType()
                                + "-" + prefix + "-" + mod.getID());
                    }

                    addAttributes(mod, attrs);
                    handler.startElement("", "span", "span", attrs);

                    changeStarted = true;
                    changeTXT = mod.getChanges();
                } else if (!remStarted
                        && mod.getType() == ModificationType.REMOVED) {
                    AttributesImpl attrs = new AttributesImpl();
                    attrs.addAttribute("", "class", "class", "CDATA",
                            "diff-html-removed");
                    if (mod.isFirstOfID()) {
                        attrs.addAttribute("", "id", "id", "CDATA", mod
                                .getType()
                                + "-" + prefix + "-" + mod.getID());
                    }
                    addAttributes(mod, attrs);
View Full Code Here

Examples of com.sun.xml.bind.util.AttributesImpl

       
        elementDepth++;
        stackTop++;
       
        // push the stack
        AttributesImpl a = attStack[stackTop];
        if( a==null )
            attStack[stackTop] = a = new AttributesImpl();
        else
            a.clear();
       
        // since Attributes object is mutable, it is criticall important
        // to make a copy.
        // also symbolize attribute names
        for( int i=0; i<atts.getLength(); i++ ) {
            String auri = atts.getURI(i);
            String alocal = atts.getLocalName(i);
            String avalue = atts.getValue(i);
           
            // <foo xsi:nil="false">some value</foo> is a valid fragment, however
            // we need a look ahead to correctly handle this case.
            // (because when we process @xsi:nil, we don't know what the value is,
            // and by the time we read "false", we can't cancel this attribute anymore.)
            //
            // as a quick workaround, we remove @xsi:nil if the value is false.
            if( auri=="http://www.w3.org/2001/XMLSchema-instance" && alocal=="nil" ) {
                String v = avalue.trim();
                if(v.equals("false") || v.equals("0"))
                    continue;   // skip this attribute
            }
           
            // otherwise just add it.
            a.addAttribute(
                    auri,
                    alocal,
                    atts.getQName(i),
                    atts.getType(i),
                    avalue );
View Full Code Here

Examples of nu.validator.xml.AttributesImpl

        int typeCount = typeNames.length;
        String wrapper = (bad? "b" : "span");
        String highlight = (bad? " highlight" : "");
        if (typeCount > 1 || "value".equals(attributeName)) {
            addText(xhtmlSaxEmitter, " ");
            AttributesImpl attributesImpl = new AttributesImpl();
            attributesImpl.addAttribute("class", "inputattrtypes" + highlight);
            xhtmlSaxEmitter.startElement(wrapper, attributesImpl);
            addText(xhtmlSaxEmitter, "when ");
            xhtmlSaxEmitter.startElement("code");
            addText(xhtmlSaxEmitter, "type");
            xhtmlSaxEmitter.endElement("code", "code");
            addText(xhtmlSaxEmitter, " is ");
            if ("value".equals(attributeName)) {
                addText(xhtmlSaxEmitter, "not ");
                addHyperlink(xhtmlSaxEmitter, "file", SPEC_LINK_URI
                        + fragmentIdByInputType.get("file"));
                addText(xhtmlSaxEmitter, " or ");
                addHyperlink(xhtmlSaxEmitter, "image", SPEC_LINK_URI
                        + fragmentIdByInputType.get("image"));
            } else {
                for (int i = 1; i < typeCount; i++) {
                    String typeName = typeNames[i];
                    if (i > 1) {
                        addText(xhtmlSaxEmitter, " ");
                    }
                    if (typeCount > 2 && i == typeCount - 1) {
                        addText(xhtmlSaxEmitter, "or ");
                    }
                    addHyperlink(xhtmlSaxEmitter, typeName, SPEC_LINK_URI
                            + fragmentIdByInputType.get(typeName));
                    if (i < typeCount - 1 && typeCount > 3) {
                        addText(xhtmlSaxEmitter, ",");
                    }
                }
            }
            xhtmlSaxEmitter.endElement(wrapper);
        } else {
            AttributesImpl attributesImpl = new AttributesImpl();
            attributesImpl.addAttribute("class", "inputattrtypes");
            xhtmlSaxEmitter.startElement("span", attributesImpl);
            xhtmlSaxEmitter.endElement("span");
        }
    }
View Full Code Here

Examples of org.apache.cocoon.sitemap.xml.AttributesImpl

            throw new RuntimeException("Failed to generate exception document.", e);
        }
    }

    private void toSAX(Throwable throwable, ContentHandler handler) throws SAXException {
        AttributesImpl attr = new AttributesImpl();
        // handler.startPrefixMapping("ex", EXCEPTION_NS);
        attr.addCDATAAttribute("class", throwable.getClass().getName());
        attr.addCDATAAttribute("timestamp", this.dateFormat.format(new Date()));
        handler.startElement(EXCEPTION_NS, "exception-report", "exception-report", attr);
        // handler.startElement(EXCEPTION_NS, "exception-report", "ex:exception-report", attr);

        // exception message
        attr.clear();
        simpleElement("message", attr, throwable.getMessage(), handler);

        // exception stacktrace
        attr.clear();
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw, true);
        throwable.printStackTrace(pw);
        simpleElement("stacktrace", attr, sw.getBuffer().toString(), handler);
View Full Code Here

Examples of org.apache.cocoon.xml.AttributesImpl

   
    /**
     * Adds attributes @required, @mime-types
     */
    public AttributesImpl getXMLElementAttributes() {
        AttributesImpl attrs = super.getXMLElementAttributes();
        attrs.addCDATAAttribute("id", getRequestParameterName());
        attrs.addCDATAAttribute("required", String.valueOf(uploadDefinition.isRequired()));
        if (uploadDefinition.getMimeTypes() != null) {
            attrs.addCDATAAttribute("mime-types", uploadDefinition.getMimeTypes());
        }
        return attrs;
    }
View Full Code Here

Examples of org.apache.cocoon.xml.sax.AttributesImpl

            throw new ProcessingException("Failed to generate exception document.", e);
        }
    }

    private void toSAX(Throwable throwable, ContentHandler handler) throws SAXException {
        AttributesImpl attr = new AttributesImpl();
        // handler.startPrefixMapping("ex", EXCEPTION_NS);
        attr.addCDATAAttribute("class", throwable.getClass().getName());
        attr.addCDATAAttribute("timestamp", this.dateFormat.format(new Date()));
        handler.startElement(EXCEPTION_NS, "exception-report", "exception-report", attr);
        // handler.startElement(EXCEPTION_NS, "exception-report", "ex:exception-report", attr);

        // exception message
        attr.clear();
        simpleElement("message", attr, throwable.getMessage(), handler);

        // exception stacktrace
        attr.clear();
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw, true);
        throwable.printStackTrace(pw);
        simpleElement("stacktrace", attr, sw.getBuffer().toString(), handler);
View Full Code Here

Examples of org.apache.directory.shared.ldap.message.AttributesImpl

    {
        StringReader strIn = new StringReader( text );
        BufferedReader in = new BufferedReader( strIn );

        String line = null;
        Attributes attributes = new AttributesImpl( true );

        try
        {
            while ( ( line = ( ( BufferedReader ) in ).readLine() ) != null )
            {
                if ( line.length() == 0 )
                {
                    continue;
                }

                String addedLine = line.trim();

                if ( StringTools.isEmpty( addedLine ) )
                {
                    continue;
                }

                javax.naming.directory.Attribute attribute = LdifReader.parseAttributeValue( addedLine );
                javax.naming.directory.Attribute oldAttribute = attributes.get( attribute.getID() );

                if ( oldAttribute != null )
                {
                    try
                    {
                        oldAttribute.add( attribute.get() );
                        attributes.put( oldAttribute );
                    }
                    catch ( NamingException ne )
                    {
                        // Do nothing
                    }
                }
                else
                {
                    attributes.put( attribute );
                }
            }
        }
        catch ( IOException ioe )
        {
View Full Code Here

Examples of org.fjank.jcache.AttributesImpl

     *
     * @return the default Attributes
     * @deprecated removed with no replacement.
     */
    public Attributes getDefaultAttributes() {
        return new AttributesImpl();
    }
View Full Code Here

Examples of org.jboss.xb.binding.AttributesImpl

               ContentHandler ch = ctx.getContentHandler();
               GenericElement ge = (GenericElement)o;

               try
               {
                  AttributesImpl attrs = null;
                  if(ge.getAttributesTotal() > 0)
                  {
                     attrs = new AttributesImpl(ge.getAttributesTotal() + 1);
                     Set attrNames = ge.getAttributeNames();
                     for(Iterator i = attrNames.iterator(); i.hasNext();)
                     {
                        String attrName = (String)i.next();
                        String attrValue = ge.getAttribute(attrName);
                        attrs.add(null, attrName, attrName, null, attrValue);
                     }
                  }
                  else
                  {
                     attrs = new AttributesImpl(1);
                  }

                  attrs.add(Constants.NS_XML_SCHEMA, "xmlns", "xmlns", null, ge.getNsUri());

                  ch.startElement(ge.getNsUri(), ge.getLocalName(), ge.getLocalName(), attrs);

                  String text = ge.getTextContent();
                  if(text != null && text.length() > 0)
View Full Code Here

Examples of org.jboss.xml.binding.AttributesImpl

         return count;
      }

      private AttributesImpl toSaxAttributes(XMLAttributes attributes)
      {
         AttributesImpl attrs = null;
         if(attributes != null)
         {
            attrs = new AttributesImpl(attributes.getLength());
            for(int i = 0; i < attributes.getLength(); ++i)
            {
               if(!"xmlns".equals(attributes.getPrefix(i)))
               {
                  attrs.add(attributes.getURI(i),
                     attributes.getLocalName(i),
                     attributes.getQName(i),
                     attributes.getType(i),
                     attributes.getValue(i)
                  );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.