Hello Jon,
If the target namespace of your schema is "http://npci.com/xportal/handler/JDBC/1.0" then you should specify that in the schemaLocation instead of "-//http://npci.com/xportal/handler/JDBC/1.0//-". Hope that helps.
"Jon Brisbin" <[EMAIL PROTECTED]> wrote on 07/23/2004 05:18:23 PM:
> I've searched on the ML archives and can't find what I'm looking, but I
> might just be stupid and can't find it.
>
> I'm using Jelly to load this file, but that list directed me here. here's
> what I'm getting:
>
> 328 [main] ERROR org.apache.commons.jelly.parser.XMLParser - Parse Error
> at line 2 column 247: cvc-elt.1: Cannot find the declaration of element
> 'x:action'.
> org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
> element 'x:action'.
> 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.scanRoot
> ElementHook(Unknown Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
> her.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 org.apache.commons.jelly.parser.XMLParser.parse(XMLParser.java:328)
> at com.npci.xportal.Test.main(Test.java:54)
>
> This XML file validates in XMLSpy just fine. Here's the root element
> declarations I'm using:
>
>
> <x:action
> xmlns="http://npci.com/xportal/1.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:x="http://npci.com/xportal/1.0"
> xsi:schemaLocation="-//http://npci.com/xportal/1.0//-
> D:\projects\xportal-definitions\xsd\jdbc-handler.xsd">
>
> Here's the code I'm using to parse with:
>
> StringWriter sw = new StringWriter();
> XMLSerializer ser = new XMLSerializer(sw, (new OutputFormat()));
> SAXParser parser = new SAXParser();
> parser.setFeature(
> "http://apache.org/xml/features/validation/schema", true);
> parser.setFeature(
> "http://xml.org/sax/features/validation", true);
> parser.setFeature(
> "http://xml.org/sax/features/namespaces", true);
> parser.setFeature(
> "http://xml.org/sax/features/namespace-prefixes", false);
>
> XMLParser jellyParser = new XMLParser(parser);
> XMLOutput jellyOutput = new XMLOutput(ser.asContentHandler());
> Script jellyScript = jellyParser
>
> .parse("d:/projects/xportal-definitions/actions/sql/payroll/get_check_hdr.xm
> l");
> jellyScript.compile();
> jellyScript.run((new JellyContext()), jellyOutput);
>
> System.out.println("[After]: " + sw.toString());
>
> ByteArrayInputStream bais = new ByteArrayInputStream(sw.toString()
> .getBytes());
> DefaultConfigurationBuilder configBuilder = new
> DefaultConfigurationBuilder();
> Configuration config = configBuilder.build(bais);
>
> System.out.println("[Config]: "
> + ConfigurationUtil.toString(config));
>
> If I change the feature "http://xml.org/sax/features/namespace-prefixes" to
> "false", then I get an error because the XML is corrupted to this:
>
> <x:action
> schemaLocation="-//http://npci.com/xportal/handler/JDBC/1.0//-
> file:///D:/projects/xportal-definitions/xsd/jdbc-handler.xsd"
> ="http://npci.com/xportal/handler/JDBC/1.0"
> xmlns="http://npci.com/xportal/handler/JDBC/1.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>
> Any help you could give me here would be MUCH appreciated...
>
>
> Thanks!
>
> Jon Brisbin
> =======================================
> Development Programmer
> NPC International
> (620) 235-7726
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
- Errors loading XML file with validation Jon Brisbin
- Re: Errors loading XML file with validation Michael Glavassevich
- Content is not allowed in prolog error when ... Duane Jung
- Re: Content is not allowed in prolog err... Simon Kitching
- Re: Content is not allowed in prolog... Duane Jung