博文

目前显示的是 十月, 2015的博文

Showing a XML

The following has 2 ways for indenting to show the xml. 1. using the class TransformerFactory's setAttribute("indent-number", new Integer(20)); 2. using the class Transformer's setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");  This way is higher priority than the first way. // Requires Java SE 1.7.0            TransformerFactory tf = TransformerFactory.newInstance(); //1. set the indented format of the additional whitespace when outputting the result tree;             tf.setAttribute("indent-number", new Integer(20));  // It works.             Transformer transformer = tf.newTransformer(); //2. set the indented format of the additional whitespace when outputting the result tree; This way is higher priority than the 1.             tra...

display xml with xslt and resx in the jsp file

This is a little test for displaying xml with xslt and rest in a jsp file. A test jsp file. <!DOCTYPE html> <%@ page contentType="text/html;charset=UTF-8"%> <%@ page import="java.io.File"%> <%@ page import="javax.xml.transform.stream.StreamSource"%> <%@ page import="javax.xml.transform.stream.StreamResult"%> <%@ page import="javax.xml.transform.TransformerFactory"%> <%@ page import="javax.xml.transform.Transformer"%> <%@ page import="org.w3c.dom.Document"%> <%@ page import="org.w3c.dom.Element"%> <%@ page import="javax.xml.parsers.DocumentBuilder"%> <%@ page import="javax.xml.transform.dom.DOMSource"%> <%@ page import="javax.xml.parsers.DocumentBuilderFactory"%> <% //Create a document in the memory.         Document doc=null;                 String root = "Query";     ...

iconfinder

图片
https://www.iconfinder.com/search/?q=Address&price=free

XML, XSL, HTML

The code in this section is that an XSLT transform is used to translate XML input data to HTML output. Ref: https://docs.oracle.com/javase/tutorial/jaxp/xslt/transformingXML.html Note - The article1a.xsl , which is from in XSLT examples . The following code is for joy.  import java.awt.Desktop; import java.io.*; import java.net.URISyntaxException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; // For write operation import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; public class Stylizer { ...