@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2015 the original author or authors .
* Copyright 2002 - 2016 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -16,6 +16,16 @@
@@ -16,6 +16,16 @@
package org.springframework.util.xml ;
import java.io.StringReader ;
import java.io.StringWriter ;
import java.net.Socket ;
import javax.xml.parsers.DocumentBuilder ;
import javax.xml.parsers.DocumentBuilderFactory ;
import javax.xml.stream.XMLStreamException ;
import javax.xml.transform.Result ;
import javax.xml.transform.dom.DOMResult ;
import javax.xml.transform.stream.StreamResult ;
import org.junit.Assume ;
import org.junit.Before ;
import org.junit.Test ;
@ -26,19 +36,8 @@ import org.xml.sax.XMLReader;
@@ -26,19 +36,8 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory ;
import org.xmlunit.util.Predicate ;
import javax.xml.parsers.DocumentBuilder ;
import javax.xml.parsers.DocumentBuilderFactory ;
import javax.xml.stream.XMLStreamException ;
import javax.xml.transform.Result ;
import javax.xml.transform.dom.DOMResult ;
import javax.xml.transform.stream.StreamResult ;
import java.io.StringReader ;
import java.io.StringWriter ;
import java.net.Socket ;
import static org.junit.Assert.assertThat ;
import static org.xmlunit.matchers.CompareMatcher.isSimilarTo ;
import static org.junit.Assert.* ;
import static org.xmlunit.matchers.CompareMatcher.* ;
/ * *
* @author Arjen Poutsma
@ -57,17 +56,18 @@ public abstract class AbstractStaxHandlerTestCase {
@@ -57,17 +56,18 @@ public abstract class AbstractStaxHandlerTestCase {
"<?pi content?><root xmlns='namespace'><prefix:child xmlns:prefix='namespace2' prefix:attr='value'>content</prefix:child>" +
"</root>" ;
private static final Predicate < Node > nodeFilter = ( n - > n . getNodeType ( ) ! = Node . COMMENT_NODE & &
n . getNodeType ( ) ! = Node . DOCUMENT_TYPE_NODE & & n . getNodeType ( ) ! = Node . PROCESSING_INSTRUCTION_NODE ) ;
private XMLReader xmlReader ;
private Predicate < Node > nodeFilter = n - > n . getNodeType ( ) ! = Node . COMMENT_NODE
& & n . getNodeType ( ) ! = Node . DOCUMENT_TYPE_NODE & & n . getNodeType ( ) ! = Node . PROCESSING_INSTRUCTION_NODE ;
@Before
public void createXMLReader ( ) throws Exception {
xmlReader = XMLReaderFactory . createXMLReader ( ) ;
}
@Test
public void noNamespacePrefixes ( ) throws Exception {
Assume . assumeTrue ( wwwSpringframeworkOrgIsAccessible ( ) ) ;
@ -114,8 +114,7 @@ public abstract class AbstractStaxHandlerTestCase {
@@ -114,8 +114,7 @@ public abstract class AbstractStaxHandlerTestCase {
@Test
public void noNamespacePrefixesDom ( ) throws Exception {
DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory . newInstance ( ) ;
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ;
documentBuilderFactory . setNamespaceAware ( true ) ;
DocumentBuilder documentBuilder = documentBuilderFactory . newDocumentBuilder ( ) ;
@ -136,8 +135,7 @@ public abstract class AbstractStaxHandlerTestCase {
@@ -136,8 +135,7 @@ public abstract class AbstractStaxHandlerTestCase {
@Test
public void namespacePrefixesDom ( ) throws Exception {
DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory . newInstance ( ) ;
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ;
documentBuilderFactory . setNamespaceAware ( true ) ;
DocumentBuilder documentBuilder = documentBuilderFactory . newDocumentBuilder ( ) ;