• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

local DTD but not inlined

I have read many postings on the subject but I am still confused.
I want to supply an application that can validate XML.
I am using the Microsoft parser.

How do I supply a DOCTYPE such that
1) it is not inlined
2) the application will not access the URL (it might be offline)

For example:
Where with a MS parser, will the following DTD be searched, assuming no
internet connection?

1 Solution
In this case, your application needs
to handle the 'offline' scenario.

When it is offline, you will probably
do parse the XML without validating
against the DTD.

Hope this helps
mcoAuthor Commented:
Are you sure it is not possible to validate
against an alternative offline local DTD.
I am quite sure it is possible.
sorry, I miss the part about alternative.

I will withdrew my answer.

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Write the DTD and save that as .DTD file. And in the XML file, which would be validated by the DTD written previously, you have to specify in the following way to vaidate that XML file,

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CompanyOrders SYSTEM "xxx.dtd">

The above will work perfectly. And the DTD file should be saved in the directory of that XML file for the above syntax. If the DTD was there some where else, then simply specify the path within the quotes as,

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CompanyOrders SYSTEM "yyy/zzz/xxx.dtd">

This will work as offline DTD. Hope this was what you want.

mcoAuthor Commented:
Thanks, but this does not solve the problem.
What you are suggesting is that the XML will be written especially to look at the local file.
I want the XML to include the correct global
URL, but that my application would validate it against a local copy, in order that it would work also while offline.
You can't tell MSXML to use an alternative DTD. It automatically uses the one declared in the DOCTYPE declaration.

The document object has a doctype property exposed but it is READ ONLY. So you can't change the doctype declaration after you have loaded the XML file into the DOM either.

The only way to achieve what you want is to change the actual text of the doctype declaration programatically before loading into MSXML.

The MS parser doesn't try to look anywhere else if the specified URL is not reachable. (nor do any others I know)



Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now