KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
...or Why do these files validate in Visual Studio 2010 but not with xmllint 1 ? I'm currently working against a published xml schema where the original author's habit is to break down the schemas into several .xsd-files, but where some schema files have the same targetNamespace . Is this really "allowed"? Example (extremely simplified): File targetNamespace Contents ------------------------------------------------------------ b1.xsd uri:tempuri.org:b complex type "fooType" b2.xsd uri:tempuri.org:b simple type "barType" a.xsd uri:tempuri.org:a imports b1.xsd and b2.xsd definition of root element "foo", that extends "b:fooType" with an attribute of "b:barType" (Complete file contents below.) Then I have an xml file, data.xml , with this content: <?xml version="1.0"?> <foo bar="1" xmlns="uri:tempuri.org:a" xmlns:xs="http://www.w3.org/2001/XMLSchema" /> For a long time, I have believed that all of this was correct, since Visual Studio apparently allows this schema style. However, today I decided to set up a command line utility for validating xml files, and I chose xmllint . When I ran xmllint --schema a.xsd data.xml , I was presented with this warning: a.xsd:4: element import: Schemas parser warning : Element '{ http://www.w3.org/2001/XMLSchema }import': Skipping import of schema located at 'b2.xsd' for the namespace 'uri:tempuri.org:b', since this namespace was already imported with the schema located at 'b1.xsd'. The fact that the import of b2.xsd was skipped obviously leads to this error: a.xsd:9: element attribute:
Tags (comma-separated)
Save Edits
Cancel