Parses a ListBucket response XML document from an input stream.

@param inputStream
XML data input stream.
@return the XML handler object populated with data parsed from the XML
stream.
@throws SdkClientException
779299
public ListBucketHandler parseListBucketObjectsResponse(InputStream inputStream, final boolean shouldSDKDecodeResponse)
            throws IOException {
        ListBucketHandler handler = new ListBucketHandler(shouldSDKDecodeResponse);
        parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream));

        return handler;
    }
693503
public T get()
    throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
           InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
           InternalException {
    if (ex == null) {
      return type;
    }

    if (ex instanceof InvalidBucketNameException) {
      throw (InvalidBucketNameException) ex;
    } else if (ex instanceof NoSuchAlgorithmException) {
      throw (NoSuchAlgorithmException) ex;
    } else if (ex instanceof InsufficientDataException) {
      throw (InsufficientDataException) ex;
    } else if (ex instanceof IOException) {
      throw (IOException) ex;
    } else if (ex instanceof InvalidKeyException) {
      throw (InvalidKeyException) ex;
    } else if (ex instanceof NoResponseException) {
      throw (NoResponseException) ex;
    } else if (ex instanceof XmlPullParserException) {
      throw (XmlPullParserException) ex;
    } else if (ex instanceof ErrorResponseException) {
      throw (ErrorResponseException) ex;
    } else {
      throw (InternalException) ex;
    }
  }
765386
public static List<?> xls2List(String xmlPath, InputStream inputStream) throws Exception {
        return XlsUtil.xls2List(xmlPath, inputStream);
    }
487361
public synchronized Node parse(InputSource source) throws IOException,SAXException
    {
        Handler handler=new Handler();
        XMLReader reader=_parser.getXMLReader();
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        reader.setEntityResolver(handler);
        if(log.isDebugEnabled())
            log.debug("parsing: sid="+source.getSystemId()+",pid="+source.getPublicId());
        _parser.parse(source,handler);
        if(handler._error!=null)
            throw handler._error;
        Node doc=(Node)handler._top.get(0);
        handler.clear();
        return doc;
    }
1254026
public void parse(InputSource source, DefaultHandler dh) throws SAXException, IOException
    {
        XMLReader reader = getXMLReader();
        reader.setContentHandler(dh);
        reader.parse(source);
    }
