本文整理汇总了C#中System.Xml.XmlWriter.WriteDocType方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteDocType方法的具体用法?C# XmlWriter.WriteDocType怎么用?C# XmlWriter.WriteDocType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteDocType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteDocumentTo
public void WriteDocumentTo(XmlWriter writer)
{
writer.WriteDocType("html", "-//W3C//DTD XHTML 1.1//EN", null, null);
writer.WriteStartElement("html");
writer.WriteAttributeString("xmlns", "http://www.w3.org/1999/xhtml");
writer.WriteStartElement("head");
if (Document.Metadata.ContainsKey("Title")) {
writer.WriteStartElement("title");
writer.WriteString(Document.Metadata["Title"].ToString());
writer.WriteEndElement();
}
writer.WriteStartElement("meta");
writer.WriteAttributeString("http-equiv", "ContentType");
writer.WriteAttributeString("context", "text/xhtml; charset=utf-8");
writer.WriteEndElement();
writer.WriteEndElement(); // head
writer.WriteStartElement("body");
WriteTo(writer);
writer.WriteEndElement(); // body
writer.WriteEndElement(); // html
}
示例2: WriteTo
public override void WriteTo(XmlWriter writer)
{
if (writer == null)
{
throw new ArgumentNullException("writer");
}
writer.WriteDocType(this.name, this.publicId, this.systemId, this.internalSubset);
}
示例3: ENMLWriter
public ENMLWriter()
{
Contents = new Utf8StringWriter();
XmlWriterSettings settings = new XmlWriterSettings();
settings.ConformanceLevel = ConformanceLevel.Auto;
//writer = XmlWriter.Create(Contents, settings)
writer = XmlWriter.Create(Contents);
writer.WriteDocType("en-note", null, "http://xml.evernote.com/pub/enml2.dtd", null);
}
示例4: WriteXmlWriter
public static void WriteXmlWriter (object value, XmlWriter writer)
{
writer.WriteStartDocument();
writer.WriteDocType("plist", "-//Apple Computer//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
writer.WriteStartElement("plist");
writer.WriteAttributeString("version", "1.0");
new Plist().Compose(value, writer);
writer.WriteEndElement();
writer.WriteEndDocument();
}
示例5: Hxt
// Constructor
public Hxt(string filePath, Encoding encoding)
{
Disposed = false;
XmlWriterSettings settings = new XmlWriterSettings { Indent = true, NewLineChars = Environment.NewLine, Encoding = encoding, };
writer = XmlWriter.Create(filePath, settings);
// Write header
writer.WriteStartDocument();
writer.WriteDocType("HelpTOC", null, "MS-Help://Hx/Resources/HelpTOC.DTD", null);
writer.WriteStartElement("HelpTOC");
writer.WriteAttributeString("DTDVersion", "1.0");
writer.Flush();
}
示例6: WriteNodeSingle
private void WriteNodeSingle(XmlReader reader, XmlWriter writer) {
Contract.Requires(reader != null);
Contract.Requires(writer != null);
switch (reader.NodeType) {
case XmlNodeType.Element:
this.WriteElement(reader, writer);
break;
case XmlNodeType.Text:
this.WriteText(reader, writer);
break;
case XmlNodeType.Whitespace:
case XmlNodeType.SignificantWhitespace:
this.WriteWhitespace(reader, writer);
break;
case XmlNodeType.CDATA:
this.WriteCDATA(reader, writer);
break;
case XmlNodeType.EntityReference:
Contract.Assume(false, "entityref not supported");
writer.WriteString(reader.Name);
break;
case XmlNodeType.XmlDeclaration:
case XmlNodeType.ProcessingInstruction:
var pinstr = reader.Name;
Contract.Assume(!String.IsNullOrEmpty(pinstr));
writer.WriteProcessingInstruction(pinstr, reader.Value);
break;
case XmlNodeType.DocumentType:
writer.WriteDocType(
reader.Name,
reader.GetAttribute("PUBLIC"),
reader.GetAttribute("SYSTEM"),
reader.Value);
break;
case XmlNodeType.Comment:
WriteComment(reader, writer);
break;
case XmlNodeType.EndElement:
this.WriteEndElement(reader, writer);
break;
}
}
示例7: Save
internal static void Save(XmlWriter writer, IEnumerable<IShape> shapes, Size size)
{
if (writer == null)
throw new ArgumentNullException ("writer");
writer.WriteStartDocument (false);
writer.WriteDocType ("svg", "-//W3C//Dtd SVG 1.1//EN",
"http://www.w3.org/Graphics/SVG/1.1/Dtd/svg11.dtd", null);
writer.WriteStartElement ("svg", "http://www.w3.org/2000/svg");
writer.WriteAttributeString ("width", SafeString (size.Width));
writer.WriteAttributeString ("height", SafeString (size.Height));
writer.WriteAttributeString ("version", "1.1");
writer.WriteAttributeString ("preserveAspectratio", "xMidYMid");
if (shapes != null)
foreach (var s in shapes) {
var pers = s as IPersistableShape;
if (pers != null)
pers.SvgSave (writer);
}
writer.WriteEndElement ();
}
示例8: SVGDocument
public SVGDocument(double width, double height)
{
m_stream = new MemoryStream();
//m_writer = XmlWriter.Create(m_stream);
settings.Indent = true;
settings.IndentChars = " ";
settings.NewLineChars = "\r\n";
m_writer = XmlWriter.Create(m_stream, settings);
m_writer.WriteStartDocument();
m_writer.WriteDocType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", null);
m_writer.WriteStartElement("svg", "http://www.w3.org/2000/svg");
m_writer.WriteAttributeString("version", "1.1");
if (width == 100 && height == 100)
{
m_writer.WriteAttributeString("width", "100%");
m_writer.WriteAttributeString("height", "100%");
}
else
{
m_writer.WriteAttributeString("width", width.ToString());
m_writer.WriteAttributeString("height", height.ToString());
}
}
示例9: WriteNode
// Writes the content (inner XML) of the current node into the provided XmlWriter.
private void WriteNode(XmlWriter xtw, bool defattr) {
#if !SILVERLIGHT
Debug.Assert(xtw is XmlTextWriter);
#endif
int d = this.NodeType == XmlNodeType.None ? -1 : this.Depth;
while (this.Read() && (d < this.Depth)) {
switch (this.NodeType) {
case XmlNodeType.Element:
xtw.WriteStartElement(this.Prefix, this.LocalName, this.NamespaceURI);
#if !SILVERLIGHT // Removing dependency on XmlTextWriter
((XmlTextWriter)xtw).QuoteChar = this.QuoteChar;
#endif
xtw.WriteAttributes(this, defattr);
if (this.IsEmptyElement) {
xtw.WriteEndElement();
}
break;
case XmlNodeType.Text:
xtw.WriteString(this.Value);
break;
case XmlNodeType.Whitespace:
case XmlNodeType.SignificantWhitespace:
xtw.WriteWhitespace(this.Value);
break;
case XmlNodeType.CDATA:
xtw.WriteCData(this.Value);
break;
case XmlNodeType.EntityReference:
xtw.WriteEntityRef(this.Name);
break;
case XmlNodeType.XmlDeclaration:
case XmlNodeType.ProcessingInstruction:
xtw.WriteProcessingInstruction(this.Name, this.Value);
break;
case XmlNodeType.DocumentType:
xtw.WriteDocType(this.Name, this.GetAttribute("PUBLIC"), this.GetAttribute("SYSTEM"), this.Value);
break;
case XmlNodeType.Comment:
xtw.WriteComment(this.Value);
break;
case XmlNodeType.EndElement:
xtw.WriteFullEndElement();
break;
}
}
if (d == this.Depth && this.NodeType == XmlNodeType.EndElement) {
Read();
}
}
示例10: WriteCapabilitiesDocType
public void WriteCapabilitiesDocType(XmlWriter writer)
{
if (Version >= WmsVersionEnum.Version_1_3_0)
return;
writer.WriteDocType("WMT_MS_Capability", null, System(Version, "capabilities"), null);
}
示例11: WriteServiceExceptionReportDocType
public void WriteServiceExceptionReportDocType(XmlWriter writer)
{
if (Version > WmsVersionEnum.Version_1_0_7 && Version < WmsVersionEnum.Version_1_3_0)
{
writer.WriteDocType("ServiceExceptionReport", null, System(Version, "exception"), null);
}
}
示例12: WriteHtmlDeclaration
public static void WriteHtmlDeclaration(XmlWriter Writer, String PublicIdentifier = "-//W3C//DTD XHTML 1.0 Transitional//EN", String SystemIdentifier = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd")
{
Writer.WriteDocType("html", PublicIdentifier, SystemIdentifier, null);
}
示例13: TransformXml
protected void TransformXml(XmlReader reader, XmlWriter writer)
{
// m_log.DebugFormat("[HG ASSET MAPPER]: Transforming XML");
int sopDepth = -1;
UserAccount creator = null;
bool hasCreatorData = false;
while (reader.Read())
{
// Console.WriteLine("Depth: {0}, name {1}", reader.Depth, reader.Name);
switch (reader.NodeType)
{
case XmlNodeType.Attribute:
// Console.WriteLine("FOUND ATTRIBUTE {0}", reader.Name);
writer.WriteAttributeString(reader.Prefix, reader.Name, reader.NamespaceURI, reader.Value);
break;
case XmlNodeType.CDATA:
writer.WriteCData(reader.Value);
break;
case XmlNodeType.Comment:
writer.WriteComment(reader.Value);
break;
case XmlNodeType.DocumentType:
writer.WriteDocType(reader.Name, reader.Value, null, null);
break;
case XmlNodeType.Element:
// m_log.DebugFormat("Depth {0} at element {1}", reader.Depth, reader.Name);
writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
if (reader.HasAttributes)
{
while (reader.MoveToNextAttribute())
writer.WriteAttributeString(reader.Prefix, reader.Name, reader.NamespaceURI, reader.Value);
reader.MoveToElement();
}
if (reader.LocalName == "SceneObjectPart")
{
if (sopDepth < 0)
{
sopDepth = reader.Depth;
// m_log.DebugFormat("[HG ASSET MAPPER]: Set sopDepth to {0}", sopDepth);
}
}
else
{
if (sopDepth >= 0 && reader.Depth == sopDepth + 1)
{
if (reader.Name == "CreatorID")
{
reader.Read();
if (reader.NodeType == XmlNodeType.Element && reader.Name == "Guid" || reader.Name == "UUID")
{
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
{
UUID uuid = UUID.Zero;
UUID.TryParse(reader.Value, out uuid);
creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
writer.WriteElementString("UUID", reader.Value);
reader.Read();
}
else
{
// If we unexpected run across mixed content in this node, still carry on
// transforming the subtree (this replicates earlier behaviour).
TransformXml(reader, writer);
}
}
else
{
// If we unexpected run across mixed content in this node, still carry on
// transforming the subtree (this replicates earlier behaviour).
TransformXml(reader, writer);
}
}
else if (reader.Name == "CreatorData")
{
reader.Read();
if (reader.NodeType == XmlNodeType.Text)
{
hasCreatorData = true;
writer.WriteString(reader.Value);
}
else
{
// If we unexpected run across mixed content in this node, still carry on
// transforming the subtree (this replicates earlier behaviour).
TransformXml(reader, writer);
}
}
//.........这里部分代码省略.........
示例14: WriteTo
public override void WriteTo(XmlWriter writer)
{
XDocument doc = Document;
XElement root = doc.Root;
if (root != null)
writer.WriteDocType (root.Name.LocalName, pubid, sysid, intSubset);
}
示例15: WriteTo
public override void WriteTo (XmlWriter w)
{
w.WriteDocType (Name, PublicId, SystemId, InternalSubset);
}