Listing XML Referral Example

<?xm1 version="1.0" encoding="iso-8859-1"?> <?xm1-sty1esheet type="text/xs1" href="Simp1eInput.XSL"?> <eBay>

<eBayTime>2004-02-23 11:37:27</eBayTime> <Search> <Items> <Item> ... Additional Input ...

The listing isn't very long, but the actual file contains all of the entries you'd normally find in a response from eBay Web Services to a GetSearchResu1ts() call. However, it does contain two essential entries that work with the XSLT file. First, notice that this file contains the XSLT reference that the XML from eBay Web Services doesn't contain in the form of an XML stylesheet processing instruction. You must include this glue between the input file and the XSLT file. Second, notice that the root node is <eBay>. The XSLT file looks for this same element.

You have everything needed to get formatted data from eBay using a simple XML/XSLT file pair. You can open the SimpleInput.XML file directly using many of the desktop applications that support XML. However, this combination is more suited to use within Word or another presentation application, rather than Excel, which is an analysis application.

When you open the file, you may see a Convert File dialog box. Make sure you select the XML Document option (Word should highlight it automatically) and click OK. When the document opens, you'll see the SimpleInput.XML file, which might be a little disappointing. However, look at the XML Document pane shown on the right side of Figure 7.1 and you'll notice that you can select Default.XSL (select Browse to load the file). Once you select this option, you'll notice that the Word view changes to the same structured presentation used for XML and HTML documents. When you combine this display with the proper stylesheet, you can create reports directly from Word without relying on any VBA code.

As with many alternatives, this one has problems. First, you might have noticed that I hard coded the Web service query into the XSLT file, making each XSLT file good for only one request. Unfortunately, you probably won't find a way around this problem, which means that you have to use this technique carefully. Second, this solution means that the data often appears in your browser, rather than as part of the application display. Even when it does appear as part of the application display, the data is still HTML, not your document's native format. (You can correct this second problem using specially constructed XSLT files.) Consequently, while this technique does work well, it has limitations that make it unsuitable for some needs.

FIGURE 7.1:

Word 2003 can also interpret XML files for you.

FIGURE 7.1:

Word 2003 can also interpret XML files for you.

Was this article helpful?

0 0
Ebay PowerSeller

Ebay PowerSeller

The Definitive Guide to Becoming an eBay Powerseller guides you through the rules, giving lists of prohibited items, behaviors, and other landmines.

Get My Free Ebook


Post a comment