Page 1 of 1

Metadata - export to Access: Comment ..

Posted: Sat Aug 30, 2008 3:41 pm
by Otonicara
Well I can study xml in detail and than I can do phd from Python and finally I can do my own RSS reader. I bought Awasu bacouse of its hook fuctionality and becaouse I expected that main futures are supported by exact samples. I do hope you will provide two lines of code that are needed here in order to close this subject as quick as possible. I know a few xml basic. I do not know what exactly is needed. In case you know solution why I need to spend entire day studing xml, learning by mistakes and consequently posting new questions on here..

Solution ..

Posted: Sat Aug 30, 2008 6:59 pm
by Otonicara
Tag:
ItemMetadata=<value>CORRECTION FROM SOURCE: PlayBOX in Negotiations to Acquire New Visions Mobile</value><group><value>http://www.marketwire.com/mw/release.do?id=882770&sourceType=3</value></group><group><value>OTC Bulletin Board:PYBX</value><value>http://www.marketwire.com/rss/stock</value></group><value>1216986300</value>

Goal:
Extracting tag name='ID'

Code - this seems to work ..
# get our channel values
MetaData = win32api.GetProfileVal( "NewFeedItem" , "ItemMetadata" , "" , configFilename )
MetaData = str(MetaData)
D = MetaData.find('ID')
if D>-1:
start = MetaData.find('ID')
start = (start)+4
end = MetaData.find('</value><value')
MarketInfo = MetaData[(start):(end)]
D2 = MarketInfo.find(':')
if D2>-1:
split = MarketInfo.split(':')
StockMarket,Ticker = split
xTicker = (Ticker)
else:
xTicker = "No Ticker"
else:
xTicker = "No ID Tag"

Xpath solution would be very welcome as it is probably more stabile..

Re: Metadata - export to Access: Comment ..

Posted: Sat Aug 30, 2008 7:15 pm
by support
Otonicara wrote:I do not know what exactly is needed.

Neither do I.

I don't know much about XPath (other than it's probably the best way to do what you're looking to do), so to answer your question, I would need to do a lot of investigation, go through the tutorials I linked to previously, etc.

Yes, it's a bit of work, especially if you don't know much about XML, but these forums are for <u>Awasu-specific</u> issues e.g. how does Awasu communicate with plugins, such-and-such a feature in Awasu doesn't seem to work properly, I would like to request a new feature in Awasu, etc. How to parse XML in Python is a Python/XML issue and there are other websites/newsgroups devoted to these topics. We've had people coming here looking for help on removing viruses from their computer or downloading software from other sites. These are clearly outside the scope of these forums, as is the question of how to parse XML in Python.

Otonicara wrote:I expected that main futures are supported by exact samples.

We cannot possibly provide samples that cover every possible situation that every possible customer could ever possibly want so we provide samples that demonstrate broad guidelines on how to write plugins, etc. Unfortunately, it's the nature of the beast that if you want to write programs to do do stuff, you need to be able to program and if you want to write programs that deal with XML, you need to know how XML works.

Re: Solution ..

Posted: Sat Aug 30, 2008 7:18 pm
by support
Otonicara wrote:Code - this seems to work ..

Yes, it probably will. Parsing XML using string functions is notoriously unreliable but it will probably be OK. XPath is doing things "the right way" but if this works, then it's probably good enough :-)