Solved

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

Posted on 2011-09-16
3
558 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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

691 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