Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8329749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:53:52+00:00 2026-06-09T01:53:52+00:00

Consider the following C# code: XmlTextWriter writer = new XmlTextWriter(pathFichier, null); writer.WriteStartDocument(); writer.WriteDocType(plist, -//Apple//DTD

  • 0

Consider the following C# code:

XmlTextWriter writer = new XmlTextWriter(pathFichier, null);
writer.WriteStartDocument();
writer.WriteDocType("plist", "-//Apple//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
writer.WriteStartElement("plist");
writer.WriteAttributeString("version", "1.0");
writer.WriteFullEndElement(); // plist
writer.Close();

A PList doctype is usually:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

The above code adds an empty subset at the end of the doctype string:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]>

The “[]” at the end screws with iOs’s parsing.

How can I get rid of it using XmlTextWriter ?

Should I just reopened the file and delete the “[]” ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T01:53:55+00:00Added an answer on June 9, 2026 at 1:53 am

    You can derive a class for XmlTextWriter and override the WriteDocType method.

    It’d look something like this:

    public override void WriteDocType(string name, string pubid, string sysid, string subset)
    {
        this.wrappedWriter.WriteRaw("-//Apple//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd");
    }
    

    EDIT by the guy who asked the question. Here’s the code I wrote to make it work.

    The WriteDocType override:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    
    namespace your.namespace {
        public class PListWriter : System.Xml.XmlTextWriter  {
    
            public PListWriter(string filename, System.Text.Encoding encoding) : base(filename, encoding) { }
    
            public override void WriteDocType(string name = "", string pubid = "", string sysid = "", string subset = "") {
                this.WriteRaw("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">");
            }
        }
    }
    

    Its usage in the wild:

    PListWriter writer = new PListWriter(pathFichier, null);    
    writer.Formatting = Formatting.Indented;
    writer.WriteStartDocument();
    writer.WriteDocType();
    writer.WriteStartElement("plist");
    writer.WriteAttributeString("version", "1.0");
    writer.WriteFullEndElement(); // plist
    writer.Close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?
Consider the following code: char* p = new char[2]; long* pi = (long*) p;
Consider the following code (C++11), which uses the Eigen 3 library (http://eigen.tuxfamily.org): #include <iostream>
Consider the following code ( http://jsfiddle.net/FW36F/1/ ): <input type=checkbox onchange=alert(this.checked)> <button onclick=document.getElementsByTagName('input')[0].checked=!document.getElementsByTagName('input')[0].checked;>toggle</button> If you
Consider following code: ArrayList<Integer> aList = new ArrayList<Integer>(); aList.add(2134); aList.add(3423); aList.add(4234); aList.add(343); String tmpString
Consider the following code Snippet Form form2 = new Form(); test(form2); form2.Show(); public void
Consider following code: typedef SomeType type_t[2]; SomeType * arr1 = new type_t; //new or
Consider the following code: SqlConnection conn = new SqlConnection(@connection string); SqlCommand ourCommand = new
Consider following code: My problem is: 1) I can't seem to cast the errors
Consider following code: enum size = 16; double[size] arr1 = [...]; double[size] arr2 =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.