919565
private void parseResponse(InputStream inputStream) {

        try {
            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
            Document doc = dBuilder.parse(inputStream);
            doc.getDocumentElement().normalize();

            NodeList nodes = doc.getElementsByTagName("place");

            for (int i = 0; i < nodes.getLength(); i++) {
                Node node = nodes.item(i);

                if (node.getNodeType() == Node.ELEMENT_NODE) {
                    Element element = (Element) node;
                    _woeid = getValue("woeid", element);
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
592999
@Override
	public Object parse(String source) throws Exception {
		DocumentBuilder builder = builderFactory.newDocumentBuilder();
		InputSource is = new InputSource(new StringReader(source));
		Node node = builder.parse(is).getFirstChild();
		LinkedHashMap<String, Object> map = new LinkedHashMap<>();
		return copyChildren("xml", node, map);
	}
641806
public static DeploymentDescriptor fromXml(InputStream inputStream) {
        try {
            Unmarshaller unmarshaller = getContext().createUnmarshaller();
            unmarshaller.setSchema(schema);
            DeploymentDescriptor descriptor = (DeploymentDescriptor) unmarshaller.unmarshal(inputStream);

            return descriptor;
        } catch (Exception e) {
            throw new RuntimeException("Unable to read deployment descriptor from xml", e);
        }
    }
877116
public static AppEngineDescriptor parse(InputStream in) throws IOException, SAXException {
    Preconditions.checkNotNull(in, "Null input");
    try {
      DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
      documentBuilderFactory.setNamespaceAware(true);
      return new AppEngineDescriptor(documentBuilderFactory.newDocumentBuilder().parse(in));
    } catch (ParserConfigurationException exception) {
      throw new SAXException("Cannot parse appengine-web.xml", exception);
    }
  }
567961
@Override
    public InputStream GetObjectXML() throws ObjectIntegrityException,
                                             StreamIOException, UnsupportedTranslationException, ServerException {
        ReadableByteArrayOutputStream bytes = new ReadableByteArrayOutputStream(4096);
        m_translator.serialize(m_obj,
                               bytes,
                               m_storageFormat,
                               "UTF-8",
                               DOTranslationUtility.SERIALIZE_STORAGE_INTERNAL);
        return bytes.toInputStream();
    }
965384
public synchronized Node parse(InputStream in) throws IOException,SAXException
    {
        Handler handler=new Handler();
        XMLReader reader=_parser.getXMLReader();
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        reader.setEntityResolver(handler);
        _parser.parse(new InputSource(in),handler);
        if(handler._error!=null)
            throw handler._error;
        Node doc=(Node)handler._top.get(0);
        handler.clear();
        return doc;
    }
994525
public Object parse(InputStream inputStream) {
        if (inputStream == null) {
            throw new IllegalArgumentException("inputStream must not be null");
        }

        Object content;
        JsonParser parser = createParser();
        content = parser.parse(inputStream);
        return content;
    }
1370418
public AmazonWebServiceResponse<String> handle(HttpResponse response) throws Exception {
        AmazonWebServiceResponse<String> awsResponse = parseResponseMetadata(response);

        int bytesRead;
        byte[] buffer = new byte[1024];
        StringBuilder builder = new StringBuilder();
        InputStream content = response.getContent();
        while ((bytesRead = content.read(buffer)) > 0) {
            builder.append(new String(buffer, 0, bytesRead, StringUtils.UTF8));
        }
        awsResponse.setResult(builder.toString());

        return awsResponse;
    }
537448
public AssemblyData parse(InputStream inputStream) throws GrokParseException {
        try (InputStream schema = FileUtils.getResourceAsStream(GROK_SCHEMA)) {
            final GrokHandler handler = new GrokHandler();
            final SAXParser saxParser = XmlUtils.buildSecureSaxParser(schema);
            final XMLReader xmlReader = saxParser.getXMLReader();
            xmlReader.setErrorHandler(new GrokErrorHandler());
            xmlReader.setContentHandler(handler);
            try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) {
                final InputSource in = new InputSource(reader);
                xmlReader.parse(in);
                return handler.getAssemblyData();
            }
        } catch (ParserConfigurationException | FileNotFoundException ex) {
            LOGGER.debug("", ex);
            throw new GrokParseException(ex);
        } catch (SAXException ex) {
            if (ex.getMessage().contains("Cannot find the declaration of element 'assembly'.")) {
                throw new GrokParseException("Malformed grok xml?", ex);
            } else {
                LOGGER.debug("", ex);
                throw new GrokParseException(ex);
            }
        } catch (IOException ex) {
            LOGGER.debug("", ex);
            throw new GrokParseException(ex);
        }
    }
135824
public static Element parse(InputStream xmlStream, DocumentBuilder builder) throws IOException
   {
      try
      {
         Document doc;
         synchronized (builder) //synchronize to prevent concurrent parsing on the same DocumentBuilder
         {
            doc = builder.parse(xmlStream);
         }
         return doc.getDocumentElement();
      }
      catch (SAXException se)
      {
         throw new IOException(se.toString());
      }
      finally
      {
         xmlStream.close();
      }
   }
60697
public static Map<String,List<ProtocolConfiguration>> parse(InputStream input) throws Exception {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false); // for now
        DocumentBuilder builder=factory.newDocumentBuilder();
        Document document=builder.parse(input);
        Element root=document.getDocumentElement();
        return parse(root);
    }
1290948
public <T> JSONAPIDocument<List<T>> readDocumentCollection(InputStream dataStream, Class<T> clazz) {
		try {
			resourceCache.init();

			JsonNode rootNode = objectMapper.readTree(dataStream);

			// Validate
			ValidationUtils.ensureNotError(objectMapper, rootNode);
			ValidationUtils.ensureValidResource(rootNode);

			JsonNode dataNode = rootNode.get(DATA);

			// Parse data node without handling relationships
			List<T> resourceList = new ArrayList<>();

			if (dataNode != null && dataNode.isArray()) {
				for (JsonNode element : dataNode) {
					T pojo = readObject(element, clazz, false);
					resourceList.add(pojo);
				}
			}

			// Parse all included resources
			resourceCache.cache(parseIncluded(rootNode));

			// Connect data node's relationships now that all resources have been parsed
			for (int i = 0; i < resourceList.size(); i++) {
				JsonNode source = dataNode != null && dataNode.isArray() ? dataNode.get(i) : null;
				T resourceObject = resourceList.get(i);
				if (source != null && resourceObject != null) {
					handleRelationships(source, resourceObject);
				}
			}

			JSONAPIDocument<List<T>> result = new JSONAPIDocument<>(resourceList, objectMapper);

			// Handle top-level meta
			if (rootNode.has(META)) {
				result.setMeta(mapMeta(rootNode.get(META)));
			}

			// Handle top-level links
			if (rootNode.has(LINKS)) {
				result.setLinks(new Links(mapLinks(rootNode.get(LINKS))));
			}

			return result;
		} catch (RuntimeException e) {
			throw e;
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			resourceCache.clear();
		}
	}