当前位置: 首页>>代码示例>>C#>>正文


C# XmlWriter.WriteDocType方法代码示例

本文整理汇总了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
		}
开发者ID:dcga,项目名称:markdown.net,代码行数:25,代码来源:XhtmlWriter.cs

示例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);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XDocumentType.cs

示例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);
			}
开发者ID:mpnow,项目名称:evernote-cloud-sdk-dotnet,代码行数:9,代码来源:ENMLWriter.cs

示例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();
 }
开发者ID:Athari,项目名称:Alba.Plist,代码行数:10,代码来源:Plist.cs

示例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();
        }
开发者ID:mark-s,项目名称:MSDN-to-Kindle,代码行数:15,代码来源:Hxt.cs

示例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;
      }
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:43,代码来源:XmlTraverserBase.cs

示例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 ();
 }
开发者ID:miniBill,项目名称:DiagramDrawer,代码行数:20,代码来源:Svg.cs

示例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());
            }
        }
开发者ID:michaelrbk,项目名称:pixelart-vectorizer,代码行数:24,代码来源:SvgDocument.cs

示例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();
            }
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:50,代码来源:XmlReader.cs

示例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);
        }
开发者ID:galchen,项目名称:brutile,代码行数:7,代码来源:WmsVersion.cs

示例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);
     }
 }
开发者ID:galchen,项目名称:brutile,代码行数:7,代码来源:WmsVersion.cs

示例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);
 }
开发者ID:MetalMynds,项目名称:FlatGlass,代码行数:4,代码来源:XmlHelper.cs

示例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);
                                }
                            }
//.........这里部分代码省略.........
开发者ID:QuillLittlefeather,项目名称:OpenSim,代码行数:101,代码来源:HGAssetMapper.cs

示例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);
 }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:7,代码来源:XDocumentType.cs

示例15: WriteTo

		public override void WriteTo (XmlWriter w)
		{
			w.WriteDocType (Name, PublicId, SystemId, InternalSubset);
		}
开发者ID:user277,项目名称:mono,代码行数:4,代码来源:XmlDocumentType.cs


注:本文中的System.Xml.XmlWriter.WriteDocType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。