您現在已經為應用程式建立了網路程式碼與 XML 產生程式碼。CrnpClient 建構子將呼叫 setupXmlProcessing 方法。此方法將建立 DocumentBuilderFactory 物件並在該物件上設定多種剖析特性。JAXP 文件將更詳細地說明此方法。請參閱 http://java.sun.com/xml/jaxp/index.html。
建立實施前導邏輯的 Java 程式碼。
private void setupXmlProcessing() throws Exception
{
dbf = DocumentBuilderFactory.newInstance();
// We don't need to bother validating
dbf.setValidating(false);
dbf.setExpandEntityReferences(false);
// We want to ignore comments and whitespace
dbf.setIgnoringComments(true);
dbf.setIgnoringElementContentWhitespace(true);
// Coalesce CDATA sections into TEXT nodes.
dbf.setCoalescing(true);
}