Solved

local DTD but not inlined

Posted on 2000-03-01
6
336 Views
Last Modified: 2013-11-19
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
Comment
Question by:mco
6 Comments
 
LVL 3

Expert Comment

by:slok
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
0
 
LVL 1

Author Comment

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

Expert Comment

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

I will withdrew my answer.

0
3 Use Cases for Connected Systems

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

 

Expert Comment

by:PDurgaPrasad
ID: 2576108
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
 
LVL 1

Author Comment

by:mco
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.
0
 
LVL 1

Accepted Solution

by:
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)

Regards,

uniken
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

831 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