Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

What's the diff?

Some suggestions for comparing semantic equivalency of XML documents

Return to article


Listing 9. Resolving all NHLcopyright entities the same way

package com.developerWorks.xml.util;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
public class CommonResolver implements EntityResolver {
    public void resolveEntity(String publicID, String systemID)
        throws SAXException {
        
        // Look for the NHLCopyright system ID
        if ((systemID.equals("http://www.nhl.com/nhlCopyright.xml")) ||
            (systemID.equals("http://www.dallasStars.com/nhl/copyright.xml"))) {
            // You could add other system IDs for comparison here, as well
            
            return new InputSource("myLocalCopyright.xml");
        }
        
        // In all other cases, return null
        return null;                   
    }
}

Return to article