XML and DOM through MFC?

I am new to DOM and XML.
1. Certain device commands are to be stored in a reference file. The 
commands exchanged between the device and the PC should be trapped. The 
trapping component must parse through the reference file. It is recommended 
that the reference file be XML. Can I access Microsoft DOM through MFC?

2. The commands that are exchanged are to be stored as HTML and RTF. How can 
I do it through MFC?
0
5/27/2006 10:59:02 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
644 Views

Similar Articles

[PageSpeed] 43

Harish wrote:
> I am new to DOM and XML.
> 1. Certain device commands are to be stored in a reference file. The 
> commands exchanged between the device and the PC should be trapped. The 
> trapping component must parse through the reference file. It is recommended 
> that the reference file be XML. Can I access Microsoft DOM through MFC?
> 
> 2. The commands that are exchanged are to be stored as HTML and RTF. How can 
> I do it through MFC?

Harish:

1. The Microsoft XML parser is called MSXML. AFAIK there are no MFC 
sepecific commands for working with it, but MSXML is a COM interface so 
you can access it using CoCreateInstance() etc. If you use .NET there 
are nicer ways to interact with XML (I am told).

2. If I were you I would use XHTML rather than HTML. One way to write it 
is to use MSXML. RTF can be written using CRichEditCtrl.

David Wilkinson


0
no-reply8010 (1791)
5/27/2006 11:44:42 AM
DOM is a really poor document mechanism, and in general it is very, very limited in what
it allows you to do (I wouldn't touch it with a ten-foot pole).  But if you have to use
it, there are a lot of XML packages, including one from Microsoft (MSXML, I think the
acronym is).  I believe it is an ActiveX interface, which means you import it into MFC and
it should work just fine.  

I tend to use third-party open-source libraries like ExPat (the problem with DOM is that
you can't build graphs, either cyclic or acyclic; you are limited to trees, far to
limiting for serious work).

HTML and RTF are sort-of-unrelated; both deal with formatting and layout (while XML deals
with syntax and allows imposition of semantics on top of syntax).  Do you mean how do you
parse HTML or RTF, or how do you just send them?  As far as sending them, they're just
characters.  As far as parsing HTML, most XML parsers can parse well-formed HTML, but HTML
is rarely well-formed (most of the ill-formed features, such as <p> without matching </p>,
have been deprecated, but they persist and a parser has to deal with them.  I've written
HTML parsers, and they are Not Fun To Write because of all the syntax anomalies).  rtf is
specified in a document available from Microsoft, and most new Office products and other
Microsoft products conform to the new RTF standard, but older products, third-party
products, and hand-written RTF do not have such well-behaved guarantees.  It has been a
*very* long time since I last parsed RTF, but at least in the tools I was using, I recall
it was very straightforward.
				joe

On Sat, 27 May 2006 03:59:02 -0700, Harish <Harish@discussions.microsoft.com> wrote:

>I am new to DOM and XML.
>1. Certain device commands are to be stored in a reference file. The 
>commands exchanged between the device and the PC should be trapped. The 
>trapping component must parse through the reference file. It is recommended 
>that the reference file be XML. Can I access Microsoft DOM through MFC?
>
>2. The commands that are exchanged are to be stored as HTML and RTF. How can 
>I do it through MFC?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15973)
5/28/2006 2:37:45 AM
Reply:

Similar Artilces: