Re: How to read an XML file in Visual C++ 6
- From: "David Webber" <dave@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 7 Dec 2009 10:10:13 -0000
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message news:kqloh5pu9butu1sd7qp0gsojgd75347ei6@xxxxxxxxxx
Because the musicXML data files, which are passed over the internet, start****
with things like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 2.0
Partwise//EN"
"http://www.musicxml.org/dtds/partwise.dtd">
It is really critical that a program I use (such as yours) be usable in any venue under
any conditions...
I agree 100%.
It makes no sense to put a remote URL into a file which is going to be used locally.
But MusicXML is a music notation exchange format to enable different programs to exchange data: one exports in this format, another imports. Such files are designed to be circulated across the internet.
Therefore, given that a doctype statement is required and refers to a DTD for validation, what other option is there than to refer to the DTD maintained by the originators of the format?
It would seem reasonable that a method should exist to validate the document witha replacement DTD - ie tell it to use a version of the .dtd file to be found in a specified place on the local computer.
Going back to my attempts, done a couple or more years ago, to prove I could parse XML:
I was using MSXML (with all the horrible COM stuff). Roughly:
====
MSXML2::IXMLDOMDocumentPtr xd_pDom;
HRESULT hr = xd_pDom.CreateInstance(__uuidof(DOMDocument40));
And then if success so far:
BOOL bResult = TRUE;
xd_pDom->async = VARIANT_FALSE; // default - true,
xd_pDom->validateOnParse = VARIANT_FALSE; // don't check the DTD?
if( xd_pDom->load( _T("MyXMLfile.xml") )!=VARIANT_TRUE )
{
bResult = FALSE;
// .....Cope with failure.......
xd_pDom.Release();
}
else
{
// Successfully loaded:
bResult = TRUE;
}
====
Now it all works, and the pointer to the DOM is usable, if I have an open internet connection, but the load call fails if I haven't.
Even with validateOnParse = VARIANT_FALSE.
A few years ago I started all this to prove the concept of reading and parsing the XML. This was the only showstopper I found. Logic tells me taht somewhere there *must* be a way around demanding validation using the DTD file referenced in the document!
Nowadays, I could probably acept that there's a better chance that anyone doing this has an open broadband connection but i don't want to - for all the reasons you give, and just because it is so inelegant relying on the internet when all I want to do is read a local file.
Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mozartists/mailinglist.htm
joe
****
I'd be very happy to keep a local copy of the DTD in the resources of theJoseph M. Newcomer [MVP]
DLL import module, but I didn't find a way to tell it to use that instead of
the DTD prescribed in the XML file. Am I missing something obvious?
Dave
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: How to read an XML file in Visual C++ 6
- From: Joseph M . Newcomer
- Re: How to read an XML file in Visual C++ 6
- From: Giovanni Dicanio
- Re: How to read an XML file in Visual C++ 6
- References:
- How to read an XML file in Visual C++ 6
- From: marathoner
- Re: How to read an XML file in Visual C++ 6
- From: David Webber
- Re: How to read an XML file in Visual C++ 6
- From: Tom Serface
- Re: How to read an XML file in Visual C++ 6
- From: David Webber
- Re: How to read an XML file in Visual C++ 6
- From: Joseph M . Newcomer
- Re: How to read an XML file in Visual C++ 6
- From: David Webber
- Re: How to read an XML file in Visual C++ 6
- From: Joseph M . Newcomer
- How to read an XML file in Visual C++ 6
- Prev by Date: Re: How to read an XML file in Visual C++ 6
- Next by Date: Re: How to read an XML file in Visual C++ 6
- Previous by thread: Re: How to read an XML file in Visual C++ 6
- Next by thread: Re: How to read an XML file in Visual C++ 6
- Index(es):
Relevant Pages
|