Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XMLSpy and standalone="yse"

Status
Not open for further replies.

arboboo

Programmer
Nov 4, 2008
1
0
0
CA
There is only 1 line in my XML file:

<?xml version="1.0" encoding="UAT-8" standalone="yes"?>



But the XMLSpy 2008 reports error:
File C:\Untitled8.xml is not well-formed.
Character 's' is grammatically unexpected
Reason: one of the following is expected (see below)
'?>'
Details
XML production: Production 'TextDecl' not satisfied



When I removed standalone=”yes”, this xml file can pass the validation. Why?


Thanks a lot.

 
I'm using XMLSpy Version 5 and it does not like a one line file containing
Code:
<?xml version="1.0" encoding="UTF-8"?>

However, if I add any single element to the file, like 'anElement', it says it is well-formed.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<anElement />

Adding or removing 'standalone="yes"' has no effect.
XMLSpy V5 thinks the following is well-formed.
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<anElement />




'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Let me show you how to conduct the reasoning. In the w3 xml recommendation, we have this grammar defining what it's meant of an well-formed xml document.
[tt]
[1]document ::= prolog element Misc*
[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
[27] Misc ::= Comment | PI | S
[28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' intSubset ']' S?)? '>'
[39] element ::= EmptyElemTag | STag content ETag [WFC: Element Type Match][VC: Element Valid]
[/tt]
The only component you cannot spare of is "element". The minimal of element is "EmptyElemTag". So if you want to convey empty info yet through xml document, well-formed by implication, you should have at the minimum an empty tag as root (such as <x />) or some tag with empty content (<x></x>).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top