Comments (5)
Hello,
First, thanks for using this library!
The library doesn't validate xml namespaces that aren't present locally, as in, present in the file system. So in order to decide if I should search locally for a namespace definition to import and validate I check if the xmlns starts with http and actively ignore those since they aren't local.
In the abc
example the library searches for a xsd import tag with the namespace attribute with the value abc
, and since it doesn't find it you get a parsing exception.
Hope this explanation helps.
from xsdparser.
Hi there,
I have a similar problem. But first: I like the library. It has a lot of potential for us. However, the XSD we like to parse has some elements inside documentation blocks which the library tries to parse, and there is no import for them. The namespace ccts is defined like this:
xmlns:ccts="urn:un:unece:uncefact:documentation:standard:CoreComponentsTechnicalSpecification:2"
So we get an "XsdSchema refers a namespace which was not imported." error when we parse our XSD. The XSD file itself is external and I could add an import for the namespace, but it seems to be elusive... What do you suggest? Any way to handle this?
<xsd:complexType name='FooType'> <xsd:annotation> <xsd:documentation xml:lang="en"> <ccts:UniqueID>123</ccts:UniqueID> <ccts:ObjectClassQualifierTerm>ENUM</ccts:ObjectClassQualifierTerm> <ccts:OfficialConstraintContextValue> <CodeListEntry><value>01</value><definition>Male</definition></CodeListEntry> <CodeListEntry><value>02</value><definition>Female</definition></CodeListEntry> </ccts:OfficialConstraintContextValue> </xsd:documentation> </xsd:annotation> <xsd:sequence> <xsd:element name='value' minOccurs='1' maxOccurs='1'> <xsd:simpleType> <xsd:restriction base='xsd:string'> <xsd:pattern value='(01|02){1}'/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType>
from xsdparser.
@lcduarte, thanks for the explanation. Sounds very reasonable. I'll take my time to think a little bit about it :) That's the reason I don't close the issue. I'll do it when I'm done thinking :)
I also want to refresh my knowledge on xmlns
and targetNamespace
-- what they mean and what is their purpose. As far as I know, XML Schema also defines own namespace, which in turn can be used in other schemas or XML documents, so I'm in doubt a little bit about your arguments.
@radboudp , for now I see the only solution -- remove namespace without http:// before processing, which possibly is not easy. I did not try that, but I'll definitely will.
from xsdparser.
I solved it for now by defining an empty xsd and importing it for the namespace. Since the xml is part of the documentation, it is apparently exempt from parsing. After parsing I have seen the whole xml in the documentation field of the item. 👍
from xsdparser.
@lcduarte ,
I'm closing the issue, but I'm still not convinced about targetNamespace
. As I understand, it defines a namespace (e.g. container) for the element names defined by the XSD. For this reason targetNamespace
should not be validated. But if the name, defined by this targetNamespace
is used in another XSD, then yes – validation can/must be performed, but in such case validation will be performed on xmlns
.
from xsdparser.
Related Issues (20)
- I can't get the base ComplexType of a Restriction inside a complexContent HOT 2
- Resolution of imports via XML Catalog HOT 1
- compatibility break in xsdRestriction version 1.2.4 HOT 3
- Inconsistent Readme.md HOT 1
- Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD HOT 1
- Attributes in simpleContext HOT 2
- Null Pointer Exception Parsing OCX Schema HOT 1
- Multiple Pattern are not supported HOT 3
- Order of `xsd:element` and `xsd:group` not respected HOT 5
- feature request: union with memberTypes are resolved HOT 3
- Modification not backward compatible in XsdRestriction (xsdParser 1.2.5+) HOT 4
- References are not resolved from transitive dependencies (of more than one level) HOT 3
- Unsolved References are not correct HOT 3
- There are unsolved References in schema HOT 2
- java.lang.ClassCastException on XsdAttribute:198 - xsd parser version 1.2.9 HOT 4
- Parsing an XSD with no or a different prefix than xs or xsd fails with a ParsingException HOT 5
- Attributes are ignored HOT 1
- [1.2.12] XsdSimpleType : NullPointerException on XsdParserCore.getXsdTypeToJava(unionMemberRestriction.getBase()) HOT 2
- Using xs:include with relative paths leads to unresolved references HOT 2
- Inf. lookup with unqualified union memberTypes and circular includes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xsdparser.