本文整理汇总了C#中System.Xml.XmlDictionaryWriter.WriteXmlnsAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.WriteXmlnsAttribute方法的具体用法?C# XmlDictionaryWriter.WriteXmlnsAttribute怎么用?C# XmlDictionaryWriter.WriteXmlnsAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryWriter
的用法示例。
在下文中一共展示了XmlDictionaryWriter.WriteXmlnsAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnWriteStartEnvelope
protected override void OnWriteStartEnvelope(XmlDictionaryWriter writer)
{
base.OnWriteStartEnvelope(writer);
writer.WriteXmlnsAttribute("addata", "http://schemas.microsoft.com/2008/1/ActiveDirectory/Data");
writer.WriteXmlnsAttribute("ad", "http://schemas.microsoft.com/2008/1/ActiveDirectory");
writer.WriteXmlnsAttribute("xsd", "http://www.w3.org/2001/XMLSchema");
writer.WriteXmlnsAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance");
if (writer.LookupPrefix("http://www.w3.org/2005/08/addressing") == null)
{
writer.WriteXmlnsAttribute("wsa", "http://www.w3.org/2005/08/addressing");
}
}
示例2: AddPrefixIfNeeded
protected virtual void AddPrefixIfNeeded(XmlDictionaryWriter writer, string prefix, string ns)
{
if (writer.LookupPrefix(ns) == null)
{
writer.WriteXmlnsAttribute(prefix, ns);
}
}
示例3: OnWriteStartHeader
protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
writer.WriteStartElement(this.Name, this.Namespace);
writer.WriteXmlnsAttribute(null, _notUnderstoodNs);
writer.WriteStartAttribute(Message12Strings.QName);
writer.WriteQualifiedName(_notUnderstoodName, _notUnderstoodNs);
writer.WriteEndAttribute();
}
示例4: AddNamespaceDeclaration
internal static void AddNamespaceDeclaration(XmlDictionaryWriter writer, string prefix, XmlDictionaryString ns)
{
string p = writer.LookupPrefix(ns.Value);
if (p == null || p != prefix)
{
writer.WriteXmlnsAttribute(prefix, ns);
}
}
示例5: EnsureNamespaceDefined
internal static string EnsureNamespaceDefined(XmlDictionaryWriter writer, XmlDictionaryString ns, string defaultPrefix)
{
string p = writer.LookupPrefix(ns.Value);
if (p == null)
{
writer.WriteXmlnsAttribute(defaultPrefix, ns);
p = defaultPrefix;
}
return p;
}
示例6: WriteHeader
private void WriteHeader(XmlDictionaryWriter writer)
{
writer.WriteStartElement("wsse", "UsernameToken", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
writer.WriteXmlnsAttribute("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
writer.WriteStartElement("wsse", "Username", null);
writer.WriteString(SystemUser);
writer.WriteEndElement();//End Username
writer.WriteStartElement("wsse", "Password", null);
writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
writer.WriteString(SystemPassword);
writer.WriteEndElement();//End Password
writer.WriteEndElement();//End UsernameToken
writer.Flush();
}
示例7: WriteContent
public void WriteContent(XmlDictionaryWriter writer)
{
if ((this.isoLevel != System.Transactions.IsolationLevel.Unspecified) || (this.localTxId != Guid.Empty))
{
writer.WriteXmlnsAttribute("mstx", XD.DotNetAtomicTransactionExternalDictionary.Namespace);
}
writer.WriteStartElement(this.coordinationStrings.Prefix, this.coordinationXmlDictionaryStrings.Identifier, this.coordinationXmlDictionaryStrings.Namespace);
if (this.unknownIdentifierAttributes != null)
{
foreach (System.Xml.XmlNode node in this.unknownIdentifierAttributes)
{
node.WriteTo(writer);
}
}
writer.WriteString(this.contextId);
writer.WriteEndElement();
if (this.expiresPresent)
{
writer.WriteStartElement(this.coordinationXmlDictionaryStrings.Expires, this.coordinationXmlDictionaryStrings.Namespace);
if (this.unknownExpiresAttributes != null)
{
foreach (System.Xml.XmlNode node2 in this.unknownExpiresAttributes)
{
node2.WriteTo(writer);
}
}
writer.WriteValue((long) this.expiration);
writer.WriteEndElement();
}
writer.WriteStartElement(this.coordinationXmlDictionaryStrings.CoordinationType, this.coordinationXmlDictionaryStrings.Namespace);
writer.WriteString(this.atomicTransactionXmlDictionaryStrings.Namespace);
writer.WriteEndElement();
this.registrationRef.WriteTo(MessagingVersionHelper.AddressingVersion(this.protocolVersion), writer, this.coordinationXmlDictionaryStrings.RegistrationService, this.coordinationXmlDictionaryStrings.Namespace);
if (this.isoLevel != System.Transactions.IsolationLevel.Unspecified)
{
writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.IsolationLevel, XD.DotNetAtomicTransactionExternalDictionary.Namespace);
writer.WriteValue((int) this.isoLevel);
writer.WriteEndElement();
}
if (this.isoFlags != 0)
{
writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.IsolationFlags, XD.DotNetAtomicTransactionExternalDictionary.Namespace);
writer.WriteValue((int) this.isoFlags);
writer.WriteEndElement();
}
if (!string.IsNullOrEmpty(this.description))
{
writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.Description, XD.DotNetAtomicTransactionExternalDictionary.Namespace);
writer.WriteValue(this.description);
writer.WriteEndElement();
}
if (this.localTxId != Guid.Empty)
{
writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.LocalTransactionId, XD.DotNetAtomicTransactionExternalDictionary.Namespace);
writer.WriteValue(this.localTxId);
writer.WriteEndElement();
}
if (this.propToken != null)
{
OleTxTransactionHeader.WritePropagationTokenElement(writer, this.propToken);
}
if (this.unknownData != null)
{
int count = this.unknownData.Count;
for (int i = 0; i < count; i++)
{
this.unknownData[i].WriteTo(writer);
}
}
}
示例8: OnWriteStartHeader
protected override void OnWriteStartHeader(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
writer.WriteStartElement("wsse", Name, Namespace);
writer.WriteXmlnsAttribute("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
writer.WriteAttributeString("s:mustUnderstand", "1");
}
示例9: OnWriteStartBody
protected override void OnWriteStartBody(XmlDictionaryWriter writer)
{
base.OnWriteStartBody(writer);
writer.WriteXmlnsAttribute("wsen", "http://schemas.xmlsoap.org/ws/2004/09/enumeration");
writer.WriteXmlnsAttribute("adlq", "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/LdapQuery");
}
示例10: OnWriteHeaderContents
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
writer.WriteStartElement("r", "FaultCode", this.Namespace);
writer.WriteXmlnsAttribute(null, this.Namespace);
writer.WriteQualifiedName(this.Subcode, this.Namespace);
writer.WriteEndElement();
bool flag = base.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;
if (flag)
{
writer.WriteStartElement("r", XD.Message12Dictionary.FaultDetail, this.DictionaryNamespace);
}
this.fault.WriteDetail(writer);
if (flag)
{
writer.WriteEndElement();
}
}
示例11: WriteHeader
/// <summary>
/// Overwrites the default SOAP Security Header values generated by WCF with
/// those required by the UserService which implements WSE 2.0. This is required
/// for interoperability between a WCF Client and a WSE 2.0 Service.
/// </summary>
/// <param name="writer"><see cref="XmlDictionaryWriter"/></param>
private void WriteHeader(XmlDictionaryWriter writer)
{
// Create the Nonce
byte[] nonce = GenerateNonce();
// Create the Created Date
string created = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
// Create the WSSE Security Header, starting with the Username Element
writer.WriteStartElement("wsse", "UsernameToken", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
writer.WriteXmlnsAttribute("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
writer.WriteStartElement("wsse", "Username", null);
writer.WriteString(config.Username);
writer.WriteEndElement();
// Add the Password Element
writer.WriteStartElement("wsse", "Password", null);
writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest");
writer.WriteString(GeneratePasswordDigest(nonce, created, config.Password));
writer.WriteEndElement();
// Add the Nonce Element
writer.WriteStartElement("wsse", "Nonce", null);
writer.WriteAttributeString("EncodingType", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary");
writer.WriteBase64(nonce, 0, nonce.Length);
writer.WriteEndElement();
// Lastly, add the Created Element
writer.WriteStartElement("wsu", "Created", null);
writer.WriteString(created);
writer.WriteEndElement();
writer.WriteEndElement();
writer.Flush();
}
开发者ID:PearsonDevelopersNetwork,项目名称:LearningStudio-Libraries-SIS-CSharp,代码行数:40,代码来源:SecurityHeader.cs
示例12: OnWriteHeaderContents
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
writer.WriteStartElement(WsrmFeb2005Strings.Prefix, WsrmFeb2005Strings.FaultCode, this.Namespace);
writer.WriteXmlnsAttribute(null, this.Namespace);
writer.WriteQualifiedName(this.Subcode, this.Namespace);
writer.WriteEndElement();
bool wsrm11 = this.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;
if (wsrm11)
{
writer.WriteStartElement(WsrmFeb2005Strings.Prefix, XD.Message12Dictionary.FaultDetail, this.DictionaryNamespace);
}
this.fault.WriteDetail(writer);
if (wsrm11)
{
writer.WriteEndElement();
}
}
示例13: OnWriteStartBody
protected override void OnWriteStartBody(XmlDictionaryWriter writer)
{
base.OnWriteStartBody(writer);
writer.WriteXmlnsAttribute("wsen", "http://schemas.xmlsoap.org/ws/2004/09/enumeration");
}
示例14: WriteHeader
private void WriteHeader(XmlDictionaryWriter writer)
{
//Begin Variable setups
var nonce = new byte[64];
RandomNumberGenerator.Create().GetBytes(nonce);
string created = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss.msZ");
//End Variable setups
// Write Namespace attributes on the "wsse:Security" Node
writer.WriteXmlnsAttribute("wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
writer.WriteXmlnsAttribute("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
// Begin UsernameToken Holder for UserName, Password, Nonce, and Created Nodes
writer.WriteStartElement("wsse", "UsernameToken", null);
writer.WriteAttributeString("wsu", "Id", null, "UsernameToken-2");
//Begin Username
writer.WriteStartElement("wsse", "Username", null);
writer.WriteString(SystemUser);
writer.WriteEndElement();
//End Username
//Begin Password Plaintext
writer.WriteStartElement("wsse", "Password", null);
if (this.SystermPasswordType == PasswordType.ClearText)
{
writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
writer.WriteString(SystemPassword);
}
else if (this.SystermPasswordType == PasswordType.Digest)
{
writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest");
writer.WriteString(ComputePasswordDigest(SystemPassword, nonce, created));
}
writer.WriteEndElement();
//End Password Plaintext
//Begin Password Nonce
writer.WriteStartElement("wsse", "Nonce", null);
writer.WriteAttributeString("EncodingType", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary");
writer.WriteBase64(nonce, 0, nonce.Length);
writer.WriteEndElement();
//End Password Nonce
//Begin Created
writer.WriteStartElement("wsu", "Created", null);
writer.WriteString(created);
writer.WriteEndElement();
//End Created
writer.WriteEndElement();
// Begin UsernameToken Holder
writer.Flush();
}
示例15: WriteNode
/// <summary>
/// This method is used to write a XML node to a XML writer.
/// </summary>
/// <param name="node">Specify the XML node.</param>
/// <param name="writer">Specify the XML writer.</param>
private void WriteNode(XmlNode node, XmlDictionaryWriter writer)
{
writer.WriteStartElement(node.Name);
foreach (XmlAttribute xmlAttribute in node.Attributes)
{
writer.WriteAttributeString(xmlAttribute.Name, xmlAttribute.Value);
if (!string.IsNullOrEmpty(xmlAttribute.Prefix))
{
writer.WriteXmlnsAttribute(xmlAttribute.Prefix, xmlAttribute.NamespaceURI);
}
}
if (node.Name == "SubRequestData")
{
string base64 = node.InnerText;
byte[] bytes = Convert.FromBase64String(base64);
writer.WriteBase64(bytes, 0, bytes.Length);
}
else
{
foreach (XmlNode childNode in node.ChildNodes)
{
this.WriteNode(childNode, writer);
}
}
writer.WriteEndElement();
}