/** * Reads to the next descendant element with the specified local name and * namespace. * * @param xmlNamespace The namespace of the element you with to move to. * @param localName The local name of the element you wish to move to. * @throws XMLStreamException the XML stream exception */ public void readToDescendant(XmlNamespace xmlNamespace, String localName) throws XMLStreamException { readToDescendant(localName, EwsUtilities.getNamespaceUri(xmlNamespace)); }
/** * Writes the start element. * * @param xmlNamespace the XML namespace * @param localName the local name of the element * @throws XMLStreamException the XML stream exception */ public void writeStartElement(XmlNamespace xmlNamespace, String localName) throws XMLStreamException { String strPrefix = EwsUtilities.getNamespacePrefix(xmlNamespace); String strNameSpace = EwsUtilities.getNamespaceUri(xmlNamespace); this.xmlWriter.writeStartElement(strPrefix, localName, strNameSpace); }
/** * Determines whether current element is a end element. * * @param xmlNamespace the xml namespace * @param localName the local name * @return boolean */ public boolean isEndElement(XmlNamespace xmlNamespace, String localName) { boolean isEndElement = false; /* * if(localName.equals("Body")) { return true; } else */ if (this.presentEvent.isEndElement()) { EndElement endElement = this.presentEvent.asEndElement(); QName qName = endElement.getName(); isEndElement = qName.getLocalPart().equals(localName) && (qName.getPrefix().equals( EwsUtilities.getNamespacePrefix(xmlNamespace)) || qName.getNamespaceURI().equals( EwsUtilities.getNamespaceUri( xmlNamespace))); } return isEndElement; }
/** * Reads the attribute value. * * @param xmlNamespace The XML namespace. * @param attributeName Name of the attribute * @return Attribute Value * @throws Exception the exception */ public String readAttributeValue(XmlNamespace xmlNamespace, String attributeName) throws Exception { if (xmlNamespace == XmlNamespace.NotSpecified) { return this.readAttributeValue(attributeName); } else { QName qName = new QName(EwsUtilities.getNamespaceUri(xmlNamespace), attributeName); return readAttributeValue(qName); } }
/** * 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())); } } }
XmlElementNames.SOAPEnvelopeElementName)) || (!ewsXmlReader.getNamespaceUri().equals( EwsUtilities.getNamespaceUri(XmlNamespace.Soap)))) { throw new ServiceXmlDeserializationException("The Autodiscover service response was invalid.");
/** * Reads to the next descendant element with the specified local name and * namespace. * * @param xmlNamespace The namespace of the element you with to move to. * @param localName The local name of the element you wish to move to. * @throws XMLStreamException the XML stream exception */ public void readToDescendant(XmlNamespace xmlNamespace, String localName) throws XMLStreamException { readToDescendant(localName, EwsUtilities.getNamespaceUri(xmlNamespace)); }
/** * Writes the start element. * * @param xmlNamespace the XML namespace * @param localName the local name of the element * @throws XMLStreamException the XML stream exception */ public void writeStartElement(XmlNamespace xmlNamespace, String localName) throws XMLStreamException { String strPrefix = EwsUtilities.getNamespacePrefix(xmlNamespace); String strNameSpace = EwsUtilities.getNamespaceUri(xmlNamespace); this.xmlWriter.writeStartElement(strPrefix, localName, strNameSpace); }
/** * Determines whether current element is a end element. * * @param xmlNamespace the xml namespace * @param localName the local name * @return boolean */ public boolean isEndElement(XmlNamespace xmlNamespace, String localName) { boolean isEndElement = false; /* * if(localName.equals("Body")) { return true; } else */ if (this.presentEvent.isEndElement()) { EndElement endElement = this.presentEvent.asEndElement(); QName qName = endElement.getName(); isEndElement = qName.getLocalPart().equals(localName) && (qName.getPrefix().equals( EwsUtilities.getNamespacePrefix(xmlNamespace)) || qName.getNamespaceURI().equals( EwsUtilities.getNamespaceUri( xmlNamespace))); } return isEndElement; }
/** * Reads the attribute value. * * @param xmlNamespace The XML namespace. * @param attributeName Name of the attribute * @return Attribute Value * @throws Exception the exception */ public String readAttributeValue(XmlNamespace xmlNamespace, String attributeName) throws Exception { if (xmlNamespace == XmlNamespace.NotSpecified) { return this.readAttributeValue(attributeName); } else { QName qName = new QName(EwsUtilities.getNamespaceUri(xmlNamespace), attributeName); return readAttributeValue(qName); } }
/** * 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))); }
writer.writeAttributeValue("xmlns", EwsUtilities .getNamespacePrefix(XmlNamespace.Soap), EwsUtilities .getNamespaceUri(XmlNamespace.Soap)); writer.writeAttributeValue("xmlns", EwsUtilities.AutodiscoverSoapNamespacePrefix,
writer.writeStartElement(XmlNamespace.Soap, XmlElementNames.SOAPEnvelopeElementName); writer.writeAttributeValue("xmlns", EwsUtilities.getNamespacePrefix(XmlNamespace.Soap), EwsUtilities.getNamespaceUri(XmlNamespace.Soap)); writer.writeAttributeValue("xmlns", EwsUtilities.EwsXmlSchemaInstanceNamespacePrefix, EwsUtilities.EwsXmlSchemaInstanceNamespace);
/** * 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())); } } }
XmlElementNames.SOAPEnvelopeElementName)) || (!ewsXmlReader.getNamespaceUri().equals( EwsUtilities.getNamespaceUri(XmlNamespace.Soap)))) { throw new ServiceXmlDeserializationException("The Autodiscover service response was invalid.");
writer.writeAttributeValue("xmlns", EwsUtilities .getNamespacePrefix(XmlNamespace.Soap), EwsUtilities .getNamespaceUri(XmlNamespace.Soap)); writer.writeAttributeValue("xmlns", EwsUtilities.AutodiscoverSoapNamespacePrefix,
writer.writeStartElement(XmlNamespace.Soap, XmlElementNames.SOAPEnvelopeElementName); writer.writeAttributeValue("xmlns", EwsUtilities.getNamespacePrefix(XmlNamespace.Soap), EwsUtilities.getNamespaceUri(XmlNamespace.Soap)); writer.writeAttributeValue("xmlns", EwsUtilities.EwsXmlSchemaInstanceNamespacePrefix, EwsUtilities.EwsXmlSchemaInstanceNamespace);