Solved

When I load an XmlDocument, it adds [] characters after the "Profile.dtd"

Posted on 2011-09-16
3
557 Views
Last Modified: 2012-05-12
Hello,

I have a VB app that uses XML.  When I load an XmlDocument from an actual XML file, [] characters are added right after the "Profile.dtd" in the second line of the XmlDocument's OuterText.

So that:
<!DOCTYPE Profile_Instance SYSTEM "Profile.dtd">     becomes...
<!DOCTYPE Profile_Instance SYSTEM "Profile.dtd"[]>

And this is the way the resulting file is written out.  This then messes things up.

Is there any way to keep the [] charcters from being added in?

Thanks in advance,
Tim
0
Comment
Question by:tmitch68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 28

Expert Comment

by:strickdd
ID: 36550833
This is a normal, optional part of a doctype declaration: http://en.wikipedia.org/wiki/Document_Type_Declaration.

It is probably being added automatically as a "just-in-case" type thing. I don't think it is really avoidable, but you can programatically remove them if you need.
0
 

Author Comment

by:tmitch68
ID: 36551011
Thanks - I've tried a few things to remove them programmatically.

So far, none of these have worked.  If I try to replace the OuterText of the node, this doesn't work because OuterText is read-only.
If I try to replace the node altogether, this doesn't work because I can't create a node with a ! character.

Do you possibly know of any other programmatic possibilities?

Thanks,
Tim
0
 
LVL 28

Accepted Solution

by:
strickdd earned 500 total points
ID: 36551043
The best I can think of off the top of my head is to convert the document to a string and perform a replace on it.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question