| | |
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 add android api applet application applications array arrays automation bank bi binary blackberry bluetooth chat class clear client code compile compiler component database development dice digit eclipse equation error event formatingtextintooltipjava fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide idea image infinite int integer j2me java javame javaprojects jetbrains jni jpanel jtable julia learningresources linux list main map method methods mobile myregfun netbeans nonstatic notdisplaying openjavafx pearl problem program project qt recursion repositories scanner screen scrollbar server set sms sort sorting spamblocker sql sqlserver storm string superclass swing system thread threads tree variablebinding windows xor





