Oracle® Solaris Cluster Data Services Developer's Guide

Exit Print View

Updated: July 2014, E39646-01
 
 

How to Set Up the XML Parser

You have now created the networking and XML generation code for the application. The CrnpClient constructor calls a setupXmlProcessing method. This method creates a DocumentBuilderFactory object and sets various parsing properties on that object. The JAXP documentation describes this method in more detail. See https://jaxp.java.net/.

  • Create the Java code that implements the preceding logic.
    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);
    }