Difference in XML when using [] at end of !DOCTYPE?












0















As you can see in the linked question, when using XDocument in C#, an empty internal subset will be added in the DTD-Header, if non had existed before. The question and answer deal with how to remove this, however, while the answerer points out that that this is well-formatted XML, I ask:



1) Under which circumstances will this cause problems? Which standard changed so that a legacy application might be incompatible with an empty internal subset?



2) Is it preferable to use empty internal subsets going forward with new applications?










share|improve this question





























    0















    As you can see in the linked question, when using XDocument in C#, an empty internal subset will be added in the DTD-Header, if non had existed before. The question and answer deal with how to remove this, however, while the answerer points out that that this is well-formatted XML, I ask:



    1) Under which circumstances will this cause problems? Which standard changed so that a legacy application might be incompatible with an empty internal subset?



    2) Is it preferable to use empty internal subsets going forward with new applications?










    share|improve this question



























      0












      0








      0








      As you can see in the linked question, when using XDocument in C#, an empty internal subset will be added in the DTD-Header, if non had existed before. The question and answer deal with how to remove this, however, while the answerer points out that that this is well-formatted XML, I ask:



      1) Under which circumstances will this cause problems? Which standard changed so that a legacy application might be incompatible with an empty internal subset?



      2) Is it preferable to use empty internal subsets going forward with new applications?










      share|improve this question
















      As you can see in the linked question, when using XDocument in C#, an empty internal subset will be added in the DTD-Header, if non had existed before. The question and answer deal with how to remove this, however, while the answerer points out that that this is well-formatted XML, I ask:



      1) Under which circumstances will this cause problems? Which standard changed so that a legacy application might be incompatible with an empty internal subset?



      2) Is it preferable to use empty internal subsets going forward with new applications?







      c# xml linq-to-xml dtd doctype






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 15:25







      Robert Tausig

















      asked Nov 13 '18 at 12:08









      Robert TausigRobert Tausig

      1116




      1116
























          2 Answers
          2






          active

          oldest

          votes


















          1














          When you parse Xml Document by using XDocument with DTD then empty Internal Subset means Square Brackets is automatically inserted.



          If you want to remove this Internal Subset then you can set XDocumentType.InternalSubset = null like



          XDocument doc = XDocument.Load(@"Path to xml file");
          if (doc.DocumentType != null)
          doc.DocumentType.InternalSubset = null;

          //Do code with XDocument


          Example:



          <?xml version="1.0" encoding="utf-8" ?>
          <!DOCTYPE book [ <!ENTITY h "hardcover"> ]>
          <book genre="novel" ISBN="1-861001-57-5">
          <title>Pride And Prejudice</title>
          <author>Mark Henry</author>
          </book>


          In above example kindly noticed this part [ <!ENTITY h "hardcover"> ]. This is called as Internal Subset.



          Does it matter?



          No this does not matter. but its a well formed XML if your XML doesn't contain any internal subset then it represent as blank square brackets . it means that your xml doesn't contain any internal subset.



          While parsing xml with XDocument with no internal subset then XDocument append blank square brackets instead of display nothing in DOCTYPE.



          What does an empty internal subset do?



          The basic purpose of an internal entity is to get rid of typing same content (like the name of the organization) again and again. And instead, we can define an internal entity to contain the text and then only you need to use the entity where you want to insert the text. Because the entity is expanded by the parser, you can be assured that you'll get the same text in every location. The parser will also catch if you misspell an entity name.



          You can read more about Internal Subset here






          share|improve this answer


























          • But does it matter? What does an empty internal subset do?

            – Robert Tausig
            Nov 13 '18 at 14:43











          • Currently m not in office, I'll try to give u update tomorrow. Stay in touch :)

            – er-mfahhgk
            Nov 13 '18 at 14:53











          • @RobertTausig, answer update kindly noticed and read from Example section :)

            – er-mfahhgk
            Nov 14 '18 at 6:05











          • @RobertTausig, if my answer was helpful to you then plz mark the tick on left side of answer to make it green :)

            – er-mfahhgk
            Nov 15 '18 at 10:42





















          0














          It's a little bit strange, but not wrong.



          The grammar for DOCTYPE is



          doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'   
          intSubset ::= (markupdecl | DeclSep)*


          So you're allowed a sequence of zero-or-more markup declarations between square brackets, and if there aren't any markup declarations then you can omit the square brackets (but you aren't required to).






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280729%2fdifference-in-xml-when-using-at-end-of-doctype%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            When you parse Xml Document by using XDocument with DTD then empty Internal Subset means Square Brackets is automatically inserted.



            If you want to remove this Internal Subset then you can set XDocumentType.InternalSubset = null like



            XDocument doc = XDocument.Load(@"Path to xml file");
            if (doc.DocumentType != null)
            doc.DocumentType.InternalSubset = null;

            //Do code with XDocument


            Example:



            <?xml version="1.0" encoding="utf-8" ?>
            <!DOCTYPE book [ <!ENTITY h "hardcover"> ]>
            <book genre="novel" ISBN="1-861001-57-5">
            <title>Pride And Prejudice</title>
            <author>Mark Henry</author>
            </book>


            In above example kindly noticed this part [ <!ENTITY h "hardcover"> ]. This is called as Internal Subset.



            Does it matter?



            No this does not matter. but its a well formed XML if your XML doesn't contain any internal subset then it represent as blank square brackets . it means that your xml doesn't contain any internal subset.



            While parsing xml with XDocument with no internal subset then XDocument append blank square brackets instead of display nothing in DOCTYPE.



            What does an empty internal subset do?



            The basic purpose of an internal entity is to get rid of typing same content (like the name of the organization) again and again. And instead, we can define an internal entity to contain the text and then only you need to use the entity where you want to insert the text. Because the entity is expanded by the parser, you can be assured that you'll get the same text in every location. The parser will also catch if you misspell an entity name.



            You can read more about Internal Subset here






            share|improve this answer


























            • But does it matter? What does an empty internal subset do?

              – Robert Tausig
              Nov 13 '18 at 14:43











            • Currently m not in office, I'll try to give u update tomorrow. Stay in touch :)

              – er-mfahhgk
              Nov 13 '18 at 14:53











            • @RobertTausig, answer update kindly noticed and read from Example section :)

              – er-mfahhgk
              Nov 14 '18 at 6:05











            • @RobertTausig, if my answer was helpful to you then plz mark the tick on left side of answer to make it green :)

              – er-mfahhgk
              Nov 15 '18 at 10:42


















            1














            When you parse Xml Document by using XDocument with DTD then empty Internal Subset means Square Brackets is automatically inserted.



            If you want to remove this Internal Subset then you can set XDocumentType.InternalSubset = null like



            XDocument doc = XDocument.Load(@"Path to xml file");
            if (doc.DocumentType != null)
            doc.DocumentType.InternalSubset = null;

            //Do code with XDocument


            Example:



            <?xml version="1.0" encoding="utf-8" ?>
            <!DOCTYPE book [ <!ENTITY h "hardcover"> ]>
            <book genre="novel" ISBN="1-861001-57-5">
            <title>Pride And Prejudice</title>
            <author>Mark Henry</author>
            </book>


            In above example kindly noticed this part [ <!ENTITY h "hardcover"> ]. This is called as Internal Subset.



            Does it matter?



            No this does not matter. but its a well formed XML if your XML doesn't contain any internal subset then it represent as blank square brackets . it means that your xml doesn't contain any internal subset.



            While parsing xml with XDocument with no internal subset then XDocument append blank square brackets instead of display nothing in DOCTYPE.



            What does an empty internal subset do?



            The basic purpose of an internal entity is to get rid of typing same content (like the name of the organization) again and again. And instead, we can define an internal entity to contain the text and then only you need to use the entity where you want to insert the text. Because the entity is expanded by the parser, you can be assured that you'll get the same text in every location. The parser will also catch if you misspell an entity name.



            You can read more about Internal Subset here






            share|improve this answer


























            • But does it matter? What does an empty internal subset do?

              – Robert Tausig
              Nov 13 '18 at 14:43











            • Currently m not in office, I'll try to give u update tomorrow. Stay in touch :)

              – er-mfahhgk
              Nov 13 '18 at 14:53











            • @RobertTausig, answer update kindly noticed and read from Example section :)

              – er-mfahhgk
              Nov 14 '18 at 6:05











            • @RobertTausig, if my answer was helpful to you then plz mark the tick on left side of answer to make it green :)

              – er-mfahhgk
              Nov 15 '18 at 10:42
















            1












            1








            1







            When you parse Xml Document by using XDocument with DTD then empty Internal Subset means Square Brackets is automatically inserted.



            If you want to remove this Internal Subset then you can set XDocumentType.InternalSubset = null like



            XDocument doc = XDocument.Load(@"Path to xml file");
            if (doc.DocumentType != null)
            doc.DocumentType.InternalSubset = null;

            //Do code with XDocument


            Example:



            <?xml version="1.0" encoding="utf-8" ?>
            <!DOCTYPE book [ <!ENTITY h "hardcover"> ]>
            <book genre="novel" ISBN="1-861001-57-5">
            <title>Pride And Prejudice</title>
            <author>Mark Henry</author>
            </book>


            In above example kindly noticed this part [ <!ENTITY h "hardcover"> ]. This is called as Internal Subset.



            Does it matter?



            No this does not matter. but its a well formed XML if your XML doesn't contain any internal subset then it represent as blank square brackets . it means that your xml doesn't contain any internal subset.



            While parsing xml with XDocument with no internal subset then XDocument append blank square brackets instead of display nothing in DOCTYPE.



            What does an empty internal subset do?



            The basic purpose of an internal entity is to get rid of typing same content (like the name of the organization) again and again. And instead, we can define an internal entity to contain the text and then only you need to use the entity where you want to insert the text. Because the entity is expanded by the parser, you can be assured that you'll get the same text in every location. The parser will also catch if you misspell an entity name.



            You can read more about Internal Subset here






            share|improve this answer















            When you parse Xml Document by using XDocument with DTD then empty Internal Subset means Square Brackets is automatically inserted.



            If you want to remove this Internal Subset then you can set XDocumentType.InternalSubset = null like



            XDocument doc = XDocument.Load(@"Path to xml file");
            if (doc.DocumentType != null)
            doc.DocumentType.InternalSubset = null;

            //Do code with XDocument


            Example:



            <?xml version="1.0" encoding="utf-8" ?>
            <!DOCTYPE book [ <!ENTITY h "hardcover"> ]>
            <book genre="novel" ISBN="1-861001-57-5">
            <title>Pride And Prejudice</title>
            <author>Mark Henry</author>
            </book>


            In above example kindly noticed this part [ <!ENTITY h "hardcover"> ]. This is called as Internal Subset.



            Does it matter?



            No this does not matter. but its a well formed XML if your XML doesn't contain any internal subset then it represent as blank square brackets . it means that your xml doesn't contain any internal subset.



            While parsing xml with XDocument with no internal subset then XDocument append blank square brackets instead of display nothing in DOCTYPE.



            What does an empty internal subset do?



            The basic purpose of an internal entity is to get rid of typing same content (like the name of the organization) again and again. And instead, we can define an internal entity to contain the text and then only you need to use the entity where you want to insert the text. Because the entity is expanded by the parser, you can be assured that you'll get the same text in every location. The parser will also catch if you misspell an entity name.



            You can read more about Internal Subset here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 14 '18 at 6:04

























            answered Nov 13 '18 at 12:19









            er-mfahhgker-mfahhgk

            5,4572616




            5,4572616













            • But does it matter? What does an empty internal subset do?

              – Robert Tausig
              Nov 13 '18 at 14:43











            • Currently m not in office, I'll try to give u update tomorrow. Stay in touch :)

              – er-mfahhgk
              Nov 13 '18 at 14:53











            • @RobertTausig, answer update kindly noticed and read from Example section :)

              – er-mfahhgk
              Nov 14 '18 at 6:05











            • @RobertTausig, if my answer was helpful to you then plz mark the tick on left side of answer to make it green :)

              – er-mfahhgk
              Nov 15 '18 at 10:42





















            • But does it matter? What does an empty internal subset do?

              – Robert Tausig
              Nov 13 '18 at 14:43











            • Currently m not in office, I'll try to give u update tomorrow. Stay in touch :)

              – er-mfahhgk
              Nov 13 '18 at 14:53











            • @RobertTausig, answer update kindly noticed and read from Example section :)

              – er-mfahhgk
              Nov 14 '18 at 6:05











            • @RobertTausig, if my answer was helpful to you then plz mark the tick on left side of answer to make it green :)

              – er-mfahhgk
              Nov 15 '18 at 10:42



















            But does it matter? What does an empty internal subset do?

            – Robert Tausig
            Nov 13 '18 at 14:43





            But does it matter? What does an empty internal subset do?

            – Robert Tausig
            Nov 13 '18 at 14:43













            Currently m not in office, I'll try to give u update tomorrow. Stay in touch :)

            – er-mfahhgk
            Nov 13 '18 at 14:53





            Currently m not in office, I'll try to give u update tomorrow. Stay in touch :)

            – er-mfahhgk
            Nov 13 '18 at 14:53













            @RobertTausig, answer update kindly noticed and read from Example section :)

            – er-mfahhgk
            Nov 14 '18 at 6:05





            @RobertTausig, answer update kindly noticed and read from Example section :)

            – er-mfahhgk
            Nov 14 '18 at 6:05













            @RobertTausig, if my answer was helpful to you then plz mark the tick on left side of answer to make it green :)

            – er-mfahhgk
            Nov 15 '18 at 10:42







            @RobertTausig, if my answer was helpful to you then plz mark the tick on left side of answer to make it green :)

            – er-mfahhgk
            Nov 15 '18 at 10:42















            0














            It's a little bit strange, but not wrong.



            The grammar for DOCTYPE is



            doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'   
            intSubset ::= (markupdecl | DeclSep)*


            So you're allowed a sequence of zero-or-more markup declarations between square brackets, and if there aren't any markup declarations then you can omit the square brackets (but you aren't required to).






            share|improve this answer




























              0














              It's a little bit strange, but not wrong.



              The grammar for DOCTYPE is



              doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'   
              intSubset ::= (markupdecl | DeclSep)*


              So you're allowed a sequence of zero-or-more markup declarations between square brackets, and if there aren't any markup declarations then you can omit the square brackets (but you aren't required to).






              share|improve this answer


























                0












                0








                0







                It's a little bit strange, but not wrong.



                The grammar for DOCTYPE is



                doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'   
                intSubset ::= (markupdecl | DeclSep)*


                So you're allowed a sequence of zero-or-more markup declarations between square brackets, and if there aren't any markup declarations then you can omit the square brackets (but you aren't required to).






                share|improve this answer













                It's a little bit strange, but not wrong.



                The grammar for DOCTYPE is



                doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'   
                intSubset ::= (markupdecl | DeclSep)*


                So you're allowed a sequence of zero-or-more markup declarations between square brackets, and if there aren't any markup declarations then you can omit the square brackets (but you aren't required to).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 '18 at 12:29









                Michael KayMichael Kay

                109k661115




                109k661115






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280729%2fdifference-in-xml-when-using-at-end-of-doctype%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Florida Star v. B. J. F.

                    Danny Elfman

                    Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues