|
Hi,
thanks for answering.
With "standard prefix" I did not mean, that I
haven't specified which namespace belongs to the prefix.
But during trying out my error-message has
changed:
Grammar with uri : http://www.xyz.de, can not found
<?xml version="1.0"?> <xsd:schema
xmlns:xsd = "http://www.w3.org/2001/XMLSchema" xmlns
= "http://www.xyz.de" targetNamespace= "http://www.xyz.de>
<xsd:element
name="bausparAntrag">
<complexType>
...
The Instance:
<?xml version="1.0"
standalone="no"?> <bausparAntrag xmlns
="http://www.profi-consult.de" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation="bausparAntrag.xsd"> <produkt>
Or with this variant, the error is:
Element type "bausparAntrag" must be declared.
The Schema:
<?xml version="1.0"
encoding="UTF-8"?> <schema
xmlns='http://www.w3.org/2000/10/XMLSchema'> <element
name="bausparAntrag"> <complexType>
The Instance:
<?xml version="1.0"
standalone="no"?> <bausparAntrag
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="bausparAntrag.xsd"> <produkt>
With the second variant namespace problems are
gone. But why doesn't the parser know the root-Element. It is declared in the
Schema, syntax conformas to the last version of w3c. I tried to use xerces, as
it knows xmlschemas best, but I'm not sure whether I'm really using it. I set
the system-property in my java-code:
System.setProperty("javax.xml.parsers.DocumentBuilderFactory" ,
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
Maybe that does not work??
If It all works that fine in your applications,
than a code example would be quite helpful!
Thanks
Inga
----- Original Message -----
Sent: Friday, April 27, 2001 2:48
AM
Subject: RE: error when parsing an
xml-schema with Jaxp and DOM
There's no such thing as a "standard prefix". Make
sure you are including proper namespace declarations to associate your
prefixes with the appropriate namespaces.
If
you are using JAXP 1.1, it should support namespaces fine if they are declared
properly. Earlier versions of JAXP do not support namespaces (or at least they
don't through the public APIs).
I wanted to check whether my xml-scheam is
wellformed and tried to parse it with jaxp with standard parser and
DOM.
This error occurs:
Whitespace required before attributes.
Maybe the parser has problems with namespaces?
I used the standard prefix (xsd:schema..) and so on for the elements and set
the factory and the buildeer to nameSpaceAware.
Or do I need to use another parser, who is
namespace-aware, or is it a totally othr error...
Please help!!!!!
Maybe you can recommend me an other parser, which supports xml-schema
fully. But therefore I need a snippet of code on how to change the
parser
in jaxp. I read that I simply have to change a systemProperty, but I do
not have such a system property.
Thanks in advance
Inga
|