in reply to DBI and Win32::OLE Conflict?

How about using a signature to verify that both XML strings are the same? Also consider running something this against your data to look for otherwise invisible differences. Be sure to leave white space out of the regex - you want to see which values are being used.

s/([^\w<>])/sprintf "\\%03o", ord $1/e

Update I forgot to terminate the s/// expression and didn't add a /e which completely foiled the point of the exercise.


Fun Fun Fun in the Fluffy Chair

Replies are listed 'Best First'.
Re: Re: DBI and Win32::OLE Conflict?
by Anonymous Monk on Jan 02, 2003 at 20:57 UTC

    I apologize but I couldn't figure out how to get your snipit to work (it kept putting sprintf "\\%03o", ord $1 between the first and second characters of both xml files. I don't think I used it correctly.

    But I did a quick search on this site for "invisible differences" and was pointed to a thread that recommended something called Beyond Compare to compare the two files. I downloaded the program and used it and it says the two xml files are identical.

    How would I go about finding out the signatures? (I said I wasn't very good...nobody believed me :) )

        Sorry I didn't get back to you last night.

        I tried the updated regex and it worked. But the two outputs are still identical.

        I really don't think the XML is the issue. I think this because of the test I mentioned in my first post:

        The important thing to note is that both the XML from the first program and the XML from the second program are identical. As a matter of fact, if I use my "XML Feeder" to feed actual.xml (the XML from the second program - the "supposed" culprit) to QB, QB happily accepts it.

        Meaning that I feed the xml created by the "problem" program to QB. I don't feed it to QB using the problem program but by a third program altogether (the program I use to test QB's reaction to XML). And it works. So, assuming I'm wrong and the XML isn't identical, it doesn't matter. Because QB still accepts it.

        But, just in case you need to see for yourself, here is the XML from the first program (the one that works), as it is ouputed to reinvent.xml:

        <?xml version="1.0" standalone="no"?> <!DOCTYPE QBXML PUBLIC '-//INTUIT//DTD QBXML QBD 1.1//EN'> <QBXML> <QBXMLMsgsRq onError="stopOnError"> <TimeTrackingAddRq requestID="1"> <TimeTrackingAdd> <TxnDate>2003-01-01</TxnDate> <EntityRef> <ListID>40000-1022206382</ListID> </EntityRef> <CustomerRef> <FullName>Cahoots Sports Bar &amp; Grill</FullName> </CustomerRef> <ItemServiceRef> <FullName>AP</FullName> </ItemServiceRef> <Duration>PT00H01M</Duration> </TimeTrackingAdd> </TimeTrackingAddRq> </QBXMLMsgsRq> </QBXML>

        And here is the XML from the second program (the one that is screwing up), as it is outputed to actual.xml:

        <?xml version="1.0" standalone="no"?> <!DOCTYPE QBXML PUBLIC '-//INTUIT//DTD QBXML QBD 1.1//EN'> <QBXML> <QBXMLMsgsRq onError="stopOnError"> <TimeTrackingAddRq requestID="1"> <TimeTrackingAdd> <TxnDate>2003-01-01</TxnDate> <EntityRef> <ListID>40000-1022206382</ListID> </EntityRef> <CustomerRef> <FullName>Cahoots Sports Bar &amp; Grill</FullName> </CustomerRef> <ItemServiceRef> <FullName>AP</FullName> </ItemServiceRef> <Duration>PT00H01M</Duration> </TimeTrackingAdd> </TimeTrackingAddRq> </QBXMLMsgsRq> </QBXML>

        And, after running the regex that you gave me, this is what reinvent.xml turns into:

        <\077xml\040version\075\0421\0560\042\040standalone\075\042no\042\077> +\012<\041DOCTYPE\040QBXML\040PUBLIC\040\047\055\057\057INTUIT\057\057 +DTD\040QBXML\040QBD\0401\0561\057\057EN\047>\012<QBXML>\012\040\040<Q +BXMLMsgsRq\040onError\075\042stopOnError\042>\012\040\040\040\040<Tim +eTrackingAddRq\040requestID\075\0421\042>\012\040\040\040\040\040\040 +<TimeTrackingAdd>\012\040\040\040\040\040\040\040\040<TxnDate>2003\05 +501\05501<\057TxnDate>\012\040\040\040\040\040\040\040\040<EntityRef> +\012\040\040\040\040\040\040\040\040\040\040<ListID>40000\05510222063 +82<\057ListID>\012\040\040\040\040\040\040\040\040<\057EntityRef>\012 +\040\040\040\040\040\040\040\040<CustomerRef>\012\040\040\040\040\040 +\040\040\040\040\040<FullName>Cahoots\040Sports\040Bar\040\046amp\073 +\040Grill<\057FullName>\012\040\040\040\040\040\040\040\040<\057Custo +merRef>\012\040\040\040\040\040\040\040\040<ItemServiceRef>\012\040\0 +40\040\040\040\040\040\040\040\040<FullName>AP<\057FullName>\012\040\ +040\040\040\040\040\040\040<\057ItemServiceRef>\012\040\040\040\040\0 +40\040\040\040<Duration>PT00H01M<\057Duration>\012\040\040\040\040\04 +0\040<\057TimeTrackingAdd>\012\040\040\040\040<\057TimeTrackingAddRq> +\012\040\040<\057QBXMLMsgsRq>\012<\057QBXML>

        And what actual.xml turns into:

        <\077xml\040version\075\0421\0560\042\040standalone\075\042no\042\077> +\012<\041DOCTYPE\040QBXML\040PUBLIC\040\047\055\057\057INTUIT\057\057 +DTD\040QBXML\040QBD\0401\0561\057\057EN\047>\012<QBXML>\012\040\040<Q +BXMLMsgsRq\040onError\075\042stopOnError\042>\012\040\040\040\040<Tim +eTrackingAddRq\040requestID\075\0421\042>\012\040\040\040\040\040\040 +<TimeTrackingAdd>\012\040\040\040\040\040\040\040\040<TxnDate>2003\05 +501\05501<\057TxnDate>\012\040\040\040\040\040\040\040\040<EntityRef> +\012\040\040\040\040\040\040\040\040\040\040<ListID>40000\05510222063 +82<\057ListID>\012\040\040\040\040\040\040\040\040<\057EntityRef>\012 +\040\040\040\040\040\040\040\040<CustomerRef>\012\040\040\040\040\040 +\040\040\040\040\040<FullName>Cahoots\040Sports\040Bar\040\046amp\073 +\040Grill<\057FullName>\012\040\040\040\040\040\040\040\040<\057Custo +merRef>\012\040\040\040\040\040\040\040\040<ItemServiceRef>\012\040\0 +40\040\040\040\040\040\040\040\040<FullName>AP<\057FullName>\012\040\ +040\040\040\040\040\040\040<\057ItemServiceRef>\012\040\040\040\040\0 +40\040\040\040<Duration>PT00H01M<\057Duration>\012\040\040\040\040\04 +0\040<\057TimeTrackingAdd>\012\040\040\040\040<\057TimeTrackingAddRq> +\012\040\040<\057QBXMLMsgsRq>\012<\057QBXML>

        According to that program I downloaded ("Beyond Compare"), they are identical. I'd try to compare them by eye, but my eyes are already strained as it is.