Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 28th, 2007, 08:14 AM
Registered User
 
Join Date: Sep 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default standalone declaration

I get an error on
  • <?xml version="1.0" standalone="no" encoding="UTF-8"?>
while
  • <?xml version="1.0" encoding="UTF-8" standalone="no"?>
is accepted. What is the specific rule regarding ordering. Thank you.

Reply With Quote
  #2 (permalink)  
Old September 28th, 2007, 08:30 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

From http://www.w3.org/TR/REC-xml/#sec-prolog-dtd

XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

Therefore, the correct order is version, encoding, standalone declaration.

Not, that while these may look like XML attributes neither these, or those found in processing instructions are actually attributes, they mealy follow the label/value pair convention of attributes.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old September 28th, 2007, 08:31 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You could have done what I just did in 10 seconds: go to the XML recommendation, search for "XML declaration", follow the link, and reach

http://www.w3.org/TR/REC-xml/#NT-XMLDecl

which tells you:

[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

that is, the encoding declaration must come before the standalone declaration.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #4 (permalink)  
Old September 28th, 2007, 08:42 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

ooh, beat ya :)

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #5 (permalink)  
Old September 28th, 2007, 08:56 AM
Registered User
 
Join Date: Sep 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mhkay
 You could have done what I just did in 10 seconds: ...
 And rob you of an opportunity to be condescending? Never!

Reply With Quote
  #6 (permalink)  
Old September 28th, 2007, 08:57 AM
Registered User
 
Join Date: Sep 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by samjudson
 From http://www.w3.org/TR/REC-xml/#sec-prolog-dtd

XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

Therefore, the correct order is version, encoding, standalone declaration.

Not, that while these may look like XML attributes neither these, or those found in processing instructions are actually attributes, they mealy follow the label/value pair convention of attributes.

/- Sam Judson : Wrox Technical Editor -/
Thank you.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone use of MS Script Editor? jhchristenson VBScript 1 September 23rd, 2008 06:43 AM
changing system from standalone to distributed Niranjandubey Book: Wrox's Visual C# 2005 Express Edition Starter Kit 0 July 23rd, 2008 01:23 AM
Windows Standalone app echovue Visual Basic 2005 Basics 3 March 12th, 2007 03:27 PM
Standalone Forum kulrom BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 November 12th, 2006 02:06 AM
WriteXml standalone property mega ADO.NET 0 June 21st, 2006 09:14 AM



All times are GMT -4. The time now is 07:18 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.