Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Getting text files with quotation marks into Stata


From   Steven Samuels <sjhsamuels@earthlink.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Getting text files with quotation marks into Stata
Date   Fri, 7 Nov 2008 16:08:19 -0500

I get the same error. On a Mac (OS X 10.4.11) at least, the xml files are plain text files. The solution is to -infix- a single string variable with length equal to the maximum of the data lines Then use - regexm- to extract the pieces.

****************Code Begins************
infix str dummy 1-90 using dd.xml, clear
***************Code Ends**************

-Steve
On Nov 7, 2008, at 2:51 PM, Dan Weitzenfeld wrote:

Hi Folks,
I'm trying to read .xml files into Stata.  Once there, I can parse
them, even if they are read into just one variable - I'm handy with
-regexm- and the like.
My problem is that I can't seem to get around the quotation marks in
the file.  Two rows of the file look like this:

  <session="NCX_1" target="entrance" movie="0" start="22:22:23.000"
duration="199" />
  <session="NCX_2" target="floor" movie="0" start="22:22:24.000"
duration="179" />


When I insheet, I get

199/>
179/>

When I xmluse, I get

unrecognizable XML doctype
r(198);

regardless of which doctype I specify.


Are there any tricks for getting Stata to ignore the quotation marks
within the file?
Thanks,
Dan
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index