Prev: jobvermittlung , jobboerse schweiz , jahr im ausland arbeiten , jobboerse karriere , arbeitsagentur jobs im ausland , jobs im ausland spanien , jobs in ausland ,
Next: Another CTabCtrl question.....
From: David Webber on 7 Dec 2009 07:59 "Giovanni Dicanio" <giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote in message news:epcCoGzdKHA.6000(a)TK2MSFTNGP06.phx.gbl... > "David Webber" <dave(a)musical-dot-demon-dot-co.uk> ha scritto nel messaggio > news:Oil9GWydKHA.5228(a)TK2MSFTNGP06.phx.gbl... > >> 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. > [...] >> I was using MSXML > > Unfortunately, it seems to me that custom resolving for external resources > is not supported by MSXML: > > http://social.msdn.microsoft.com/Forums/en/msxml/thread/af477368-6f40-4f10-b941-02853da8909e Thanks Giovanni - that would explain why I couldn't find how to do it. (I suppose the real kludge of a method would be to read the XML file and copy it to a temporary file with the DTD replaced in the DOCTYPE statement by a local copy. <g>). > But I would try with Xerces... I think I will. I'll continue with MSXML for a while as I have a lot of code I need to review, but I think most of it just uses a pointer to the DOM and what I believe are its standard methods, so when I get back into XML - it has been a while - I can try switching to using XERCES - or the http://www.firstobject.com/ CMarkup class which looks nice but costs money :-( >> (with all the horrible COM stuff). > > The "horrible COM stuff" :) can be made less horrible thanks to smart > pointers like CComPtr, but they do have 'gotchas', too... > e.g. > > "We're using a smart pointer, so we can't possibly be the source of the > leak" > http://blogs.msdn.com/oldnewthing/archive/2009/11/19/9924950.aspx > > and the solution to the bug here: > > http://blogs.msdn.com/oldnewthing/archive/2009/11/20/9925918.aspx > I tend to be a bit masochistic with COM - I only find myself having to use it once in a while, so it is good for me to be reminded of the gory details. Is that sad or what? 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
From: DanB on 7 Dec 2009 12:04 Giovanni Dicanio wrote: > > But I would try with Xerces... Hi Giovanni, I looked at this a while back as an alternative to wrapping msxml. At the time it did not have reasonable xpath support. From today's search: <http://xqilla.sourceforge.net/HomePage> I'll have to look it over. I would prefer a cross platform engine and why I went with tiny the first time. Have you use xqilla? Opinion? Thanks, Dan.
From: Giovanni Dicanio on 7 Dec 2009 12:11 "David Webber" <dave(a)musical-dot-demon-dot-co.uk> ha scritto nel messaggio news:#VpNv0zdKHA.2160(a)TK2MSFTNGP02.phx.gbl... >> http://social.msdn.microsoft.com/Forums/en/msxml/thread/af477368-6f40-4f10-b941-02853da8909e > > Thanks Giovanni - that would explain why I couldn't find how to do it. Dave: you are welcome. > (I suppose the real kludge of a method would be to read the XML file and > copy it to a temporary file with the DTD replaced in the DOCTYPE statement > by a local copy. <g>). I like this! :) Giovanni
From: Joseph M. Newcomer on 7 Dec 2009 13:05 See below... On Mon, 7 Dec 2009 10:10:13 -0000, "David Webber" <dave(a)musical-dot-demon-dot-co.uk> wrote: > >"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message >news:kqloh5pu9butu1sd7qp0gsojgd75347ei6(a)4ax.com... > >>>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? **** True, but the way this should work is to look for the DTD. If there is no network connectivity, use the most-recently-cached version. If there is connectivity, see if the version changed, and if it changed, download it, but never put this in the critical path of my opening a file. Instead, in the background, run an "update thread" that checks for updates once a day, or whenever, and not put the Internet between my request to open a local file and the actual realization of that. For example, should I wait 70 seconds for a DNS timeout each time I want to open a file? I don't think so. **** > >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. **** Then that reflects a design defect of the IXMLDOMDocument: that it foolishly believes that it MUST use the network copy. That is essentially impossible. Connectivity *cannot* be assumed in such cases! **** >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! **** Probably because the naive designers of these libraries have never, ever, once in their entire professional lives, been on a computer that did not have a high-bandwidth connection to the Microsoft servers, so how could anyone possibly live any other way? Never mind that a huge number of people do not have connectivity 24/7, and some of us even travel and have to use our computers in sites which either have no connectivity or forbid connectivity. One argument for using open-source XML libraries: you can fix it to meet your needs. A sign that Microsoft has gotten too big is their reliance on designers who never encountered the real world, but whose designs are so accepted that nobody questions the basic assumptions, such as "does this make sense?" This is what killed IBM in the PC marketplace. And now Microsoft is doing it. **** > >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. **** So find a library that either meets your needs or which can be modified to meet them. joe **** > >Dave Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Giovanni Dicanio on 7 Dec 2009 17:15
Hi Dan, "DanB" <abc(a)some.net> ha scritto nel messaggio news:jAaTm.66643$rE5.55033(a)newsfe08.iad... > I looked at this a while back as an alternative to wrapping msxml. At the > time it did not have reasonable xpath support. From today's search: > > <http://xqilla.sourceforge.net/HomePage> I ignored this library. Thanks for the link! Giovanni |