2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.data.impl;
10 import org.custommonkey.xmlunit.Difference;
11 import org.custommonkey.xmlunit.DifferenceConstants;
12 import org.custommonkey.xmlunit.DifferenceListener;
15 * Implementatin of {@link DifferenceListener} ignoring white characters around text elements.
19 public class IgnoreWhiteCharsDiffListener implements DifferenceListener {
22 public void skippedComparison(org.w3c.dom.Node control,
23 org.w3c.dom.Node test) {
28 public int differenceFound(Difference diff) {
30 if (diff.getId() == DifferenceConstants.TEXT_VALUE.getId()) {
31 String control = diff.getControlNodeDetail().getValue();
32 if (control != null) {
33 control = control.trim();
34 if (diff.getTestNodeDetail().getValue() != null
35 && control.equals(diff.getTestNodeDetail().getValue().trim())) {
37 DifferenceListener.RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR;
41 return RETURN_ACCEPT_DIFFERENCE;