Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

External XML Document Translated to HTML 1

Status
Not open for further replies.

intranetgeeky

Programmer
Jun 12, 2003
17
US
I'm totally new to XML. I've been reading up on it and everything made sense until I came upon this problem. I have an external XML document located on another server that I have to receive stock information from and display on the website I'm creating. I only need 4 of the values from the XML document (Last, Net)for our company, and (Last, Net) for the DJI. The XML Document looks kinda like this:

<?xml version=&quot;1.0&quot; ?>
- <StockQuote Date=&quot;06-12-03&quot; Time=&quot;15:33 EDT&quot;>
<Symbol Ticker=&quot;FFF&quot; URL=&quot; Last=&quot;33.56&quot; Net=&quot;0.28&quot; Time=&quot;0.28&quot; Size=&quot;800&quot; Volume=&quot;13,993,100,000&quot; Open=&quot;13,993,100,000&quot; High=&quot;33.65&quot; Low=&quot;33.15&quot; Close=&quot;33.28&quot; Bid=&quot;33.28&quot; Ask=&quot;33.28&quot; Yrhigh=&quot;37.04&quot; Yrlow=&quot;25.13&quot; Divfreq=&quot;25.13&quot; Dividend=&quot;0.15&quot; Eps=&quot;1.50&quot; Shares=&quot;7,894,470&quot; Peratio=&quot;22.37&quot; Divdate=&quot;22.37&quot; Volatility=&quot;0.52&quot; Yield=&quot;1.78&quot; />
<Symbol Ticker=&quot;^DJI&quot; URL=&quot; Last=&quot;9,184.08&quot; Net=&quot;0.86&quot; Time=&quot;0.86&quot; Size=&quot;0&quot; Volume=&quot;0&quot; Open=&quot;0&quot; High=&quot;9,236.11&quot; Low=&quot;9,116.86&quot; Close=&quot;9,183.22&quot; Bid=&quot;9,183.22&quot; Ask=&quot;9,183.22&quot; Yrhigh=&quot;9,775.83&quot; Yrlow=&quot;7,177.66&quot; Divfreq=&quot;7,177.66&quot; Dividend=&quot;0.00&quot; Eps=&quot;0.00&quot; Shares=&quot;0&quot; Peratio=&quot;0.00&quot; Divdate=&quot;0.00&quot; Volatility=&quot;0.00&quot; Yield=&quot;0.00&quot; />
</StockQuote>

Is there an easy way of just displaying those four values on my site?
 
Can you use XSL style sheets on your server? You need to find some way to work with the tags in the XML file, ASP, XSL, etc. Which will you be using?
 
I'm trying to encorporate this file into an existing website that does not use XSL. It does use ASP extensively, and I'm familiar with that. Any ideas on how to get XML values through ASP?

Thanks for the response!
 
1) If you are not using any style sheet like CSS file then you need to add one more line to mention dtd file, here what is:

<?xml version=&quot;1.0&quot;?>
<!DOCTYPE my-resume SYSTEM &quot;resume.dtd&quot;>

In aboe line: my-resume is root tag name in dtd and resume.dtd is dtd file name.

2) If you are using any style sheet like CSS or XSL file then you need to add two more lines to mention dtd file and CSS or XSL file, here what is:


<?xml version=&quot;1.0&quot;?>
<!DOCTYPE my-resume SYSTEM &quot;resume.dtd&quot;>
<?xml-stylesheet href=&quot;rich.xsl&quot; type=&quot;text/xsl&quot;?>

rich.xsl is XSL file name, it can be replaced with CSS if you are using it.
 
Will this still work with a file that is located on a different server?

Once I get that, how do I go about finding the 4 points of information that I need and displaying them?

Thanks
 
all of your files like: CSS, XSL, DTD and XML should locate only at one server because these files are dependent on each other.

How to display only 4 points there are 2 ways:

1) if using CSS or XSL for formating and accessing xml data then only format 4 points you want to display, do not format rest of all.

2) if using CSS for formating then you can format whole document but only show 4 points you want and hide rest of all. CSS has one property &quot;hide&quot;
e.g. tag name{visibility: hide}, you can hide or do not include in your CSS or XSL.
 
RATS. The server I'm trying to get to is in New York, and all I have is the URL of where the XML document is stored.

I was kind of hoping there would be a way to actually &quot;look&quot; at the XML document itself, and then do a kind of linear search via ASP, looking for key tags and then outputting their values. But, if everything needs to be located on the same server, I guess this is a lost cause. :(

Thanks anyway vijjay. :)
 
I am not sure exactly how to access xml file from different server. One last thing I can suggest is: if you know how to parse an xml document then it can sovle your problem.

you can use any language like java, asp, vb etc. to parse a document. one parser is DOM and other one is SAS or so. But exactly I do not know how they work.

If throug any language like java/asp, you can access this xml file then parse this document and access only required tags and you are fine.

Hopefully it will give you some more thoughts.
Sory for wasting your time.
 
Thanks for that lead. I'm looking into using a parser to use ASP to get the info I need. I'll keep you up-to-date if I figure it out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top