From: dpb on
Dennis Rose wrote:
....

> What's wrong with my code at the first of this post? ...

Mostly that it has been determined that you don't have XML but
QP-encoded data.

Where there's code for it I don't know; how significant an issue it
would be for your application would, I think, depend on just how much of
this you need to decode/parse.

--
From: Dee Earley on
On 04/06/2010 18:39, Dennis Rose wrote:
> "Dee Earley" wrote:
>> On 04/06/2010 16:49, dpb wrote:
>>> I don't know whether Notepad knows how to decode QP-encoded text or not;
>>> I'd not trust it for this job to not do so and hence display the
>>> embedded "=3D" string as simply "=" which is what is confusing Dennis
>>> when he (I think/infer) looks at the string in his e-mail client and
>>> tries to build the matching string pattern(s). It automagically decodes
>>> (in this case _not_ helpfully) for him leaving him grasping a ephemeral
>>> wisps... :)
>>
>> The only file "formats" notepad recognises is the various UTF* formats.
>> Everything else is just text.
>
> What's wrong with my code at the first of this post? After all it was your
> idea for me to use a "proper" email parser and I would still like to use a
> real parser!!

I said a proper XML parser which you now have.
That doesn't change the fact that your input data is still "broken"
You need to decode it back to plain text/valid XML, before you can do
anything with it.

Quoted printable decoding is easy to decode, but you should only do it
if you need to. How you determine this depends on the mail/MIME library
you're using.

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
From: Mayayana on
Wouldn't it make a lot more sense to just
ask them to write it differently? They could
send an XML file attachment. Or they could
send a simple email where it's delineated
by line. (I don't understand why so many people
think that data isn't official until it's been
packaged in XML.)

Customer:
Lisa
Smith
22 Main St.
Somewhere
CA
Customer:
Tom

etc...
--
| I am using VB5 and have decided to take this route because of problems
using
| INSTR to parse the XML email(see my post on 6/2/10).
|

It should work fine, but you can also drop the
quotes for convenience if necessary. Just
find "<name " and then the next ">" and you
have the tag. You can easily replace the quotes
with "" in that.

Or quicker might be to just find
< offset, > offset, and then do InStr. I parse HTML
that way. I search by = since quotes are
not dependable, using InStrRev to walk backward
through a tag looking for = and then finding the
attribute and value by finding the next space or >
back and forward.

In your case maybe something like this:

Pt1 = Instr(PtStart, sEmail, "first", 1)
If Pt1 > 0 and Pt1 < 10 then
'this is the first name
Else
Pt1 = Instr(PtStart, sEmail, "last", 1)
If Pt1 > 0 and Pt1 < 10 then
'this is the last name
else
'this is the middle name
End If
End If


| I am trying to use the XML parser example code below but can't get it to
work:
|
| Dim objXML As MSXML2.DOMDocument
| Dim strXML As String
| Dim xmlElem As IXMLDOMElement
|
| Set objXML = New MSXML2.DOMDocument
|
| strXML = txtShowPrintArea ' "txtShowPrintArea" contains the XML
formatted
| Email
|
| If Not objXML.loadXML(strXML) Then ' #### pgm crashes at this line of
code
| ######
| Err.Raise objXML.parseError.errorCode, , objXML.parseError.reason
| End If
|
| '**** get first name
| Set xmlElem = objXML.selectSingleNode("//name part=""first""")
| If Not xmlElem Is Nothing Then
| MsgBox xmlElem.Text
| End If
|
| I get the following error:
| Invalid at the top level of the document.
|
| I checked Google but still can't solve it. What's wrong with my code?????
|
| Help
|
|


From: Dee Earley on
On 07/06/2010 13:33, Mayayana wrote:
> I don't understand why so many people
> think that data isn't official until it's been
> packaged in XML.

"Official" doesn't come into it.

It's more extensible, easier to parse, safe to parse through many
encoding formats, compresses well.
These are among the reasons I replaced my (almost extensible, but
fragile and only forwards compatible) binary formats with XML, and did
the same for our "legacy" line based (very difficult to extend) and INI
based communications formats.

Yes, many other formats also allow these (JOSN, ASN.1, etc) and they all
beat the legacy formats and XML was easy :)

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
From: Mayayana on
| > I don't understand why so many people
| > think that data isn't official until it's been
| > packaged in XML.
|
| "Official" doesn't come into it.
|

Then why is someone trying to send names
in XML via email why someone else tries to
parse it at the other end? Doesn't that seem
less than ideal to you?

Opinions may vary about when/where/if XML
is useful, but I think most people will agree
that whatever else XML is, it's also an overdone
fad, often being used in places where it's superfluous
at best.

| It's more extensible, easier to parse, safe to parse through many
| encoding formats, compresses well.

More than...? Easier than...? In any particular
context? ...That's my point. It's a tool, not a value
judgement.