All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.epubcheck.ctc.xml.LangAttributeHandler Maven / Gradle / Ivy

Go to download

EPUBCheck is a tool to validate the conformance of EPUB publications against the EPUB specifications. EPUBCheck can be run as a standalone command-line tool or used as a Java library.

There is a newer version: 5.1.0
Show newest version
package com.adobe.epubcheck.ctc.xml;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

/**
 *  ===  WARNING  ==========================================
* This class is scheduled to be refactored and integrated
* in another package.
* Please keep changes minimal (bug fixes only) until then.
* ========================================================
*/ public class LangAttributeHandler extends DefaultHandler { private String xmlLangAttr = null; private String langAttr = null; public String getXmlLangAttr() { return xmlLangAttr; } public String getLangAttr() { return langAttr; } public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { //outWriter.println("Start Tag -->:<" +qName+">"); if (qName.compareToIgnoreCase("HTML") == 0) { for (int i = 0; i < attributes.getLength(); i++) { String attrName = attributes.getQName(i); String attrValue = attributes.getValue(i); if (attrName.compareToIgnoreCase("xml:lang") == 0) { xmlLangAttr = attrValue; } if (attrName.compareToIgnoreCase("lang") == 0) { langAttr = attrValue; } } } } public void endElement(String uri, String localName, String qName) throws SAXException { //outWriter.println("End Tag -->:"); } public void characters(char ch[], int start, int length) throws SAXException { //outWriter.println("-----Tag value----------->"+new String(ch, start, length)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy