-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't parse W3 SOAP 2003-05 envelope XML schema: "xml:lang" attr ref #15
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented It seems to me that the problem is you didn't import the definition for xml:lang |
@glassfishrobot Commented |
@glassfishrobot Commented The import of the XML namespace schema in the SOAP envelope schema is <xs:import namespace="http://www.w3.org/XML/1998/namespace" /> At http://www.w3.org/XML/1998/namespace it says: "The namespace whose name is http://www.w3.org/XML/1998/namespace is In the errata (http://www.w3.org/XML/xml-names-19990114-errata) for == START ERRATA => Replace the Namespace Constraint "Leading XML" in section 2 with: Namespace constraint: Reserved Prefixes and Namespace Names The prefix xml is by definition bound to the namespace name The prefix xmlns is used only to declare namespace bindings and is by All other prefixes beginning with the three-letter sequence x, m, l, Rationale: This erratum clarifies several issues concerning prefixes beginning "xml". <= END ERRATA == I am not an XML Schema expert, but to me all of this means: 1. the "xml" prefix does not need to be declared I may be naive, but I'm assuming that since the SOAP schema is posted by As a side note, I think it would be a great idea to have JAXB added to Thanks, |
@glassfishrobot Commented
Welcome to the weird world of XML Schema. The sad truth is that according to the schema spec, it is totally legal So there's no "error" involved in this. It's just that the spec is incredibly What you can do is to fix the import declaration as follows: <xs:import namespace="http://www.w3.org/XML/1998/namespace" If you feel like complaining about it, please write to
Correct.
You are mixing an XML parser and an XML Schema processor here. And
No. See "Schema Representation Constraint: Schema Document Location Strategy"
?
Again I think you are mixing XML 1.0 processor and XML Schema processor.
Great suggestion. Thank you. |
@glassfishrobot Commented |
@glassfishrobot Commented [For future readers, the reference to '"Schema Representation Constraint: You've also convinced me that it's legal for an XML Schema processor to The part where I'm not yet convinced that JAXB is XML Schema compliant ==> START CITATION The composition of the complete schema for use in ·assessment· is 1. Schemas are represented on the Web in the form specified above in 2. The author of a document uses namespace declarations to indicate ==> END CITATION (Emphasis of last sentence is mine.) I read the last sentence of the citation as requiring an XML Schema The ability to override schema location specifications will, I think, There is also still a small bug pointed out by the use of XJC on the I also agree that this is a usability issue. I'd contend that it's "Note that components to be imported need not be in the form of a Thank you, |
@glassfishrobot Commented C:\java\src\foo>type soap-envelope-ns.xsd <xs:schema targetNamespace="http://www.w3.org/2003/05/soap-envelope" C:\java\src\foo> This failed to work: C:\java\src\foo>%JWSDP_HOME%\jaxb\bin\xjc.bat file:soap-envelope-ns.xsd [WARNING] warning: "finalDefault" attribute of is not supported [ERROR] a "schemaLocation" attribute is required Failed to parse a schema. I believe the offending line was: |
@glassfishrobot Commented
Nevertheless your enthusiasm convinced me that we should fix this issue. Typically this kind of user-level "redirection" of resources have been So the fix doesn't give you that, but XJC will no longer fail just because Instead, it simply ignores the import declaration. So you'll be able $ xjc.bat xml.xsd soap-envelope-ns.xsd Also, check out the -catalog switch, because this option does provide |
@glassfishrobot Commented I read the documentation on using catalogs and tried but still got SYSTEM "http://www.w3.org/XML/1998/namespace" "http://www.w3.org/2001/xml.xsd" as well as an OASIS XML catalog: but I got the same results. In com.sun.tools.xjc.reader.xmlschema.parser.XMLEntityResolverImpl, public XMLInputSource resolveEntity(XMLResourceIdentifier r) throws if(publicId==null) which seemed to indicate that those catalogs should have worked. Is that code |
@glassfishrobot Commented |
@glassfishrobot Commented C:\java\src\foo>d:\java\jwsdp\jwsdp-1.3\jaxb\bin\xjc.bat -extension -catalog parsing a schema... [WARNING] warning: ignored [WARNING] warning: ignored [WARNING] warning: "final" attribute of is not supported [WARNING] warning: ignored [ERROR] undefined attribute 'xml:lang' Failed to parse a schema. C:\java\src\foo> Attribute 'xml:lang' is defined in http://www.w3.org/2001/xml.xsd, which the This should be easily reproducible with command line (either catalog file): xjc -extension -catalog xml-namespace.cat http://www.w3.org/2003/05/soap- |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented Based on the last few comments, looks like we need to reinvestigate this issue. |
@glassfishrobot Commented To recap the issue, the mode of the failure was that you cannot compile SOAP There are two ways to make it work. 1. submit both xml.xsd and soap-envelope.xsd to XJC, like this: $ xjc http://www.w3.org/2001/xml.xsd 2. use the catalog support to help XJC resolve the schema for <xs:import $ cat xml-namespace.cat |
@glassfishrobot Commented Specifically, doing "xjc xml.xsd soap-envelope.xsd" as per option 1 in the parsing a schema... [ERROR] src-resolve: Cannot resolve the name 'xml:lang' to a [ERROR] s4s-elt-invalid-content.1: The content of 'reasontext' is invalid. Failed to parse a schema. You still need to 'hack' the xml.xsd by removing the DOCTYPE line in order for |
@glassfishrobot Commented |
@glassfishrobot Commented You can also try the "-nv" option to bypass the schema correctness check done by |
@glassfishrobot Commented I was downloading a local copy of the W3C schemas to get around proxy/firewall The problem with that is that the xml.xsd actually has a dependency on Similarly if I actually point xjc at the real URLs for the W3C schemas, and get xjc [-proxy blah...] http://www.w3.org/2001/xml.xsd I agree with you that the error messages are less than intuitive, but it looks |
@glassfishrobot Commented |
@glassfishrobot Commented |
|
I was trying to use JAXB to parse the MMAP schema from the SMS Forum
(http://www.smsforum.net/schemas/mmap/v1.0/mmap.xsd). I finally
tracked it down to XJC choking on the included SOAP envelope schema's
use of the xml:lang attribute for a tag called reasontext. Here's the
pared-down test case:
C:\java\src\baz>%JWSDP_HOME%\jaxb\bin\xjc.bat http://www.w3.org/2003/05/soap-
attribute
envelope/soap-envelope.xsd
%JWSDP_HOME%\jaxb\bin\xjc.bat http://www.w3.org/2003/05/soap-envelope/soap-
envelope.xsd
parsing a schema...
[ERROR] src-resolve: Cannot resolve the name 'xml:lang' to a
declaration component.
line 97 of soap-envelope.xsd
[ERROR] src-ct.0.1: Complex Type Definition Representation Error for
type 'reasontext'. Element 'attribute' is invalid, misplaced, or occurs too
often.
line 97 of soap-envelope.xsd
Failed to parse a schema.
C:\java\src\baz>
I believe that the relevant portions of the schemas and namespaces in
question are:
http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd
<xs:complexType name="reasontext">
xs:simpleContent
<xs:extension base="xs:string">
<xs:attribute ref="xml:lang" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
http://www.w3.org/2001/XMLSchema.xsd
<xs:complexType name="attribute" mixed="false">
xs:complexContent
<xs:extension base="xs:annotated">
xs:sequence
<xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType" />
</xs:sequence>
<xs:attributeGroup ref="xs:defRef" />
<xs:attribute name="type" type="xs:QName" />
<xs:attribute name="use" use="optional" default="optional">
xs:simpleType
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="prohibited" />
<xs:enumeration value="optional" />
<xs:enumeration value="required" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="default" type="xs:string" />
<xs:attribute name="fixed" type="xs:string" />
<xs:attribute name="form" type="xs:formChoice" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
http://www.w3.org/2001/XMLSchema.xsd
<xs:attributeGroup name="defRef">
xs:annotation
xs:documentationfor element, group and attributeGroup, which both define and
reference</xs:documentation>
</xs:annotation>
<xs:attribute name="name" type="xs:NCName" />
<xs:attribute name="ref" type="xs:QName" />
</xs:attributeGroup>
http://www.w3.org/XML/1998/namespace
The namespace whose name is http://www.w3.org/XML/1998/namespace is
bound by definition to the prefix xml: according to Namespaces in XML,
W3C Recommendation 14 Jan 1999. Note that unlike all other XML
namespaces, both the name and the prefix are specified; i.e., if you
want XML 1.0 processors to recognize this namespace, you must use the
reserved prefix xml:.
xml:lang and xml:space
As of the last update of this document, the XML 1.0 Specification
defines two attribute names in this namespace:
xml:lang
Designed for identifying the human language used in the scope of the
element to which it's attached.
.
.
.
I'm no XML schema expert, but it looks to me like "name" and "ref"
are both valid attributes for an xs:attribute tag and that the XML
namespace standard requires XML processors to recognize the xml:lang
attribute. From my newbie reading, this is not something to be fixed
in JSR 222/JAXB 2.0. So, this appears to me to be a bug in JAXB.
A secondary bug is that the original error message left the name of
the offending included schema blank:
C:\java\src\foo>d:\java\jwsdp\jwsdp-1.3\jaxb\bin\xjc.bat
attribute
http://www.smsforum.net/schemas/mmap/v1.0/mmap.xsd
parsing a schema...
[ERROR] src-resolve: Cannot resolve the name 'xml:lang' to a
declaration component.
line 97 of
[ERROR] src-ct.0.1: Complex Type Definition Representation Error for
type 'reasontext'. Element 'attribute' is invalid, misplaced, or occurs too
often.
line 97 of
Failed to parse a schema.
C:\java\src\foo>
In case it helps with problem diagnosis, I'm running with J2SDK 1.4.2
and have copied the endorsed jar files into the JRE lib as instructured
with JAXB 1.0.2:
C:\java\src\baz>java -version
java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
C:\java\src\baz>dir %JAVA_HOME%\jre\lib\endorsed
dir %JAVA_HOME%\jre\lib\endorsed
Volume in drive D has no label.
Volume Serial Number is 70AE-6E52
Directory of D:\java\j2se\j2sdk1.4.2\jre\lib\endorsed
03/31/2004 09:41 AM
.03/31/2004 09:41 AM ..
03/29/2004 01:28 PM 56,619 dom.jar
03/29/2004 01:28 PM 60,963 sax.jar
03/29/2004 01:28 PM 2,823,241 xalan.jar
03/29/2004 01:28 PM 2,667,618 xercesImpl.jar
10/10/2003 06:36 PM 1,379,810 xsltc.jar
6 File(s) 6,989,573 bytes
2 Dir(s) 7,889,731,584 bytes free
C:\java\src\baz>%JWSDP_HOME%\jaxb\bin\xjc.bat -version
xjc version "1.0.2-b15-fcs"
JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build
1.0.2-b15-fcs)
C:\java\src\baz>
I'm quite interested in the resolution of this issue as I'm stopped in
my tracks on progress here. Help with resolution, whether in JAXB or
my usage of it, will be much appreciated. I did a search of existing
issues but couldn't find a duplicate.
Environment
Operating System: All
Platform: All
Affected Versions
[JWSDP1.3 (JAXB1.0.2)]
The text was updated successfully, but these errors were encountered: