Package com.dotcms.repackage.org.xml.sax.helpers

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


            handler.endElement("", node.getQName(), node.getQName());

    }

    private void writeImage(ImageNode imgNode) throws SAXException {
        AttributesImpl attrs = imgNode.getAttributes();
        if (imgNode.getModification().getType() == ModificationType.REMOVED)
            attrs.addAttribute("", "changeType", "changeType", "CDATA",
                    "diff-removed-image");
        else if (imgNode.getModification().getType() == ModificationType.ADDED)
            attrs.addAttribute("", "changeType", "changeType", "CDATA",
                    "diff-added-image");
        handler.startElement("", "img", "img", attrs);
        handler.endElement("", "img", "img");
    }
View Full Code Here

    private boolean insideTag = false;

    private void addBasicText(String text) throws SAXException {
        char[] c = text.toCharArray();

        AttributesImpl noattrs = new AttributesImpl();

        for (int i = 0; i < c.length; i++) {
            switch (c[i]) {
            case '\n':
                consumer.startElement("", "br", "br", noattrs);
                consumer.endElement("", "br", "br");
                consumer.characters("\n".toCharArray(), 0, "\n".length());
                break;
            case '<':
                if (insideTag == false) {
                    AttributesImpl attrs = new AttributesImpl();
                    attrs.addAttribute("", "class", "class", "CDATA",
                            "diff-tag-html");
                    consumer.startElement("", "span", "span", attrs);
                    insideTag = true;
                } else {
                    consumer.endElement("", "span", "span");
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void addRemovedPart(String text) throws Exception {
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute("", "class", "class", "CDATA", "diff-tag-removed");
        attrs.addAttribute("", "id", "id", "CDATA", "removed" + removedID);
        attrs.addAttribute("", "title", "title", "CDATA", "#removed"
                + removedID);
        removedID++;
        consumer.startElement("", "span", "span", attrs);
        addBasicText(text);
        consumer.endElement("", "span", "span");
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void addAddedPart(String text) throws Exception {
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute("", "class", "class", "CDATA", "diff-tag-added");
        attrs.addAttribute("", "id", "id", "CDATA", "added" + addedID);
        attrs.addAttribute("", "title", "title", "CDATA", "#added" + addedID);
        addedID++;
        consumer.startElement("", "span", "span", attrs);
        addBasicText(text);
        consumer.endElement("", "span", "span");
    }
View Full Code Here

        super(node, sem, bundle);
    }

    @Override
    protected void addAttributes(ChangeText txt, Attributes attributes) {
        AttributesImpl newAttrs = new AttributesImpl(attributes);
        String href = newAttrs.getValue("href");

        if (href != null) {
            txt.addText(" " + getWithDestination().toLowerCase() + " " + href);
            newAttrs.removeAttribute(newAttrs.getIndex("href"));
        }
        super.addAttributes(txt, newAttrs);
    }
View Full Code Here

            consumer.endElement("", localName, localName);
        }

        public void startElement(String namespaceURI, String localName,
                String qName, Attributes atts) throws SAXException {
            AttributesImpl newAtts = new AttributesImpl(atts);
            for (int i = 0; i < atts.getLength(); i++) {
                newAtts.setURI(i, "");
                newAtts.setQName(i, newAtts.getLocalName(i));
            }
            consumer.startElement("", localName, localName, atts);
        }
View Full Code Here

    private Attributes attributes;

    public TagNode(TagNode parent, String qName, Attributes attributesarg) {
        super(parent);
        this.qName = qName;
        attributes = new AttributesImpl(attributesarg);
    }
View Full Code Here

        return isInline(this);
    }

    @Override
    public Node copyTree() {
        TagNode newThis = new TagNode(null, getQName(), new AttributesImpl(
                getAttributes()));
        newThis.setWhiteBefore(isWhiteBefore());
        newThis.setWhiteAfter(isWhiteAfter());
        for (Node child : this) {
            Node newChild = child.copyTree();
View Full Code Here

    private AttributesImpl attributes;

    public ImageNode(TagNode parent, Attributes attrs) {
        super(parent, "<img>" + attrs.getValue("src").toLowerCase() + "</img>");
        attributes = new AttributesImpl(attrs);
    }
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.xml.sax.helpers.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.