473,327 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

XML Issues

Hi, building a database backend for a Google Map application.
Struggling along in PHP (I'm a java dude) but doing pretty good. The
code below has me confused. Both will create valid files if sent to a
file. Both display perfectly in browser when you access the script
directly. However, only the 2nd one sends readable data back to my
application. The first one generates no elements errors.

Anyone have an idea why this doesn't work:

<?php
$xmlDocument = domxml_new_doc('1.0');
$documentElement = $xmlDocument->create_element('soldiers');
$xmlDocument->append_child($documentElement);
$god = $xmlDocument->create_element('soldier');
$god->append_child($name);
$name = $xmlDocument->create_attribute('rank', 'MSG');
$god->append_child($name);
$name = $xmlDocument->create_attribute('name', 'Joe, G.I.');
$god->append_child($name);
$name = $xmlDocument->create_attribute('street', '2600 North Highlands
Avenue');
$god->append_child($name);
$name = $xmlDocument->create_attribute('city', 'Atlanta');
$god->append_child($name);
$name = $xmlDocument->create_attribute('state', 'DC');
$god->append_child($name);
$name = $xmlDocument->create_attribute('zip', '30101');
$god->append_child($name);
$name = $xmlDocument->create_attribute('lat', '34');
$god->append_child($name);
$name = $xmlDocument->create_attribute('lng', '-84');
$god->append_child($name);
$documentElement->append_child($god);
echo $xmlDocument->dump_mem(true, 'UTF-8');
?>

and this:

<?php
header("content-type:text/xml");
print '<?xml version="1.0" encoding="ISO-8859-1"?>';
print '<soldiers>';
print "<soldier rank=\"MSG\" name=\"Joe, G.I.\" street=\"2600 North
Highlands Avenue\" city=\"Atlanta\" state=\"GA\" zip=\"30101\"
lat=\"34\" lng=\"-84\" />";
print '</soldiers>';
?>

I figured I would go with the first to have better code. But, since I
can't delay any longer had to go with the 2nd. Just curious as to why
it seems to work but doesn't!

Stacy

Aug 28 '05 #1
1 1346
Header....Header....Header...H*eader....Header...H eader...Hea*der!
header("content-type:text/xml"*); <-----Forgot this all important
line!
Argh.

Sep 1 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom Loredo | last post by:
Hi folks- I'm about to move from a Solaris 8/SPARC environment to a Dell running RedHat 9. Are there any issues I need to be aware of in bringing my Python code over (mostly scientific...
28
by: grahamd | last post by:
Who are the appropriate people to report security problems to in respect of a module included with the Python distribution? I don't feel it appropriate to be reporting it on general mailing lists.
5
by: sandy | last post by:
Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to...
2
by: malcolm | last post by:
Hello, We have a robust (.NET 1.1 c# winforms) client-server application that utilizes many typed DataSets, typed DataTables and typed DataRows. Our application is a series of windows and popup...
1
by: Aliandro | last post by:
Hi Does any one know where I can find information regarding any issues with SQL and IIS being run under windows XP SP2? as I am in the process of programmning in Dot net and neet some way of...
7
by: David Laub | last post by:
I have stumbled across various Netscape issues, none of which appear to be solvable by tweaking the clientTarget or targetSchema properties. At this point, I'm not even interested in "solving"...
2
by: G2 | last post by:
Hi We are dealing with significant browser compatibility issues with Netscape 5.x+ browsers and Mac IE. I am sure most web developers have faced similar issues in the past. Can anyone give me their...
1
by: GaryDean | last post by:
We have been developing all of our .net applications on 32 bit windows using 32 bit SQL Server. We are being asked to now deploy to servers running 64bit windows and 64bit SQL Server. Are there...
3
by: eschneider | last post by:
Just some common issues with WS: Using custom objects: When objects change, seems you are always fixing some issue. Update references, which sometimes does not work. Deployment: Weird errors...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.