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

local DTD but not inlined

Hi,
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?

<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml>
0
mco
Asked:
mco
1 Solution
 
slokCommented:
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
0
 
mcoAuthor Commented:
Are you sure it is not possible to validate
against an alternative offline local DTD.
I am quite sure it is possible.
0
 
slokCommented:
sorry, I miss the part about alternative.

I will withdrew my answer.

0
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.

 
PDurgaPrasadCommented:
Hi MCO,

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.

Prasad.
0
 
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.
0
 
unikenCommented:
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)

Regards,

uniken
0

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