Package javax.xml.stream

Examples of javax.xml.stream.XMLStreamReader


                    sourceNodeList.add(((OMElement) o).cloneOMElement());
                }
            } else if (o instanceof String) {
                String soap = (String) o;
                try {
                    XMLStreamReader xmlReader =
                            StAXUtils.createXMLStreamReader(new ByteArrayInputStream(soap.getBytes()));
                    StAXBuilder builder = new StAXSOAPModelBuilder(xmlReader);
                    OMElement elem = builder.getDocumentElement();
                    elem.build();
                    if (elem instanceof SOAPEnvelope) {
View Full Code Here


            }
            XMLToObjectMapper xmlToObject =
                    getXmlToObjectMapper(connection.getContentType());
            InputStream inputStream = connection.getInputStream();
            try {
                XMLStreamReader parser = XMLInputFactory.newInstance().
                        createXMLStreamReader(inputStream);
                OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(parser);
                OMElement omElem = builder.getDocumentElement();

                // detach from URL connection and keep in memory
View Full Code Here

        for (Map.Entry<String,Entry> mapEntry : entries.entrySet()) {
            testConfig.addEntry(mapEntry.getKey(), mapEntry.getValue());
        }

        XMLStreamReader parser = null;
        if (contentString != null) {
            parser = StAXUtils.createXMLStreamReader(new StringReader(contentString));
        } else if (contentFile != null) {
            parser = StAXUtils.createXMLStreamReader(new FileInputStream(contentFile));
        }
View Full Code Here

  public static Type isXml(Reader reader) throws TransformationException {
    Type type = Type.ELEMENT;
    XMLInputFactory inputFactory = XMLInputFactory.newInstance();
        try{       
             XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(reader);
             int event = xmlReader.getEventType();
           if  (event == XMLEvent.START_DOCUMENT && xmlReader.getLocation().getColumnNumber() != 1) {
             type = Type.DOCUMENT;
           }
             while (xmlReader.hasNext()) {
               xmlReader.next();
             }
        } catch (Exception e){
            throw new TransformationException(e, CorePlugin.Util.getString("invalid_string")); //$NON-NLS-1$
        } finally {
          try {
View Full Code Here

    }
  }

  public static String getEncoding(InputStream is) {
    XMLInputFactory factory = XMLInputFactory.newInstance();
    XMLStreamReader reader;
    try {
      reader = factory.createXMLStreamReader(is);
      return reader.getEncoding();
    } catch (XMLStreamException e) {
      return null;
    } finally {
      try {
        is.close();
View Full Code Here


        try {
            OMElement omElement = echCheckEligibility1.getOMElement(CheckEligibility1.MY_QNAME, OMAbstractFactory.getSOAP12Factory());
            String omElementString = omElement.toStringWithConsume();
            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
            CheckEligibility1 result = CheckEligibility1.Factory.parse(xmlReader);
            assertEquals(result.getAtbRequestCheckEligibility().getCardNumber(), "carnumber");
            assertEquals(result.getAtbRequestCheckEligibility().getClientId(), "clientid");
            assertEquals(result.getAtbRequestCheckEligibility().getExpirationDate(), "date");
            assertEquals(result.getAtbRequestCheckEligibility().getNameAsOnCard(), "cardname");
View Full Code Here


        try {
            OMElement omElement = echCheckEligibility2.getOMElement(CheckEligibility2.MY_QNAME, OMAbstractFactory.getSOAP12Factory());
            String omElementString = omElement.toStringWithConsume();
            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
            CheckEligibility2 result = CheckEligibility2.Factory.parse(xmlReader);
            assertEquals(result.getAtbRequestCheckEligibility()[0].getCardNumber(), "carnumber");
            assertEquals(result.getAtbRequestCheckEligibility()[0].getClientId(), "clientid");
            assertEquals(result.getAtbRequestCheckEligibility()[0].getExpirationDate(), "date");
            assertEquals(result.getAtbRequestCheckEligibility()[0].getNameAsOnCard(), "cardname");
View Full Code Here

        try {
            OMElement omElement = element1.getOMElement(Element1.MY_QNAME,OMAbstractFactory.getOMFactory());
            String omElementString = omElement.toStringWithConsume();
            System.out.println("OM String ==> " + omElementString);
            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
            Element1 result = Element1.Factory.parse(xmlReader);
            assertNotNull(result);
        } catch (ADBException e) {
            fail();
        } catch (XMLStreamException e) {
View Full Code Here

        try {
            OMElement omElement = element1.getOMElement(Element1.MY_QNAME,OMAbstractFactory.getOMFactory());
            String omElementString = omElement.toStringWithConsume();
            System.out.println("OM String ==> " + omElementString);
            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
            Element1 result = Element1.Factory.parse(xmlReader);
            assertNotNull(result);
            assertNotNull(result.getElement1());
            assertNotNull(result.getElement1().getElement1());
        } catch (ADBException e) {
View Full Code Here

        try {
            OMElement omElement = element2.getOMElement(Element2.MY_QNAME,OMAbstractFactory.getOMFactory());
            String omElmentString = omElement.toStringWithConsume();
            System.out.println("OM element ==>" + omElmentString);
            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElmentString.getBytes()));
            Element2 result = Element2.Factory.parse(xmlReader);
            assertEquals(result.getElement2().getParam1(),"test string1");
            assertEquals(result.getElement2().getElement2().getParam1(), "test string2");
        } catch (ADBException e) {
            fail();
View Full Code Here

TOP

Related Classes of javax.xml.stream.XMLStreamReader

Copyright © 2018 www.massapicom. 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.