hi, fooling around with xmlspy (which seems pretty broken when *doing*
xslt's). trying to validate in java using code from
http://cermics.enpc.fr/doc/java/j2ee...JAXPSAX13.html
(click on the Echo10.java link). i get an error saying that a doctype
decl is required (see below). i get the same error whether or not i turn
on name space awareness. spy says this file is well formed and valid.
and my java code that transforms it with the same .xslt works as
expected (all the files are at http://tayek.com/~ray/spy1/). the spy
starts the xml doc that i am trying to validate with:
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSPY v2004 rel. 3
(http://www.xmlspy.com)-->
<inputDocumen t xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "H:\java\projec ts\spy1\spy\inp utDocument.xsd" >
<special>Text </special>
<header>
<inputFieldName >String</inputFieldName>
while the .xsd file starts with:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by Ray
Tayek (Freightgate) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<xs:element name="inputDocu ment">
<xs:annotatio n>
<xs:documentati on>input csv converted to xml</xs:documentatio n>
</xs:annotation>
what i would like to do is to validate the xml doc against it's schema
before applying the transform (in java) . i have not yet tried the dom
example at
http://cermics.enpc.fr/doc/java/j2ee.../JAXPDOM9.html as i
thought the sax would be a bit more lightweight.
i just started using spy (i had java code that does the transform just
fine). but i used spy to generate the new .xsd and sample xml. so maybe
he put some proprietary junk in there or something?
anaict, doctype is for dtd's, but sax is complainig about a missing doctype.
anybody got a clue?
thanks
output from Echo10.java when trying to validate the xml doc:
LOCATOR
SYS ID: file:H:/java/projects/spy1/spy/inputDocument.x ml
START DOCUMENT
<?xml version='1.0' encoding='UTF-8'?>** Warning, line 4, uri
file:H:/java/projects/spy1/spy/inputDocument.x ml
Valid documents must have a <!DOCTYPE declaration.
** Parsing error, line 4, uri
file:H:/java/projects/spy1/spy/inputDocument.x ml
Element type "inputDocum ent" is not declared.
org.xml.sax.SAX ParseException: Element type "inputDocum ent" is not declared.
at org.apache.crim son.parser.Pars er2.error(Parse r2.java:3160)
at
org.apache.crim son.parser.Pars er2.maybeElemen t(Parser2.java: 1322)
at
org.apache.crim son.parser.Pars er2.parseIntern al(Parser2.java :500)
at org.apache.crim son.parser.Pars er2.parse(Parse r2.java:305)
at
org.apache.crim son.parser.XMLR eaderImpl.parse (XMLReaderImpl. java:442)
at javax.xml.parse rs.SAXParser.pa rse(SAXParser.j ava:345)
at javax.xml.parse rs.SAXParser.pa rse(SAXParser.j ava:281)
at V.main(V.java:3 1)