Document control = XMLUnit.buildDocument(XMLUnit.newControlParser(), new StringReader(xml)); Document test = XMLUnit.buildDocument(XMLUnit.newTestParser(), new StringReader(xml2)); Diff diff = new Diff(control, test, null, new ElementNameAndAttributeQualifier("name"));
/** * Utility method to build a Document using a specific DocumentBuilder * and reading characters from a specific Reader. * @param withBuilder * @param fromReader * @return Document built * @throws SAXException * @throws IOException */ public static Document buildDocument(DocumentBuilder withBuilder, Reader fromReader) throws SAXException, IOException { return buildDocument(withBuilder, new InputSource(fromReader)); } /**
/** * Utility method to build a Document using a specific DocumentBuilder * and reading characters from a specific Reader. * @param withBuilder * @param fromReader * @return Document built * @throws SAXException * @throws IOException */ public static Document buildDocument(DocumentBuilder withBuilder, Reader fromReader) throws SAXException, IOException { return buildDocument(withBuilder, new InputSource(fromReader)); } /**
/** * Construct a Diff that compares the XML read from two Readers */ public Diff(Reader control, Reader test) throws SAXException, IOException { this(XMLUnit.buildDocument(XMLUnit.newControlParser(), control), XMLUnit.buildDocument(XMLUnit.newTestParser(), test)); }
/** * Utility method to build a Document using the control DocumentBuilder * to parse the specified String. * @param fromXML * @return Document representation of the String content * @throws SAXException * @throws IOException */ public static Document buildControlDocument(String fromXML) throws SAXException, IOException { return buildDocument(newControlParser(), new StringReader(fromXML)); }
/** * Utility method to build a Document using the test DocumentBuilder * and the specified InputSource * @param fromSource * @return Document representation of the String content * @throws SAXException * @throws IOException */ public static Document buildTestDocument(InputSource fromSource) throws IOException, SAXException { return buildDocument(newTestParser(), fromSource); }
/** * Utility method to build a Document using the control DocumentBuilder * and the specified InputSource * @param fromSource * @return Document representation of the String content * @throws SAXException * @throws IOException */ public static Document buildControlDocument(InputSource fromSource) throws IOException, SAXException { return buildDocument(newControlParser(), fromSource); }
/** * Construct a NodeTest for the DOM built using the Reader and JAXP */ public NodeTest(Reader reader) throws SAXException, IOException { this(XMLUnit.buildDocument(XMLUnit.newControlParser(), reader)); }
/** * Utility method to build a Document using the test DocumentBuilder * to parse the specified String. * @param fromXML * @return Document representation of the String content * @throws SAXException * @throws IOException */ public static Document buildTestDocument(String fromXML) throws SAXException, IOException { return buildDocument(newTestParser(), new StringReader(fromXML)); }
/** * Construct a Diff that compares the XML read from two JAXP InputSources */ public Diff(InputSource control, InputSource test) throws SAXException, IOException { this(XMLUnit.buildDocument(XMLUnit.newControlParser(), control), XMLUnit.buildDocument(XMLUnit.newTestParser(), test)); }
/** * Construct a NodeTest for the DOM built using the Reader and JAXP */ public NodeTest(Reader reader) throws SAXException, IOException { this(XMLUnit.buildDocument(XMLUnit.newControlParser(), reader)); }
/** * Utility method to build a Document using the control DocumentBuilder * to parse the specified String. * @param fromXML * @return Document representation of the String content * @throws SAXException * @throws IOException */ public static Document buildControlDocument(String fromXML) throws SAXException, IOException { return buildDocument(newControlParser(), new StringReader(fromXML)); }
/** * Utility method to build a Document using the control DocumentBuilder * and the specified InputSource * @param fromSource * @return Document representation of the String content * @throws SAXException * @throws IOException */ public static Document buildControlDocument(InputSource fromSource) throws IOException, SAXException { return buildDocument(newControlParser(), fromSource); }
/** * Utility method to build a Document using the test DocumentBuilder * and the specified InputSource * @param fromSource * @return Document representation of the String content * @throws SAXException * @throws IOException */ public static Document buildTestDocument(InputSource fromSource) throws IOException, SAXException { return buildDocument(newTestParser(), fromSource); }
/** * Construct a NodeTest for the DOM built using the InputSource. */ public NodeTest(InputSource src) throws SAXException, IOException { this(XMLUnit.buildDocument(XMLUnit.newControlParser(), src)); }
/** * Utility method to build a Document using the test DocumentBuilder * to parse the specified String. * @param fromXML * @return Document representation of the String content * @throws SAXException * @throws IOException */ public static Document buildTestDocument(String fromXML) throws SAXException, IOException { return buildDocument(newTestParser(), new StringReader(fromXML)); }
/** * Construct a Diff that compares the XML read from two Readers */ public Diff(Reader control, Reader test) throws SAXException, IOException { this(XMLUnit.buildDocument(XMLUnit.newControlParser(), control), XMLUnit.buildDocument(XMLUnit.newTestParser(), test)); }
/** * Construct a Diff that compares the XML read from two JAXP InputSources */ public Diff(InputSource control, InputSource test) throws SAXException, IOException { this(XMLUnit.buildDocument(XMLUnit.newControlParser(), control), XMLUnit.buildDocument(XMLUnit.newTestParser(), test)); }
/** * Construct a NodeTest for the DOM built using the InputSource. */ public NodeTest(InputSource src) throws SAXException, IOException { this(XMLUnit.buildDocument(XMLUnit.newControlParser(), src)); }
DocumentBuilder documentBuilder = Xml.newDocumentBuilderFactory().newDocumentBuilder(); documentBuilder.setErrorHandler(new SilentErrorHandler()); Document inDocument = XMLUnit.buildDocument(documentBuilder, new StringReader(value)); XpathEngine simpleXpathEngine = XMLUnit.newXpathEngine(); if (xpathNamespaces != null) {