Package nu.validator.xml

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


        xhtmlSaxEmitter.characters(ch, 0, ch.length);
    }

    private void addHyperlink(XhtmlSaxEmitter xhtmlSaxEmitter, String text,
            String href) throws SAXException {
        AttributesImpl attributesImpl = new AttributesImpl();
        attributesImpl.addAttribute("href", href);
        xhtmlSaxEmitter.startElement("a", attributesImpl);
        addText(xhtmlSaxEmitter, text);
        xhtmlSaxEmitter.endElement("a");
    }
View Full Code Here

                return;
            case IN_PROSE:
                String href = null;
                if (NS == uri && "a" == localName) {
                    if ((href = atts.getValue("", "href")) != null) {
                        AttributesImpl ai = new AttributesImpl();
                        ai.addAttribute("href", href);
                        depth++;
                        treeBuilder.startElement(uri, localName, qName, ai);
                    }
                } else if (depth == 0 && NS == uri && "div" == localName
                        && ("printfooter".equals(atts.getValue("", "class")))) {
View Full Code Here

                    if ("a" == localName && NS == uri
                            && (href = atts.getValue("", "href")) != null) {
                        if (href.startsWith("#")) {
                            href = SPEC_LINK_URI + href;
                        }
                        AttributesImpl attributesImpl = new AttributesImpl();
                        attributesImpl.addAttribute("href", href);
                        fragmentBuilder.startElement(uri, localName, qName,
                                attributesImpl);
                    } else if (state == State.CAPTURING_ATTRIBUTES_DDS
                            && "input".equals(currentName.getLocalName())
                            && "code".equals(localName)
                            ) {
                        AttributesImpl attributesImpl = new AttributesImpl();
                        attributesImpl.addAttribute("class", "inputattrname");
                        fragmentBuilder.startElement(uri, localName, qName,
                                attributesImpl);
                    } else {
                        fragmentBuilder.startElement(uri, localName, qName,
                                EmptyAttributes.EMPTY_ATTRIBUTES);
View Full Code Here

    private void listInputTypesForAttribute(String attributeName,
            TreeBuilder fragmentBuilder) throws SAXException {
        if (validInputTypesByAttributeName.containsKey(attributeName)
                || "value".equals(attributeName)) {
            addText(" ");
            AttributesImpl attributesImpl = new AttributesImpl();
            attributesImpl.addAttribute("class", "inputattrtypes " + attributeName);
            fragmentBuilder.startElement(NS, "span", "span", attributesImpl);
            addText("when ");
            fragmentBuilder.startElement(NS, "code", "code", EmptyAttributes.EMPTY_ATTRIBUTES);
            addText("type");
            fragmentBuilder.endElement(NS, "code", "code");
            addText(" is ");
            if ("value".equals(attributeName)) {
                addText("not ");
                addHyperlink("file", SPEC_LINK_URI
                        + fragmentIdByInputType.get("file"));
                addText(" or ");
                addHyperlink("image", SPEC_LINK_URI
                        + fragmentIdByInputType.get("image"));
            } else {
                String[] typeNames = validInputTypesByAttributeName.get(attributeName);
                int typeCount = typeNames.length;
                for (int i = 0; i < typeCount; i++) {
                    String typeName = typeNames[i];
                    if (i > 0) {
                        addText(" ");
                    }
                    if (typeCount > 1 && i == typeCount - 1) {
                        addText("or ");
                    }
                    addHyperlink(typeName, SPEC_LINK_URI
                            + fragmentIdByInputType.get(typeName));
                    if (i < typeCount - 1 && typeCount > 2) {
                        addText(",");
                    }
                }
            }
            fragmentBuilder.endElement(NS, "span", "span");
        } else {
            AttributesImpl attributesImpl = new AttributesImpl();
            attributesImpl.addAttribute("class", "inputattrtypes");
            fragmentBuilder.startElement(NS, "span", "span", attributesImpl);
            fragmentBuilder.endElement(NS, "span", "span");
        }
    }
View Full Code Here

        char[] ch = text.toCharArray();
        fragmentBuilder.characters(ch, 0, ch.length);
    }

    private void addHyperlink(String text, String href) throws SAXException {
        AttributesImpl attributesImpl = new AttributesImpl();
        attributesImpl.addAttribute("href", href);
        fragmentBuilder.startElement(NS, "a", "a", attributesImpl);
        addText(text);
        fragmentBuilder.endElement(NS, "a", "a");
    }
View Full Code Here

            String uri = attributes.getURI(i);
            if (local == "lang" && uri == "http://www.w3.org/XML/1998/namespace") {
                langValue = attributes.getValue(i);
            } else if (local == "xml:lang" && uri == "") {
                String xmlLangValue = attributes.getValue(i);
                AttributesImpl attributesImpl = new AttributesImpl();
                for (int j = 0; j < i; j++) {
                    attributesImpl.addAttribute(attributes.getURI(j), attributes.getLocalName(j), attributes.getQName(j), attributes.getType(j), attributes.getValue(j));
                }
                for (int k = i + 1; k < len; k++) {
                    uri = attributes.getURI(k);
                    local = attributes.getLocalName(k);
                    if (local == "lang" && uri == "http://www.w3.org/XML/1998/namespace") {
                        langValue = attributes.getValue(k);
                    }
                    attributesImpl.addAttribute(uri, local, attributes.getQName(k), attributes.getType(k), attributes.getValue(k));                       
                }
                if (errorHandler != null && !equalsIgnoreAsciiCase(xmlLangValue, langValue)) {
                    errorHandler.error(new SAXParseException("When the attribute \u201Cxml:lang\u201D in no namespace is specified, the element must also have the attribute \u201Clang\u201D present with the same value.", locator));
                }
                return attributesImpl;
View Full Code Here

            String local = attributes.getLocalName(i);
            if (local.length() > 5 && local.startsWith("data-") && attributes.getURI(i) == "") {
                if (errorHandler != null) {
                    checkDataName(local);
                }
                AttributesImpl attributesImpl = new AttributesImpl();
                for (int j = 0; j < i; j++) {
                    attributesImpl.addAttribute(attributes.getURI(j), attributes.getLocalName(j), attributes.getQName(j), attributes.getType(j), attributes.getValue(j));
                }
                for (int k = i + 1; k < len; k++) {
                    String uri = attributes.getURI(k);
                    local = attributes.getLocalName(k);
                    if (local.length() > 5 && local.startsWith("data-") && "" == uri) {
                        checkDataName(local);
                    } else {
                        attributesImpl.addAttribute(uri, local, attributes.getQName(k), attributes.getType(k), attributes.getValue(k));                       
                    }
                }
                return attributesImpl;
            }
        }
View Full Code Here

        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

        xhtmlSaxEmitter.characters(ch, 0, ch.length);
    }

    private void addHyperlink(XhtmlSaxEmitter xhtmlSaxEmitter, String text,
            String href) throws SAXException {
        AttributesImpl attributesImpl = new AttributesImpl();
        attributesImpl.addAttribute("href", href);
        xhtmlSaxEmitter.startElement("a", attributesImpl);
        addText(xhtmlSaxEmitter, text);
        xhtmlSaxEmitter.endElement("a");
    }
View Full Code Here

TOP

Related Classes of nu.validator.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.