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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
- Stylus Studio Technical Forum (14621)
-> + X16 - XPath 3.0, XQuery 3.0, X... (2)
-> - Test (1)
-> + XSLT debugger shows [symbol u... (3)
-> - How do i use *.conv to process... (1)
-> - How do i use *.conv to process... (1)
-> + Not able to configure JVM in ... (5)
-> + Converting Cobol flat file to ... (2)
-> + Problem with uninstall - Windo... (2)
-> + Function current() is not reco... (6)
-> + API or web version (2)
-> + How to use Saxon for X16 on WI... (9)
-> + Error in SS X14 syntax highlig... (2)
-> + Option not available (2)
-> + XML Diff functionality and sor... (3)
-> + Convert Oagis XML file to TXT (4)
-> + DataDirect xqresultsequence is... (2)
-> - xfile Legacy file format suppo... (1)
-> + TPFDF (3)
-> + Help needed with SLSRPT - EDIF... (2)
-> - keeps crashing after I try and... (1)
-- Previous [61-80] [81-100] [101-120] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Michael SalmanSubject: Validation error
Author: Michael Salman
Date: 23 Nov 2015 06:29 PM
I wonder if someone could tell me why I am getting this validation error
Here is the xml file:
<?xml version="1.0"?><!DOCTYPE employees SYSTEM "file:///e:/XmlProjects/TestUml.dtd">
<employees>
<employee id="1">
<firstName>Mike</firstName>
<lastName>Smith</lastName>
</employee>
</employees>
Here is the DTD file:
<?xml version="1.0" encoding="UTF-16LE"?>
<!ELEMENT firstName (#PCDATA)>
<!ELEMENT lastName (#PCDATA)>
<!ELEMENT employee (firstName,lastName)>
<!ATTLIST employee id ID #REQUIRED>
<!ELEMENT employees (employee)>
Here is the error stylus studio gives me:
Validating TestUml.xml...
file:///e:/XmlProjects/TestUml.xml:3,18: value '1' for attribute 'id' is invalid Name or NMTOKEN value
The XML document TestUml.xml is NOT valid (1 errors)

Now if I change ID to CDATA the xml file validates. Could someone tell me what is wrong with my DTD file as far as I can tell the syntax is valid

Postnext
Ivan PedruzziSubject: Validation error
Author: Ivan Pedruzzi
Date: 23 Nov 2015 10:21 PM
http://www.stylusstudio.com/xsllist/handler.asp?/xsllist/200908/post90210.html

Change the id attribute definition to
<!ATTLIST employee id CDATA #REQUIRED>


Ivan Pedruzzi
Stylus Studio Team

Postnext
Michael SalmanSubject: Validation error
Author: Michael Salman
Date: 24 Nov 2015 12:53 AM
Well I am not an xml expert but I have to disagree with you on this. First of all ID is a legal Content Type. I wrote a c# program which has an XmLDocument class which is used for parsing and manipulating xml files. It has a function called GetElementById(string) which returns an element containing the attribute. In this case I would use it like this
GetElementById("1") but this function will not work if it is not defined with the Content Type ID (which is used to identify an attribute as being unique. Stylus Studio should not report that there is a validation error as there is none
Regards Mike

Postnext
Ivan PedruzziSubject: Validation error
Author: Ivan Pedruzzi
Date: 24 Nov 2015 01:37 AM
I am not sure on what you are disagreeing. This is what the XML specification states.

Type ID in the XML DTD specifications is defined as NAME therefore it cannot be a number.

http://www.w3.org/TR/REC-xml/#id
<<"Values of type ID must match the Name production">>
http://www.w3.org/TR/REC-xml/#NT-Name

The error you see in the output window is reported by Apache Xerces and any other XML complaint parsers when DTD validation is enabled.

The fact that the .NET DOM API getElementByID does not throw an error is irrelevant.

Ivan Pedruzzi
Stylus Studio Team

Posttop
Michael SalmanSubject: Validation error
Author: Michael Salman
Date: 24 Nov 2015 02:44 AM
I apologize it is my error. I changed it to id="one" and it now works fine. The only excuse I have is I am reading a book on xml and it gives sample xml and dtd files which are obviously erroneous
Thanks for your prompt response
Regards Mike

   
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.