congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DocumentComparator
Code IndexAdd Tabnine to your IDE (free)

How to use
DocumentComparator
in
org.jibx.extras

Best Java code snippets using org.jibx.extras.DocumentComparator (Showing top 7 results out of 315)

origin: org.jibx/jibx-extras

/**
 * Prints error description text. The generated text include position
 * information from both documents. 
 *
 * @param msg error message text
 */
protected void printError(String msg) {
  if (m_differencePrint != null) {
    m_differencePrint.println(msg + " - from " +
      buildPositionString(m_parserA) + " to " +
      buildPositionString(m_parserB));
  }
}

origin: org.jibx/jibx-extras

/**
 * Check if two text strings match, ignoring leading and trailing spaces.
 * Any mismatch is printed immediately, with the supplied lead text.
 *
 * @param texta String to compare
 * @param textb String to compare
 * @param lead error text lead
 * @return <code>true</code> if the texts match, <code>false</code> if
 * not
 */
protected boolean matchText(String texta, String textb, String lead) {
  if (equalValues(texta, textb)) {
    return true;
  } else if (!m_schemaCompare && texta.trim().equals(textb.trim())) {
    return true;
  } else {
    printError(lead);
    if (m_differencePrint != null) {
      m_differencePrint.println(" \"" + texta +
      "\" (length " + texta.length() + " vs. \"" +
      textb + "\" (length " + textb.length() + ')');
    }
    return false;
  }
}
origin: org.jibx/jibx-extras

InputStreamReader frdr = new InputStreamReader
  (new FileInputStream(fout), encoding);
DocumentComparator comp = new DocumentComparator(System.err);
if (comp.compare(frdr, brdr)) {
  return true;
} else {
origin: org.jibx/jibx-extras

int typeb = m_parserB.getEventType();
if (typea != typeb) {
  printError("Different document structure");
  return false;
} else if (typea == XmlPullParser.START_TAG) {
  if (!matchNames()) {
    printError("Different start tags");
    return false;
  } else {
    if (!matchAttributes()) {
      same = false;
    if (!matchText(texta, textb,
      "Different text content between elements")) {
      same = false;
  if (!matchNames()) {
    printError("Different end tags");
    return false;
    if (!matchText(texta, textb, "Different text content")) {
      same = false;
    if (!matchText(texta, textb,
      "Different text content between elements")) {
      same = false;
origin: org.jibx/jibx-extras

    ns.equals(m_parserB.getAttributeNamespace(j))) {
    flags[j] = true;
    if (!equalValues(value, m_parserB.getAttributeValue(j))) {
      if (match) {
        printError("Attribute mismatch");
        match = false;
        buildName(ns, name) + " value '" + value +
        "' != '" + m_parserB.getAttributeValue(j) + '\'');
if (!found && !(m_schemaCompare && isSchemaLocation(name, ns))) {
  if (match) {
    printError("Attribute mismatch");
    match = false;
    buildName(ns, name) + "=\"" + value +
    "\" is missing from second document");
  String ns = m_parserB.getAttributeNamespace(i);
  String name = m_parserB.getAttributeName(i);
  if (!m_schemaCompare || !isSchemaLocation(name, ns)) {
    if (match) {
      printError("Attribute mismatch");
      match = false;
      buildName(ns, name) +
      " is missing from first document");
origin: org.jibx/jibx-extras

  return normalizeDecimal(trima).equals(normalizeDecimal(trimb));
} else {
  return false;
origin: org.jibx/jibx-tools

ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream pstream = new PrintStream(baos);
DocumentComparator comp = new DocumentComparator(pstream);
if (comp.compare(frdr, brdr)) {
org.jibx.extrasDocumentComparator

Javadoc

XML document comparator. This uses XMLPull parsers to read a pair of documents in parallel, comparing the streams of components seen from the two documents. The comparison ignores differences in whitespace separating elements, but in non-schema mode treats whitespace as significant within elements with only character data content.

Most used methods

  • <init>
    Constructor with schema adjustments flag specified. Builds the actual parsers and sets up for compar
  • compare
    Compares a pair of documents by reading them in parallel from a pair of parsers. The comparison igno
  • buildName
    Build name string.
  • buildPositionString
    Build parse input position description.
  • equalValues
    Check for equal values. If the schema compare flag is configured, this applies some basic schema rul
  • isSchemaLocation
    Check if a name/namespace pair matches a schema namespace location attribute.
  • matchAttributes
    Verifies that the attributes on the current start tags match. Any mismatches are printed immediately
  • matchNames
    Verifies that the current start or end tag names match.
  • matchText
    Check if two text strings match, ignoring leading and trailing spaces. Any mismatch is printed immed
  • normalizeDecimal
    Normalize a decimal value for comparison. A leading '+' sign is ignored, while a leading '-' is kept
  • printError
    Prints error description text. The generated text include position information from both documents.
  • printError

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now