Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 11th, 2008, 08:25 PM
cody
Guest
 
Posts: n/a
Default Trying to parse OpenDocument files (sxw)

Iam trying to read in sxw files and generate a preview for it.
The problem now is that the file "content.xml" seem to contain a DTD.
I do not want to process this DTD because this is a separate file which
is not available at this time.

I tried everything, but no matter what I do I get errors that the DTD is
not found or cannot be accessed due to security reasons.

Can't I deactivate usage of the DTD?

XmlReaderSettings s = new XmlReaderSettings();
s.IgnoreComments = true;
s.IgnoreWhitespace = true;
s.IgnoreProcessingInstructions = true;
s.ValidationType = ValidationType.None;
s.ProhibitDtd = true;
s.ValidationFlags = XmlSchemaValidationFlags.None;

using (XmlReader reader = XmlReader.Create(stream, s))
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Text)
text.Append(reader.Value);
}
}
  #2  
Old August 11th, 2008, 08:25 PM
cody
Guest
 
Posts: n/a
Default Re: Trying to parse OpenDocument files (sxw)

cody wrote:
Quote:
Iam trying to read in sxw files and generate a preview for it.
The problem now is that the file "content.xml" seem to contain a DTD.
I do not want to process this DTD because this is a separate file which
is not available at this time.
>
I tried everything, but no matter what I do I get errors that the DTD is
not found or cannot be accessed due to security reasons.
>
Can't I deactivate usage of the DTD?
>
XmlReaderSettings s = new XmlReaderSettings();
s.IgnoreComments = true;
s.IgnoreWhitespace = true;
s.IgnoreProcessingInstructions = true;
s.ValidationType = ValidationType.None;
s.ProhibitDtd = true;
s.ValidationFlags = XmlSchemaValidationFlags.None;
>
using (XmlReader reader = XmlReader.Create(stream, s))
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Text)
text.Append(reader.Value);
}
}
Sorry for bothering you, it now works. I just had to set XmlResolver to
null :)
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles