15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package stream.XMLStreamReaderTest; 25 26 import java.io.InputStream; 27 28 import javax.xml.namespace.NamespaceContext; 29 import javax.xml.namespace.QName; 30 import javax.xml.stream.XMLInputFactory; 31 import javax.xml.stream.XMLStreamConstants; 32 import javax.xml.stream.XMLStreamReader; 33 34 import org.testng.Assert; 35 import org.testng.annotations.Test; 36 37 /* 38 * @summary Test StAX parser processes namespace. 39 */ 40 public class NamespaceTest { 41 42 String namespaceURI = "foobar.com"; 43 String rootElement = "foo"; 44 String childElement = "foochild"; 45 String prefix = "a"; 46 47 // Add test methods here, they have to start with 'test' name. 48 // for example: 49 // public void testHello() {} 50 51 String getXML() { 52 StringBuffer sbuffer = new StringBuffer(); 53 sbuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); 54 sbuffer.append("<" + rootElement + " xmlns:"); 55 sbuffer.append(prefix); 56 sbuffer.append("=\"" + namespaceURI + "\">"); 57 sbuffer.append("<" + prefix + ":" + childElement + ">"); 58 sbuffer.append("blahblah"); 59 sbuffer.append("</" + prefix + ":" + childElement + ">"); | 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package stream.XMLStreamReaderTest; 25 26 import java.io.InputStream; 27 28 import javax.xml.namespace.NamespaceContext; 29 import javax.xml.namespace.QName; 30 import javax.xml.stream.XMLInputFactory; 31 import javax.xml.stream.XMLStreamConstants; 32 import javax.xml.stream.XMLStreamReader; 33 34 import org.testng.Assert; 35 import org.testng.annotations.Listeners; 36 import org.testng.annotations.Test; 37 38 /* 39 * @summary Test StAX parser processes namespace. 40 */ 41 @Listeners({jaxp.library.BasePolicy.class}) 42 public class NamespaceTest { 43 44 String namespaceURI = "foobar.com"; 45 String rootElement = "foo"; 46 String childElement = "foochild"; 47 String prefix = "a"; 48 49 // Add test methods here, they have to start with 'test' name. 50 // for example: 51 // public void testHello() {} 52 53 String getXML() { 54 StringBuffer sbuffer = new StringBuffer(); 55 sbuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); 56 sbuffer.append("<" + rootElement + " xmlns:"); 57 sbuffer.append(prefix); 58 sbuffer.append("=\"" + namespaceURI + "\">"); 59 sbuffer.append("<" + prefix + ":" + childElement + ">"); 60 sbuffer.append("blahblah"); 61 sbuffer.append("</" + prefix + ":" + childElement + ">"); |