Jump to content

view online xml with tags


michaelfurey

Recommended Posts

I have to generate the following text with a php script in the server and render it in chrome, then copy it manually with the mouse and finally paste it manually in a xml file located in my desktop pc.

 

The text is the following:

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

<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
  <orderperson>John Smith</orderperson>
  <item>
    <title>Hide your heart</title>
    <quantity>1</quantity>
    <price>9.90</price>
  </item>
  <item>
    <title>Hide your heart</title>
    <quantity>1</quantity>
    <price>9.90</price>
  </item>
</shiporder>

The problem is that I have to render in the browser also the tags and the text included inside the tags... is it possible to render that text in chrome in that way?

Link to comment
Share on other sites

view-source:http://domain.tld/path/to/script.php
Or make the script force a download instead of showing it in the browser.

 

Or run PHP on your own computer and have it generate the file directly in the place you want.

 

Or one of a bunch of other things.

Link to comment
Share on other sites

If you want to display the XML rather than have chrome try to interpret it then run it through htmlspecialchars prior to displaying it.

echo '<p>The HTML code is:</p>';
echo '<code>' . htmlscpecialchars($xml) . '</code>';

Ok perfect that I wanted to know! I apreciated also the test that you created for me to check if I have some problem solving skills ( " htmlsCpecialchars($xml) " ).

Link to comment
Share on other sites

view-source:http://domain.tld/path/to/script.php
Or make the script force a download instead of showing it in the browser.

 

Or run PHP on your own computer and have it generate the file directly in the place you want.

 

Or one of a bunch of other things.

 

Is it possible to download the output of the previous code from the server to the client? In that way I should obtain the xml content in the client without copying and paste through the browser.

 

In other words I would like to run a file located in the server that generates the xml file and to download it authomatically to the client.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.