| Author |
SAXParseException coming while parsing the xml file
|
Himanshu Rawat
Ranch Hand
Joined: Nov 27, 2005
Posts: 141
|
|
Hi, Below is my xml file. <TariffPlan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="TariffPlan.xsd"> <IdentifierGroup> <Name>Local</Name> <Identifier> <Type>Prefix</Type> <Text>8711</Text> </Identifier> </IdentifierGroup> <IdentifierGroup> <Name>AnytimeId</Name> <TariffIdentifier>SameTariffAnytime</TariffIdentifier> </IdentifierGroup> <IdentifierGroup> and it continues... Below is my XSD file <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="TariffPlan"> <xs:annotation> <xs:documentation>Complete tariffing information</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="IdentifierGroup" maxOccurs="unbounded"> <xs:complexType> .......... ......... And I'm getting below error. Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'TariffPlan'. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at com.logicacmg.wn.ic.abacus.tariff.model.TariffPlan.parseXML(TariffPlan.java:564) ... 3 more Can anyone tell me why this error is coming? I did a lot of search on this and tried thei given options but they aren't working for me. Awaiting for response!!
|
rawat
SCJP 1.4
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
That probably means the parser didn't find your schema. If you rename it to something else and rerun, and you get the same exception, then that's the answer.
|
 |
 |
|
|
subject: SAXParseException coming while parsing the xml file
|
|
|