By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,049 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

help with validation

P: n/a
Hi guy's i'm v new to this and probably getting this wrapped right round my
head, but why can't i use something like wc3 to validate this.
-----------------XML---------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?xml-stylesheet type="text/xsl" href="ordercontents.xsl"?>
<order-contents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ordercontents.xsd">
<customer number="41">
<order-id>1142679080</order-id>
<order-date>2006-03-18 10:03:20</order-date>
<customer-name>Damian Burrin</customer-name>
<customer-email>da****@ukrocketry.com</customer-email>
<items-description>0764543555-Professional XML Development with Apache
Tools</items-description>
<items-qty>1</items-qty>
<items-total>£18.99</items-total>
</customer>
<order-total>£18.99</order-total>
</order-contents>
--------------------END XML----------------------

------------------SCHEMA----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">

<xs:element name="order-contents">
<xs:complexType>
<xs:sequence>
<xs:element ref="customer"/>
<xs:element ref="order-total"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="customer">
<xs:complexType>
<xs:sequence>
<xs:element ref="order-id"/>
<xs:element ref="order-date"/>
<xs:element ref="customer-name"/>
<xs:element ref="customer-email"/>
<xs:element ref="items-description"/>
<xs:element ref="items-qty"/>
<xs:element ref="items-total"/>
</xs:sequence>
<xs:attribute name="number" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="order-id" type="xs:integer"/>
<xs:element name="order-date" type="xs:string"/>
<xs:element name="customer-name" type="xs:string"/>
<xs:element name="customer-email" type="xs:string"/>
<xs:element name="items-description" type="xs:string"/>
<xs:element name="items-qty" type="xs:integer"/>
<xs:element name="items-total" type="xs:string"/>
<xs:element name="order-total" type="xs:string"/>
</xs:schema>
-----------------END SCHEMA------------------------

Any help really apreciated

Thanks
Damian Burrin
UKRA 1159 Level 2 RSO
EARS 1115
http://www.ukrocketry.com
http://www.larf-rocketry.co.uk

LARF - Putting the amateur back in rocketry!!
Mar 21 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Tue, 21 Mar 2006 21:40:24 GMT, Damian Burrin was all like:
Hi guy's i'm v new to this and probably getting this wrapped right round my
head, but why can't i use something like wc3 to validate this.
-----------------XML---------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


Hi Damian. I'm new at XML as well, but I know that you're not
writing in XHTML, though the W3C validator will look at your DTD,
think you're trying to validate an XHTML document, and tell you that
nothing works in it. Others, I'm sure, will tell you how to fix the
problem.

Ian
--
http://sundry.ws/
Mar 21 '06 #2

P: n/a
Damian Burrin said the following on 21-03-2006 22:40 +0200:
Hi guy's i'm v new to this and probably getting this wrapped right round my
head, but why can't i use something like wc3 to validate this.
As far as I know, the W3C's validator is not a generic XML validator, it
does validate HTML and XHTML (which is only one example of XML) though.

Searching for you I discovered that the W3C's site has an XSD Validator:

http://www.w3.org/2001/03/webdata/xsv

Or you might want to search the web for an XSD or Schema Validator utility.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?xml-stylesheet type="text/xsl" href="ordercontents.xsl"?>
Your XML file is XML with an XHTML DOCTYPE, but it isn't XHTML. It might
be that the XSL file transforms your XML to XHTML, but then the XSL file
should put the XHTML DOCTYPE on the *result* of your tranformation.
<order-contents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ordercontents.xsd">
<customer number="41">
<order-id>1142679080</order-id>
<order-date>2006-03-18 10:03:20</order-date>
<customer-name>Damian Burrin</customer-name>
<customer-email>da****@ukrocketry.com</customer-email>
<items-description>0764543555-Professional XML Development with Apache
Tools</items-description>
<items-qty>1</items-qty>
<items-total>£18.99</items-total>
</customer>
<order-total>£18.99</order-total>
</order-contents>


Nothing here is defined in the XHTML DTD ..

--
Regards
Harrie
Mar 22 '06 #3

P: n/a
XSV is happy to validate your instance with your schema document --
what precisely is the problem you're facing?

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Mar 22 '06 #4

P: n/a

Henry S. Thompson wrote:
XSV is happy to validate your instance with your schema document --
what precisely is the problem you're facing?

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]


Purly an interpretation issue i think. I thought that XML and XHTML
where basically the same and if i used a xhtml doc type anf an xml
schema i'd be able to validate my xml using the wc3 xhtml validator.

I suppose i ccould get this to validate if i edited the strict DTD so
'ive read, but i've checked validation with a php script.

<?php

$dom = new DOMDocument;
$dom ->load('ordercontents.xml');

if(!$dom ->schemaValidate('ordercontents.xsd')) {
print "Document is not valid";
}else{
print"Document is valid";}

?>

This is for a uni project (i'm part time/full time work and familly so
don't get access to the same info and support my full time compadres
do)

I've had to develop a dynamic php/sql online store + shopping cart.
This part of the brief was to use a user defined DTD / W3C XML Schema
and Generated content is valid to a user-defined DTD or W3C XML Schema.

Thanks for help guys. Just got to try and do somthing with templating
and separating the code from the markup. Any recomendations?

Thanks

Damian

Mar 22 '06 #5

P: n/a
DamianB wrote:
Henry S. Thompson wrote:
XSV is happy to validate your instance with your schema document --
what precisely is the problem you're facing?

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]


Purly an interpretation issue i think. I thought that XML and XHTML
where basically the same


http://xml.silmaril.ie/basics/differences/

XML is a Specification. XHTML is just one of hundreds (by now probably
thousands) of markup languages written using XML.

///Peter
Mar 25 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.