local DTD but not inlined

Posted on 2000-03-01
Last Modified: 2013-11-19
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?

Question by:mco

Expert Comment

ID: 2575079
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

Author Comment

ID: 2575570
Are you sure it is not possible to validate
against an alternative offline local DTD.
I am quite sure it is possible.

Expert Comment

ID: 2575849
sorry, I miss the part about alternative.

I will withdrew my answer.

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.


Expert Comment

ID: 2576108

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.


Author Comment

ID: 2576844
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.

Accepted Solution

uniken earned 200 total points
ID: 2600633
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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Facebook React and SyntheticEvents 6 70
Excel file not created as expected 7 79
.net and XML report from SCCM 5 41
TSQL Query Into Specific XML Format 3 24
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
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.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

792 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