XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Ian ThomasSubject: [OT] XML fragment - error explanation?
Author: Ian Thomas
Date: 31 Jan 2008 07:19 PM
I have another small XML fragment (put forward by Microsoft in one of their .NET code examples, as a piece of XML to be validated). I've used SS to check it, of course.

This is a bit confusing (on Microsoft's part):

The (obsolete, .NET v1.1) XmlValidatingReader class allows this in .NET 1.1 (but it fails in .NET 2.0+). This is probably related to the version of MSXML used (my guess).

The recommended (.NET 2.0 and later) XmlReader class picks up an error at line 4, position 4 ("There are multiple root elements. Line 4, position 4").

Loading the mixed.xml file into SS2008 tells me there's an error at (4,3): Parsing error in file:///c:/mixed.xml. FATAL ERROR: Expected comment or processing instruction.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:dvdstore-schema" targetNamespace="urn:dvdstore-schema">
<xs:element name="dvd" type="xs:string" />
</xs:schema>
<pb:book price="7.99" xmlns:pb="urn:bookstore-schema">The Autobiography of Benjamin Franklin</pb:book>
<pd:dvd xmlns:pd="urn:dvdstore-schema">The Godfather</pd:dvd>
<pt:tape xmlns:pt="urn:tapestore-schema" xsi:schemaLocation="urn:tapestore-schema tape.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Il Postino</pt:tape>

So, the Stylus error is "Expected comment or processing instruction".

Can someone tell me where I can get a more detailed explanation of that? Clicking the Documentation tab pops up a msgbox then another, labelled [Static ]showing "Processing...", and does no more.

How should mixed.xml be written to be a valid xml data file?

Ian Thomas
--------------
Stylus Studio 2008 XML Enterprise Suite R1 (Build 1050e)

Postnext
Alberto MassariSubject: [OT] XML fragment - error explanation?
Author: Alberto Massari
Date: 01 Feb 2008 02:24 AM
Hi Jan,
this is not (and has never been) legal XML, as it has 4 root elements (xs:schema, pb:book, pb:dvd, pt:tape) and XML only allows one root element plus comments and processing instructions at the top level. The error reported by Xerces points to the second root element and explain that it was only expecting a comment or a processing instruction.

Hope this helps,
Alberto

Posttop
Ian ThomasSubject: [OT] XML fragment - error explanation?
Author: Ian Thomas
Date: 01 Feb 2008 03:26 AM
A nice example from the MSDN documentation :)
But the .NET message is slightly more helpful than Xerces.

Ian Thomas
--------------
Stylus Studio 2008 XML Enterprise Suite R1 (Build 1050e)

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.