469,330 Members | 1,308 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

Assignment to fix XML errors

2
I have an assignment to identify and fix errors in following code. It is from an exercise in "The Web Warrior Guide to Web Programming"

[html]<?xml version="1.0" standalone="yes"?>
<travel>
<transportation mode=airplane>
<destination>Paris</destination>
<depart_date>June 1</depart_date>
<carrier company=United>
<transportation mode=train>
<destination>New Orleans</destination>
<depart_date>April 15</depart_date>
<railroad company=Amtrak>
<transportation mode=automobile>
<destination>Vancouver</destination>
<depart_date>August 3</depart_date>
</travel>[/html]

Warning: Please use html tags for code samples.
Thanks, moderator.
Mar 18 '07 #1
4 3543
dorinbogdan
839 Expert 512MB
Welcome to TheScripts TSDN....

1. Replace railroad element by carrier on the second transportation node.
2. Add a carrier element to the last transportation node.
3. Close transportation and carrier nodes.
So, it could be something like:
[html]<?xml version="1.0" standalone="yes"?>
<travel>
<transportation mode=airplane>
<destination>Paris</destination>
<depart_date>June 1</depart_date>
<carrier company=United />
</transportation>
<transportation mode=train>
<destination>New Orleans</destination>
<depart_date>April 15</depart_date>
<carrier company=Amtrak />
</transportation>
<transportation mode=automobile>
<destination>Vancouver</destination>
<depart_date>August 3</depart_date>
<carrier company=Taxi />
</transportation>
</travel>[/html]
Mar 19 '07 #2
dorinbogdan
839 Expert 512MB
Hi,
Did you succeed to solve the problem ?
If yes, please let me know, in order to close the thread.
Thanks,
Dorin.
Mar 21 '07 #3
psubob
2
I made the code changes in Notepad, saved as .xml file of ALL TYPES but when I go to open, get the following error in IE...

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

A string literal was expected, but no opening quote character was found. Error processing resource 'file:///C:/Documents an...

<transportation mode=airplane>
------------------------^
Mar 21 '07 #4
dorinbogdan
839 Expert 512MB
You are correct.
Try this updated version:
[html]<?xml version="1.0" standalone="yes"?>
<travel>
<transportation mode="airplane">
<destination>Paris</destination>
<depart_date>June 1</depart_date>
<carrier company="United" />
</transportation>
<transportation mode="train">
<destination>New Orleans</destination>
<depart_date>April 15</depart_date>
<carrier company="Amtrak" />
</transportation>
<transportation mode="automobile">
<destination>Vancouver</destination>
<depart_date>August 3</depart_date>
<carrier company="Taxi" />
</transportation>
</travel>[/html]

Please let me know if it solved your problem.
Mar 21 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.