"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "javase/src/main/java/com/google/zxing/client/j2se/HtmlAssetTranslator.java" between
zxing-zxing-3.4.1.tar.gz and zxing-zxing-3.5.0.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. Info: Project is in maintenance mode (no active development).

HtmlAssetTranslator.java  (zxing-zxing-3.4.1):HtmlAssetTranslator.java  (zxing-zxing-3.5.0)
skipping to change at line 29 skipping to change at line 29
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.bootstrap.DOMImplementationRegistry;
import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSSerializer; import org.w3c.dom.ls.LSSerializer;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
skipping to change at line 64 skipping to change at line 65
* be translated.</p> * be translated.</p>
* *
* <p>Usage: {@code HtmlAssetTranslator android/assets/ (all|lang1[,lang2 ...]) (all|file1.html[ file2.html ...])}</p> * <p>Usage: {@code HtmlAssetTranslator android/assets/ (all|lang1[,lang2 ...]) (all|file1.html[ file2.html ...])}</p>
* *
* <p>{@code android/assets/ es all} will translate .html files in subdirectory html-en to * <p>{@code android/assets/ es all} will translate .html files in subdirectory html-en to
* directory html-es, for example. Note that only text nodes in the HTML documen t are translated. * directory html-es, for example. Note that only text nodes in the HTML documen t are translated.
* Any text that is a child of a node with {@code class="notranslate"} will not be translated. It will * Any text that is a child of a node with {@code class="notranslate"} will not be translated. It will
* also add a note at the end of the translated page that indicates it was autom atically translated.</p> * also add a note at the end of the translated page that indicates it was autom atically translated.</p>
* *
* @author Sean Owen * @author Sean Owen
* @deprecated without replacement since 3.4.2
*/ */
@Deprecated
public final class HtmlAssetTranslator { public final class HtmlAssetTranslator {
private static final Pattern COMMA = Pattern.compile(","); private static final Pattern COMMA = Pattern.compile(",");
private HtmlAssetTranslator() {} private HtmlAssetTranslator() {}
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
if (args.length < 3) { if (args.length < 3) {
System.err.println("Usage: HtmlAssetTranslator android/assets/ " + System.err.println("Usage: HtmlAssetTranslator android/assets/ " +
"(all|lang1[,lang2 ...]) (all|file1.html[ file2.html .. .])"); "(all|lang1[,lang2 ...]) (all|file1.html[ file2.html .. .])");
skipping to change at line 150 skipping to change at line 153
} }
} }
private static void translateOneFile(String language, private static void translateOneFile(String language,
Path targetHtmlDir, Path targetHtmlDir,
Path sourceFile, Path sourceFile,
String translationTextTranslated) throws IOException { String translationTextTranslated) throws IOException {
Path destFile = targetHtmlDir.resolve(sourceFile.getFileName()); Path destFile = targetHtmlDir.resolve(sourceFile.getFileName());
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document document; Document document;
try { try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder builder = factory.newDocumentBuilder(); DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(sourceFile.toFile()); document = builder.parse(sourceFile.toFile());
} catch (ParserConfigurationException pce) { } catch (ParserConfigurationException pce) {
throw new IllegalStateException(pce); throw new IllegalStateException(pce);
} catch (SAXException sae) { } catch (SAXException sae) {
throw new IOException(sae); throw new IOException(sae);
} }
Element rootElement = document.getDocumentElement(); Element rootElement = document.getDocumentElement();
rootElement.normalize(); rootElement.normalize();
 End of changes. 5 change blocks. 
1 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)