Package javax.xml.stream

Examples of javax.xml.stream.XMLInputFactory.createXMLStreamReader()


        server.start();
        try {
            boolean gotException = false;
            boolean reachedDocumentElement = false;
            try {
                XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(
                        "<?xml version='1.0'?><!DOCTYPE root SYSTEM '" + server.getBaseURL() +
                        "dummy.dtd'><root/>"));
                try {
                    while (reader.hasNext()) {
                        if (reader.next() == XMLStreamConstants.START_ELEMENT) {
View Full Code Here


        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(
                new StringReader("<?xml version='1.0'?><root/>"));
        assertEquals("1.0", reader.getVersion());
        reader.next();
        try {
            reader.getVersion();
View Full Code Here

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(
                "<root><child xmlns=\"urn:ns\"/></root>"));
        reader.next();
        assertNull(reader.getPrefix());
        reader.next();
        assertNull(reader.getPrefix());
View Full Code Here

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(
                "<root xmlns=\"urn:ns\"/>"));
        reader.next();
        assertNull(reader.getNamespacePrefix(0));
    }
}
View Full Code Here

        Set/*<String>*/ prefixes = new HashSet();
        Set/*<String>*/ namespaceURIs = new HashSet();
        prefixes.add("");
        try {
            ScopedNamespaceContext refNc = new ScopedNamespaceContext();
            XMLStreamReader reader = factory.createXMLStreamReader(in);
            int depth = 0;
            int eventType;
            while ((eventType = reader.getEventType()) != XMLStreamReader.END_DOCUMENT) {
                if (eventType == XMLStreamReader.START_ELEMENT) {
                    refNc.startScope();
View Full Code Here

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new ByteArrayInputStream(
                "<?xml version='1.0' encoding='iso-8859-15'?><root/>".getBytes("iso-8859-15")));
        assertEquals("iso-8859-15", reader.getCharacterEncodingScheme());
        reader.next();
        try {
            reader.getCharacterEncodingScheme();
View Full Code Here

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new StringReader("<root/>"));
        while (reader.next() != XMLStreamReader.END_DOCUMENT) {
            // Just loop
        }
        try {
            reader.next();
View Full Code Here

        super(staxImpl);
    }

    protected void runTest() throws Throwable {
        XMLInputFactory factory = staxImpl.newNormalizedXMLInputFactory();
        XMLStreamReader reader = factory.createXMLStreamReader(new ByteArrayInputStream(
                "<root/>".getBytes("ISO-8859-1")), "ISO-8859-1");
        assertEquals("ISO-8859-1", reader.getEncoding());
    }
}
View Full Code Here

         String mavenMetadataXml = http.get(url);

         StringReader sr = new StringReader(mavenMetadataXml);

         XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
         XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(sr);

         String version = null;

         while (version == null && xmlStreamReader.hasNext())
         {
View Full Code Here

   public DataSources parse(InputStream xmlInputStream) throws Exception
   {
      XMLStreamReader reader = null;

      XMLInputFactory inputFactory = XMLInputFactory.newInstance();
      reader = inputFactory.createXMLStreamReader(xmlInputStream);
      try
      {
         return parse(reader);
      }
      finally
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.