📄 dom.jsp
字号:
<%
/*
* Copyright (c) 1999-2003 BEA Systems, Inc. All rights reserved
*
* THIS IS SOURCE CODE PUBLISHED FOR DEMONSTRATION PURPOSES
*
*/
%>
<%@ page import="
javax.xml.parsers.DocumentBuilder,
javax.xml.parsers.DocumentBuilderFactory,
javax.xml.parsers.ParserConfigurationException,
org.w3c.dom.Document,
org.xml.sax.InputSource,
weblogic.apache.xml.serialize.OutputFormat,
weblogic.apache.xml.serialize.XMLSerializer
"%>
<%
BufferedInputStream bis = new BufferedInputStream(request.getInputStream());
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
DocumentBuilder db = fact.newDocumentBuilder();
Document doc = db.parse(new InputSource(bis));
String encoding = "UTF-8";
int LineWidth = 20;
int Indent = 4;
OutputFormat of = new OutputFormat();
of.setEncoding(encoding);
of.setLineWidth(LineWidth);
of.setIndent(Indent);
XMLSerializer xs = new XMLSerializer(System.out, of);
System.out.println("");
System.out.println("START DOCUMENT");
System.out.println("");
%>
<%
try {
xs.serialize(doc);
}
catch(Exception e) {
System.out.println(e);
}
System.out.println("");
System.out.println("END DOCUMENT");
PrintWriter responseWriter = response.getWriter();
responseWriter.println("The document has been successfully parsed. Check the server shell for output.");
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -