Solaris OS용 Sun Cluster 데이터 서비스 개발 안내서

ProcedureXML 구문 분석기 설정 방법

이제 응용 프로그램의 네트워킹 및 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);
    }