Closed Thread Icon

Topic awaiting preservation: outputting XML with php Pages that link to <a href="https://ozoneasylum.com/backlink?for=12270" title="Pages that link to Topic awaiting preservation: outputting XML with php" rel="nofollow" >Topic awaiting preservation: outputting XML with php\

 
Author Thread
GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 06-16-2002 21:27

when i try to create dynamically content and write it out to an XML using php, i can only see the XML structure in the source of the file.

its not a problem, cause everything works fine, but i just wondered if this behaviour is normal.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-16-2002 21:40

IE normally displays XML as a collapsable tree. Is this the behavior you're referring to?

If you use an XSL style sheet with it to change it into HTML, IE will display it normally.

It's possible that using a CSS style sheet with it will also make IE display it visually, but I haven't tried that.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 06-16-2002 22:26

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 06-16-2002 23:11

no. im getting a totally blank screen.
the xml is only viewable when i go to view source.

im using it for a flash interface that has dynamic content. and flash can read xml very fine if you put it all in one single line without any blanks.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-16-2002 23:55

Without any blanks? Blah, sounds like Flash doesn't read it all that well in that case =)

Anyway, perhaps you formatted your XML incorrectly? It's possible that IE is *trying* to display it in it's special way, but is unable to for some reason. Why don't you give us an example of one of the XML documents that you're generating?

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 06-17-2002 00:14

yes, maybe. but its not only IE. it doesnt show up in any browser.
http://www.embege.com/logger.php

btw, the whitespace is a remaining "bug" from flash 5. mx already reads common xml.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-17-2002 00:20

Are you sure you're sending the content-type correctly?

I don't use PHP, but with Perl i would say something like

print "Content-type:text/xml;\n\n";

Er, I forget the exact syntax, but something like that. (Come to think of it, I don't think text/xml is an allowed format... or maybe it is, i forget.)

But I say this because it's a .php request that you're sending to the browser, and if the browser doesn't know that it's XML, then it might be confused about what to do with the text it gets.

Maybe it's possible the encoding you're specifying isn't handled. I don't know much about encodings though.

It's also a possibility that you're required to have a line break after the <?xml?> instruction. Again, I'm not sure.

So there are some random guesses for you =) I suppose if it works in Flash, then it doesn't really matter all that much though.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 06-17-2002 00:53

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 06-17-2002 10:39

nope, sorry. that didnt make a difference.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 06-17-2002 18:07

Yeah it's probably just not realizing it's xml.

Actually I see it as an XML file.
But it will normally show up blank if it doesn't realize it's an XML file. Generally browsers just ignore stuff between tags it doesn't recognize that's why it's showing up blank.



.:[ Be Bert. Be Ernie. Just be. ]:.

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 06-17-2002 18:12

so why do normal xml not show up blank?
because of the ending? *.xml?

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 06-18-2002 09:52

What file-extension are you using?
Try changing it to XML to see if the code is formatted correctly.
Then, if I understand IE correctly, as an example, it actually checks the content itself and doesn't apply that much value to what headers are sent. What it does is to make two calls for the file as you click a link, the first is used to evaluate the file based on header, extension and some other criterias, then it decides on how to display it. Then it gets the file for display.

I've been through h*ll with this trying to fool IE to prompt the "safe file as" box instead of opening a .dot file.

One tip in this case is to apply CSS to the output XML-material, that might help.
/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 06-18-2002 11:22

im geneating the xml automatically with php so the extension is .php and i dont think i can change it to .xml.

stinx
Bipolar (III) Inmate

From: London, UK
Insane since: Apr 2002

posted posted 06-18-2002 12:33

You should be able to save a copy of the generated output and rename it locally though...?

There's another tag you can output - this one is needed for vml. I suspect it might help for general xml. It needs to be on the first line of output IIRC
<?xml version="1.0"?>

And no, that's not a php tag - You'll probably have to encapsulate it in an echo statement so that php doesn't try to interpret it! e.g. <?echo "<?xml version=\"1.0\"?>\n";?>

Then you might want to think about adding a DOCTYPE declaration. I'm none too hot on these, but the doctype declaration for vml is
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.WAPforum.org/DTD/wml_1.1.xml">



WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 06-18-2002 16:00

Works on my IE 6.0

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 06-18-2002 17:32

Yes, it works for me, too. But, first time when I checked it didn't work for me either... Grumble, did you change something in the meantime?


GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 06-18-2002 17:58

yes, meanwhile it works for me too.
i didnt change anything except the content-type slime suggested.

maybe i had the old one in the cache, so i didnt see it immediately after i changed it!

hehe.

« BackwardsOnwards »

Show Forum Drop Down Menu