Help using Base SAS procedures

XML Namespace Issue (%gettweet macro)

Reply
Contributor
Posts: 53

XML Namespace Issue (%gettweet macro)

I'm trying to use the %gettweet macro downloaded from here: http://support.sas.com/resources/papers/proceedings11/324-2011.pdf

I'm getting the following error:

filename XMLLib "&PATH/twitterOutput.xml";

libname XMLLib xml xmlmap=SXMLMAP ACCESS=readonly;

NOTE: Libref XMLLIB was successfully assigned as follows:

      Engine:        XML

      Physical Name: XMLLIB

ERROR: Namespace was not declared previously.

       encountered during XMLInput parsing

       occurred at or near line 15, column 22340

I think the problem lies somewhere in my XML map file, pasted below.  Any suggestions?

(%gettweet)

<?xml version="1.0" encoding="UTF-8"?>

<SXLEMAP name="Tweet" version="1.2">

    <TABLE name="entry">

        <TABLE-DESCRIPTION>entry</TABLE-DESCRIPTION>

        <TABLE-PATH syntax="XPath">/feed/entry</TABLE-PATH>

        <COLUMN name="entry_ORDINAL" ordinal="YES">

            <INCREMENT-PATH beginend="BEGIN" syntax="XPath">/feed/entry</INCREMENT-PATH>

            <TYPE>numeric</TYPE>

            <DATATYPE>integer</DATATYPE>

        </COLUMN>

        <COLUMN name="id">

            <PATH syntax="XPath">/feed/entry/id</PATH>

            <TYPE>character</TYPE>

            <DATATYPE>string</DATATYPE>

            <LENGTH>38</LENGTH>

        </COLUMN>

        <COLUMN name="published">

            <PATH syntax="XPath">/feed/entry/published</PATH>

            <TYPE>numeric</TYPE>

            <DATATYPE>datetime</DATATYPE>

            <FORMAT width="19">IS8601DT</FORMAT>

            <INFORMAT width="19">IS8601DT</INFORMAT>

        </COLUMN>

        <COLUMN name="title">

            <PATH syntax="XPath">/feed/entry/title</PATH>

            <TYPE>character</TYPE>

            <DATATYPE>string</DATATYPE>

            <LENGTH>139</LENGTH>

        </COLUMN>

        <COLUMN name="updated">

            <PATH syntax="XPath">/feed/entry/updated</PATH>

            <TYPE>numeric</TYPE>

            <DATATYPE>datetime</DATATYPE>

            <FORMAT width="19">IS8601DT</FORMAT>

            <INFORMAT width="19">IS8601DT</INFORMAT>

        </COLUMN>

        <COLUMN name="twitter_source">

            <PATH syntax="XPath">/feed/entry/twitter:source</PATH>

            <TYPE>character</TYPE>

            <DATATYPE>string</DATATYPE>

            <LENGTH>49</LENGTH>

        </COLUMN>

        <COLUMN name="twitter_lang">

            <PATH syntax="XPath">/feed/entry/twitter:lang</PATH>

            <TYPE>character</TYPE>

            <DATATYPE>string</DATATYPE>

            <LENGTH>2</LENGTH>

        </COLUMN>

        <COLUMN name="uri">

            <PATH syntax="XPath">/feed/entry/author/uri</PATH>

            <TYPE>character</TYPE>

            <DATATYPE>string</DATATYPE>

            <LENGTH>34</LENGTH>

        </COLUMN>

        <COLUMN name="content">

            <PATH syntax="XPath">/feed/entry/content</PATH>

            <TYPE>character</TYPE>

            <DATATYPE>string</DATATYPE>

            <LENGTH>444</LENGTH>

        </COLUMN>

    </TABLE>

</SXLEMAP>

SAS Super FREQ
Posts: 8,744

Re: XML Namespace Issue (%gettweet macro)

Hi:

  Generally, you would contact the paper author's for help with their macro program. Perhaps there is something that they did not anticipate when they wrote their macro program.

  If you can't contact the paper authors, you might want to open a track with Tech Support.

cynthia

New Contributor
Posts: 2

Re: XML Namespace Issue (%gettweet macro)

I couldn't get it to work either -

Trusted Advisor
Posts: 1,300

Re: XML Namespace Issue (%gettweet macro)

Twitter dropped support of their RSS/XML output from their API a few months ago, around September of 2012, I believe, which would render this code pretty much, obsolete...  It would need to be redone using the current API v 1.1 and JSON output.

New Contributor
Posts: 2

Re: XML Namespace Issue (%gettweet macro)

but the %gettweet macro should still work today even if it will be obsolete in the future - correct?  The paper which goes through the %gettweet macro

here: http://support.sas.com/resources/papers/proceedings11/324-2011.pdf

never provided the map file and thus this is hard to get working - did you get it to work ?  Is there a .map file for this ?  Thanks,

Trusted Advisor
Posts: 1,300

Re: XML Namespace Issue (%gettweet macro)

If Twitter still had the old XML service running then the code should continue to work, however, this program does indeed depend on there being an XML Map file created, which was not included in the appendix, you can attempt to contact the paper's author.  Alternatively you could build your own map using the tool from SAS.

Ask a Question
Discussion stats
  • 5 replies
  • 388 views
  • 1 like
  • 4 in conversation