-
Notifications
You must be signed in to change notification settings - Fork 34
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
Target namespaces #26
Comments
Hello, Thanks for using the library. The library only works with local files, which means that if the value used in the target namespace isn't a path to a local file it won't be able to validate the elements using that namespace. I'll try to look into adding support to external namespace declarations, maybe this weekend. Edit: If you could provide me with the real example that you are using it would help my development. |
Dear lcduarte Thank you for your answer. The given XSD triggers the bug. It's a minimal example for you. We have a whole chain of XSDs, therefore each XSD has a different targetNamespace, which is never empty. Example: One XSD with base types, let's call it "first.xsd", imports all elements into targetNamespace="urn:com/example/mynamespace". This is a not-so-exotic ability of XSDs I guess and I would love to have it supported in your library. We use it for extended validation, sorting of elements and for code emitter templates. Sincerely, |
Hello umarti, It took me a while but I finally had time to properly investigate the issue. I've made some changes and I'll use the following xsd file to explain them: Customer Types XSD <xs:schema xmlns:cmn="http://NamespaceTest.com/CommonTypes"
targetNamespace="http://NamespaceTest.com/CustomerTypes"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:import schemaLocation="issue_26_CommonTypes.xsd"
namespace="http://NamespaceTest.com/CommonTypes" />
<xs:complexType name="CustomerType">
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="DeliveryAddress" type="cmn:AddressType" />
<xs:element name="BillingAddress" type="cmn:AddressType" />
</xs:sequence>
</xs:complexType>
</xs:schema>
I've made a new release with these corrections, (1.0.31). Thank you for your input, it was something that was really missing from the library since I didn't fully understood it and hadn't time to investigate the problem. |
Hi Luís Thank you for your efforts. I gave 1.0.33-SNAPSHOT a try and got a NullPointerException. The following extension to issue_26_CommonTypes.xsd triggers it: <xs:schema targetNamespace="http://NamespaceTest.com/CommonTypes" Sincerely, |
Hi Urs, Sorry for the delay. Your error seems to be triggered by:
Since you are already in the namespace where AddressType is declared you shouldn't need to use the namespace prefix in the Either way I'll try to add a safeguard for this case. |
Safeguard added in 1.0.34. |
I get an exception "XsdSchema refers a namespace which was not imported." while parsing the following valid XSD file:
It seams, that XsdParser doesn't like targetNamesparce and its namespace declaration.
The text was updated successfully, but these errors were encountered: