Solved

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

Posted on 2011-09-16
3
536 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
  • 2
3 Comments
 
LVL 28

Expert Comment

by:strickdd
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now