/** * Determines whether current element is a start element. * * @param xmlNamespace the xml namespace * @param localName the local name * @return true for matching start element; false otherwise. */ public boolean isStartElement(XmlNamespace xmlNamespace, String localName) { return this.isStartElement() && StringUtils.equals(getLocalName(), localName) && ( StringUtils.equals(getNamespacePrefix(), EwsUtilities.getNamespacePrefix(xmlNamespace)) || StringUtils.equals(getNamespaceUri(), EwsUtilities.getNamespaceUri(xmlNamespace))); }
/** * Read XML element. * * @param xmlNamespace The XML namespace * @param localName Name of the local * @param nodeType Type of the node * @throws Exception the exception */ private void internalReadElement(XmlNamespace xmlNamespace, String localName, XmlNodeType nodeType) throws Exception { if (xmlNamespace == XmlNamespace.NotSpecified) { this.internalReadElement("", localName, nodeType); } else { this.read(nodeType); if ((!this.getLocalName().equals(localName)) || (!this.getNamespaceUri().equals(EwsUtilities .getNamespaceUri(xmlNamespace)))) { throw new ServiceXmlDeserializationException( String .format( "An element node '%s:%s' of the type %s was expected, but node '%s' of type %s was found.", EwsUtilities .getNamespacePrefix( xmlNamespace), localName, nodeType.toString(), this .getName(), this.getNodeType() .toString())); } } }
/** * Parses the message xml. * * @param reader the reader * @throws Exception the exception * @throws ServiceXmlDeserializationException the service xml deserialization exception */ private void parseMessageXml(EwsXmlReader reader) throws Exception, ServiceXmlDeserializationException, Exception { // E14:172881: E12 and E14 return the MessageXml element in different // namespaces (types namespace for E12, errors namespace in E14). To // avoid this problem, the parser will match the namespace from the // start and end elements. XmlNamespace elementNS = EwsUtilities.getNamespaceFromUri(reader.getNamespaceUri()); if (!reader.isEmptyElement()) { do { reader.read(); if (reader.isStartElement() && !reader.isEmptyElement()) { String localName = reader.getLocalName(); if (localName.equals(XmlElementNames.Value)) { this.errorDetails.put(reader .readAttributeValue(XmlAttributeNames.Name), reader.readElementValue()); } } } while (!reader .isEndElement(elementNS, XmlElementNames.MessageXml)); } else { reader.read(); } }
|| (!ewsXmlReader.getLocalName().equals( XmlElementNames.SOAPEnvelopeElementName)) || (!ewsXmlReader.getNamespaceUri().equals( EwsUtilities.getNamespaceUri(XmlNamespace.Soap)))) { throw new ServiceXmlDeserializationException("The Autodiscover service response was invalid.");
.getNamespaceFromUri(reader.getNamespaceUri()); if (soapNamespace == XmlNamespace.NotSpecified) { return null;
/** * Determines whether current element is a start element. * * @param xmlNamespace the xml namespace * @param localName the local name * @return true for matching start element; false otherwise. */ public boolean isStartElement(XmlNamespace xmlNamespace, String localName) { return this.isStartElement() && StringUtils.equals(getLocalName(), localName) && ( StringUtils.equals(getNamespacePrefix(), EwsUtilities.getNamespacePrefix(xmlNamespace)) || StringUtils.equals(getNamespaceUri(), EwsUtilities.getNamespaceUri(xmlNamespace))); }
/** * Read XML element. * * @param xmlNamespace The XML namespace * @param localName Name of the local * @param nodeType Type of the node * @throws Exception the exception */ private void internalReadElement(XmlNamespace xmlNamespace, String localName, XmlNodeType nodeType) throws Exception { if (xmlNamespace == XmlNamespace.NotSpecified) { this.internalReadElement("", localName, nodeType); } else { this.read(nodeType); if ((!this.getLocalName().equals(localName)) || (!this.getNamespaceUri().equals(EwsUtilities .getNamespaceUri(xmlNamespace)))) { throw new ServiceXmlDeserializationException( String .format( "An element node '%s:%s' of the type %s was expected, but node '%s' of type %s was found.", EwsUtilities .getNamespacePrefix( xmlNamespace), localName, nodeType.toString(), this .getName(), this.getNodeType() .toString())); } } }
/** * Parses the message xml. * * @param reader the reader * @throws Exception the exception * @throws ServiceXmlDeserializationException the service xml deserialization exception */ private void parseMessageXml(EwsXmlReader reader) throws Exception, ServiceXmlDeserializationException, Exception { // E14:172881: E12 and E14 return the MessageXml element in different // namespaces (types namespace for E12, errors namespace in E14). To // avoid this problem, the parser will match the namespace from the // start and end elements. XmlNamespace elementNS = EwsUtilities.getNamespaceFromUri(reader.getNamespaceUri()); if (!reader.isEmptyElement()) { do { reader.read(); if (reader.isStartElement() && !reader.isEmptyElement()) { String localName = reader.getLocalName(); if (localName.equals(XmlElementNames.Value)) { this.errorDetails.put(reader .readAttributeValue(XmlAttributeNames.Name), reader.readElementValue()); } } } while (!reader .isEndElement(elementNS, XmlElementNames.MessageXml)); } else { reader.read(); } }
|| (!ewsXmlReader.getLocalName().equals( XmlElementNames.SOAPEnvelopeElementName)) || (!ewsXmlReader.getNamespaceUri().equals( EwsUtilities.getNamespaceUri(XmlNamespace.Soap)))) { throw new ServiceXmlDeserializationException("The Autodiscover service response was invalid.");
.getNamespaceFromUri(reader.getNamespaceUri()); if (soapNamespace == XmlNamespace.NotSpecified) { return null;