本文整理汇总了C#中System.Xml.XmlWriter类的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter类的具体用法?C# XmlWriter怎么用?C# XmlWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlWriter类属于System.Xml命名空间,在下文中一共展示了XmlWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WriteTo
// Methods
internal virtual void WriteTo( XmlWriter xmlWriter )
{
xmlWriter.WriteStartElement( XmlDiff.Prefix, "descriptor", XmlDiff.NamespaceUri );
xmlWriter.WriteAttributeString( "opid", _operationID.ToString() );
xmlWriter.WriteAttributeString( "type", Type );
xmlWriter.WriteEndElement();
}
开发者ID:Podracer,项目名称:DAE-notepad,代码行数:8,代码来源:OperationDescriptor.cs
示例2: WriteXml
internal void WriteXml(XmlWriter writer)
{
writer.WriteAttributeString("classCode", ClassCode);
its.TemplateSignpost(templateId + "#" + templateText, writer);
writeXML(writer);
if (assignedPerson != null)
{
writer.WriteStartElement("assignedPerson");
assignedPerson.TemplateId = templateId;
assignedPerson.TemplateText = "assignedPerson";
assignedPerson.WriteXml(writer);
writer.WriteEndElement();
}
if (assignedDevice != null)
{
writer.WriteStartElement("assignedAuthoringDevice");
assignedDevice.TemplateId = templateId;
assignedDevice.TemplateText = "assignedAuthoringDevice";
assignedDevice.WriteXml(writer);
writer.WriteEndElement();
}
if (representedOrganisation != null)
{
writer.WriteStartElement("representedOrganization");
representedOrganisation.TemplateId = templateId;
representedOrganisation.TemplateText = "representedOrganization";
representedOrganisation.WriteXml(writer);
writer.WriteEndElement();
}
}
开发者ID:nagyist,项目名称:cdaapi_core,代码行数:34,代码来源:r_Generic.cs
示例3: SerializeNetwork
public override void SerializeNetwork(XmlWriter xmlWriter)
{
base.SerializeNetwork(xmlWriter);
var expander = ControlElements[0] as SliderExpanderDouble;
if (expander == null) return;
xmlWriter.WriteStartAttribute("SliderMax");
xmlWriter.WriteValue(expander.SliderMax);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderMin");
xmlWriter.WriteValue(expander.SliderMin);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderValue");
xmlWriter.WriteValue(expander.SliderValue);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("SliderStep");
xmlWriter.WriteValue(expander.SliderStep);
xmlWriter.WriteEndAttribute();
xmlWriter.WriteStartAttribute("IsExpanded");
xmlWriter.WriteValue(expander.IsExpanded);
xmlWriter.WriteEndAttribute();
}
开发者ID:aquarius20th,项目名称:CSharp_TUM.CMS.VPLControl,代码行数:27,代码来源:DoubleSlider.cs
示例4: Transform
/// <summary>
/// Applies the transformation from the reader to the writer
/// </summary>
/// <param name="reader"></param>
/// <param name="writer"></param>
public void Transform(XmlReader reader, XmlWriter writer) {
Contract.Requires(reader != null);
Contract.Requires(writer != null);
while (reader.Read())
this.WriteNodeSingle(reader, writer);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:12,代码来源:XmlTraverserBase.cs
示例5: SanitizerNodeVisited
void SanitizerNodeVisited(string nodeName, HtmlNode node, XmlWriter writer)
{
if (nodeName == "img" && node.Attributes["src"] != null && node.Attributes["src"].Value.StartsWith("cid:"))
{
// split src
var src = node.Attributes["src"].Value.Split(new[] { ':' }, 2);
if (src.Length == 2)
{
// Find inline attachment with given contentid
var document = source.Documents.FirstOrDefault(d => d.ContentType == ContentType.Inline && d.ContentId == src[1]);
if (document != null)
{
// Replace content-id url with filename
var filename = ClientState.Current.Storage.ResolvePhysicalFilename(".", document.StreamName);
node.Attributes["src"].Value = String.Format("file://{0}", filename);
}
}
}
else if (nodeName == "a" && node.Attributes["href"] != null)
{
var url = node.Attributes["href"].Value;
// Clean href and inject javascript hook
node.Attributes["href"].Value = String.Empty;
writer.WriteAttributeString("onclick", String.Format("javascript:window.external.JsNavigate('{0}')", url));
}
}
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:31,代码来源:MessageBuilder.cs
示例6: WriteGraphAttributes
/// <summary>
/// Writes all experiment graph attributes.
/// </summary>
/// <param name="writer">The writer.</param>
/// <param name="flow">The flow.</param>
public virtual void WriteGraphAttributes(XmlWriter writer, IExperiment flow)
{
string path = System.IO.Path.Combine(System.IO.Path.GetTempPath(), Guid.NewGuid().ToString());
System.IO.Directory.CreateDirectory(path);
PropertyDescriptorCollection propertiesToWrite = TypeDescriptor.GetProperties(flow);
foreach (PropertyDescriptor property in propertiesToWrite)
{
WriteXmlAttribute(writer, property, flow);
}
writer.WriteStartElement("References");
{
if (flow.References != null)
{
var serializer = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(PackageSystem.PackageReference), null);
foreach (IPackageReference reference in flow.References)
{
serializer.Serialize(writer, reference);
}
}
}
writer.WriteEndElement();
// Iterate again and write any elements that are pending. ALL attributes must be done first, or it results in invalid XML
foreach (PropertyDescriptor property in propertiesToWrite)
{
WriteXmlElement(writer, property, flow);
}
}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:35,代码来源:ExperimentFactoryWriter.cs
示例7: WriteXmlAttributes
protected internal override void WriteXmlAttributes(XmlWriter writer)
{
if (Mode == VerticesEnumeratorMode.Range)
{
writer.WriteStartAttribute(StartField);
writer.WriteValue(Start);
writer.WriteEndAttribute();
writer.WriteStartAttribute(EndField);
writer.WriteValue(End);
writer.WriteEndAttribute();
writer.WriteStartAttribute(IncField);
writer.WriteValue(Increment);
writer.WriteEndAttribute();
}
if (Mode != VerticesEnumeratorMode.All)
{
writer.WriteStartAttribute(ModeField);
writer.WriteValue(Mode.ToString());
writer.WriteEndAttribute();
}
base.WriteXmlAttributes(writer);
}
开发者ID:netgrim,项目名称:MapKit,代码行数:26,代码来源:VerticesEnumerator.cs
示例8: writeVertex
public static void writeVertex(XmlWriter writer, Vector2D vert)
{
writer.WriteStartElement("vertex");
writer.WriteAttributeString("x", vert.x.ToString());
writer.WriteAttributeString("y", vert.y.ToString());
writer.WriteEndElement();
}
开发者ID:CodeMason,项目名称:LibGDX_DoomBuilder,代码行数:7,代码来源:MapWriter.cs
示例9: WriteAlbum
private static void WriteAlbum(XmlWriter writer, string albumTitle, string artist)
{
writer.WriteStartElement("album");
writer.WriteElementString("title", albumTitle);
writer.WriteElementString("artist", artist);
writer.WriteEndElement();
}
开发者ID:NK-Hertz,项目名称:Telerik-Academy-2015,代码行数:7,代码来源:Program.cs
示例10: Validate
public override void Validate(XmlWriter output, SchematronRuntimeOptions options)
{
if (output == null) throw new ArgumentNullException("output");
if (options == null) throw new ArgumentNullException("options");
this.executable.Run(output, GetXsltOptions(options));
}
开发者ID:skurdiukov,项目名称:myxsl,代码行数:7,代码来源:XsltSchematronValidator.cs
示例11: WrappedSerializer
internal WrappedSerializer(Serialization.DataFormat dataFormat, string streamName, TextWriter output) : base(dataFormat, streamName)
{
this.firstCall = true;
this.textWriter = output;
Serialization.DataFormat dataFormat1 = this.format;
switch (dataFormat1)
{
case Serialization.DataFormat.Text:
{
return;
}
case Serialization.DataFormat.XML:
{
XmlWriterSettings xmlWriterSetting = new XmlWriterSettings();
xmlWriterSetting.CheckCharacters = false;
xmlWriterSetting.OmitXmlDeclaration = true;
this.xmlWriter = XmlWriter.Create(this.textWriter, xmlWriterSetting);
this.xmlSerializer = new Serializer(this.xmlWriter);
return;
}
default:
{
return;
}
}
}
开发者ID:nickchal,项目名称:pash,代码行数:26,代码来源:WrappedSerializer.cs
示例12: WriteItem
protected virtual void WriteItem(XmlWriter writer, string baseUrl, SiteMapEntry item)
{
// <url>
if (item.Url.StartsWith("http")) return;
writer.WriteStartElement("url");
#if DEBUG2
if (!string.IsNullOrEmpty(item.ID))
writer.WriteElementString("id", item.ID);
if (!string.IsNullOrEmpty(item.Title))
writer.WriteElementString("title", item.Title);
if (!string.IsNullOrEmpty(item.Class))
writer.WriteElementString("class", item.Class);
#endif
writer.WriteElementString("loc", baseUrl + item.Url);
if (item.LastModified.HasValue)
writer.WriteElementString("lastmod", item.LastModified.Value.ToString("yyyy-MM-dd")); // Google doesn't like IS0 8601/W3C
if (item.ChangeFrequency != ChangeFrequencyEnum.Undefined)
writer.WriteElementString("changefreq", item.ChangeFrequency.ToString().ToLowerInvariant());
writer.WriteElementString("priority", item.Priority.ToString(CultureInfo.InvariantCulture));
// </url>
writer.WriteEndElement();
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:29,代码来源:SiteMapXmlResult.cs
示例13: WritePaymentSpecificXml
public override void WritePaymentSpecificXml(XmlWriter xmlw)
{
if (_paymentMethod != null)
{
WriteSimpleElement(xmlw, "paymentmethod", _paymentMethod.Value);
}
}
开发者ID:Matsutt,项目名称:dotnet-integration,代码行数:7,代码来源:PaymentMethodPayment.cs
示例14:
void IXmlSerializable.WriteXml(XmlWriter writer)
{
if (address != null)
{
address.WriteContentsTo(this.addressVersion, writer);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:MetadataReference.cs
示例15: PrintQuery
public override void PrintQuery(XmlWriter w) {
w.WriteStartElement(this.GetType().Name);
w.WriteAttributeString("op", (isOr ? Operator.Op.OR : Operator.Op.AND).ToString());
opnd1.PrintQuery(w);
opnd2.PrintQuery(w);
w.WriteEndElement();
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:7,代码来源:booleanexpr.cs
示例16: WriteCLPSToXML
private static void WriteCLPSToXML(XmlWriter writer)
{
writer.WriteStartElement("CLPS");
uint clps_addr = m_Overlay.ReadPointer(0x60);
uint clps_num = m_Overlay.Read16(clps_addr + 0x06);
uint clps_size = (uint)(8 + (clps_num * 8));
byte[][] entries = new byte[clps_num][];
uint entry = clps_addr + 0x08;
for (int i = 0; i < clps_num; i++)
{
entries[i] = new byte[8];
for (int j = 0; j < 8; j++)
entries[i][j] = m_Overlay.Read8((uint)(entry + (j)));
entry += 8;
}
for (int i = 0; i < entries.Length; i++)
{
writer.WriteStartElement("Entry");
writer.WriteStartElement("Value");
for (int j = 0; j < entries[i].Length; j++)
writer.WriteElementString("Byte", entries[i][j].ToString());
writer.WriteEndElement();
writer.WriteEndElement();
}
writer.WriteEndElement();
}
开发者ID:RicoPlays,项目名称:sm64dse,代码行数:33,代码来源:LevelDataXML_Exporter.cs
示例17: WritePatchedImport
void WritePatchedImport (XmlWriter writer, string newTarget)
{
/* If an import redirect exists, add a fake import to the project which will be used only
if the original import doesn't exist. That is, the following import:
<Import Project = "PathToReplace" />
will be converted into:
<Import Project = "PathToReplace" Condition = "Exists('PathToReplace')"/>
<Import Project = "ReplacementPath" Condition = "!Exists('PathToReplace')" />
*/
// Modify the original import by adding a condition, so that this import will be used only
// if the targets file exists.
string cond = "Exists('" + target + "')";
if (!string.IsNullOrEmpty (Condition))
cond = "( " + Condition + " ) AND " + cond;
writer.WriteStartElement ("Import", MSBuildProject.Schema);
writer.WriteAttributeString ("Project", target);
writer.WriteAttributeString ("Condition", cond);
// Now add the fake import, with a condition so that it will be used only if the original
// import does not exist.
cond = "!Exists('" + target + "')";
if (!string.IsNullOrEmpty (Condition))
cond = "( " + Condition + " ) AND " + cond;
writer.WriteStartElement ("Import", MSBuildProject.Schema);
writer.WriteAttributeString ("Project", MSBuildProjectService.ToMSBuildPath (null, newTarget));
writer.WriteAttributeString ("Condition", cond);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:35,代码来源:MSBuildImport.cs
示例18: WriteTo
internal override void WriteTo(XmlWriter xml)
{
if (xml == null)
return;
xml.WriteComment(SR.GetString(SR.ServiceNameFromClient));
xml.WriteElementString("ServiceName", this.serviceBindingNameSentByClient);
xml.WriteComment(SR.GetString(SR.ServiceNameOnService));
xml.WriteStartElement("ServiceNameCollection");
if (this.serviceNameCollectionConfiguredOnServer == null || this.serviceNameCollectionConfiguredOnServer.Count < 1)
{
xml.WriteElementString("ServiceName", this.defaultServiceBindingNameOfServer);
}
else
{
foreach (string serviceName in this.serviceNameCollectionConfiguredOnServer)
{
xml.WriteElementString("ServiceName", serviceName);
}
}
xml.WriteFullEndElement();
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:SecurityTraceRecordHelper.cs
示例19: XmlExceptionFormatter
/// <summary>
/// Initializes a new instance of the <see cref="XmlExceptionFormatter"/> class using the specified <see cref="XmlWriter"/> and <see cref="Exception"/> objects.
/// </summary>
/// <param name="xmlWriter">The <see cref="XmlWriter"/> in which to write the XML.</param>
/// <param name="exception">The <see cref="Exception"/> to format.</param>
public XmlExceptionFormatter(XmlWriter xmlWriter, Exception exception)
: base(exception)
{
if (xmlWriter == null) throw new ArgumentNullException("xmlWriter");
this.xmlWriter = xmlWriter;
}
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:12,代码来源:XmlExceptionFormatter.cs
示例20: WriteXml
public override void WriteXml(XmlWriter writer)
{
writer.WriteElementString("Format", Format);
writer.WriteStartElement("OnlineResource", Namespace);
OnlineResource.WriteXml(writer);
writer.WriteEndElement();
}
开发者ID:bertt,项目名称:BruTile,代码行数:7,代码来源:StyleSheetURL.cs
注:本文中的System.Xml.XmlWriter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论