| | |
parsing error (XML file-java-schema)
![]() |
•
•
Join Date: Apr 2005
Posts: 13
Reputation:
Solved Threads: 0
I've a problem with some code, this is the "core" of the code:
and this is the output error when I run it on a couple of example files:
H:\_java_prove_>java SchemaTest xeno08x.xml xeno08x.xsd
XML File:xeno08x.xml
XSD File:xeno08x.xsd
=> Line [2] -----------------------------------
Document root element "record", must match DOCTYPE root "null".
-----------------------------------------------------------------------
=> Line [2] -----------------------------------
Document is invalid: no grammar found.
-----------------------------------------------------------------------
=> Line [2] -----------------------------------
http://www.w3.org/TR/xml-schema-1#cv...i:noNamespaceS
chemaLocation
-----------------------------------------------------------------------
=> Line [2] -----------------------------------
http://www.w3.org/TR/xml-schema-1#cv...i:noNamespaceS
chemaLocation
-----------------------------------------------------------------------
I've tried various changes, but I don't find the error :_(
Can anyone help me?
TYIA
Java Syntax (Toggle Plain Text)
File xmldocFile = new File(xmlFile); File schemaFile = new File(xsdFile); try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); Schema mySchema = sf.newSchema(schemaFile); dbf.setSchema(mySchema); DocumentBuilder db = dbf.newDocumentBuilder(); ErrorChecker errors = new ErrorChecker(); db.setErrorHandler(errors); db.parse(xmldocFile); } catch (Exception e) { System.out.print("[Parsing]================================================================="); System.out.println("Error: " + e); System.out.print("=========================================================================="); }
and this is the output error when I run it on a couple of example files:
H:\_java_prove_>java SchemaTest xeno08x.xml xeno08x.xsd
XML File:xeno08x.xml
XSD File:xeno08x.xsd
=> Line [2] -----------------------------------
Document root element "record", must match DOCTYPE root "null".
-----------------------------------------------------------------------
=> Line [2] -----------------------------------
Document is invalid: no grammar found.
-----------------------------------------------------------------------
=> Line [2] -----------------------------------
http://www.w3.org/TR/xml-schema-1#cv...i:noNamespaceS
chemaLocation
-----------------------------------------------------------------------
=> Line [2] -----------------------------------
http://www.w3.org/TR/xml-schema-1#cv...i:noNamespaceS
chemaLocation
-----------------------------------------------------------------------
I've tried various changes, but I don't find the error :_(
Can anyone help me?
TYIA
![]() |
Similar Threads
- [urgent] HTML form => XML file (JSP)
- Error coming while running an App (JSP)
- Multiple Table Reading From An Xml File (VB.NET)
- How to Parse XML file (RSS, Web Services and SOAP)
- xml file parsing in c++ (C++)
- Error reading XML file in Javascript (JavaScript / DHTML / AJAX)
- Need some help with parsing an XML file (PHP)
- problem reading xml file in c# (C#)
Other Threads in the Java Forum
- Previous Thread: Interfaces
- Next Thread: Which type of class is not instantiated?
| Thread Tools | Search this Thread |
-xlint actionlistener android api applet application array automation bi binary blackberry block bluetooth character class client code compile compiler component consumer database desktop developmenthelp eclipse error fractal freeze ftp functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide image int j2me j2seprojects java javac javaee javaprojects jetbrains jni jpanel jtable julia learningresources lego linked linux mac main map method mobile myregfun netbeans nonstatic notdisplaying number online pearl printf problem program project qt researchinmotion rotatetext rsa scanner screen server set singleton sms sort spamblocker sql string swing system textfields thread threads time title tree tutorial-sample update variablebinding windows working xor





