I maintain the JDOM project and I am trying to 'certify' it on Android. Most things work fine, but XML Schema validation is proving problematic...
My questions are: Is there a way to do XMLSchema validation on Android? If there is, how?
Questions like this have been asked before, but no conclusive answer is given:
This is what I currently 'know' (correct me if I am wrong)...:
I have been working on this for some time now, and I have put together the following 'research':
If anyone has any more information about XMLSchema Validation on Android I would greatly appreciate any input at all.
If anyone has successfully done XMLSchema validation on XML and can help me get the functionality working for JDOM they'll get thousands of internet points ... ;-) and will be immortalized in the JDOM code and commit messages.
This object represents a set of constraints that can be checked/ enforced against an XML document. A Schema object is thread safe and applications are encouraged to share it across many parsers in many threads. A Schema object is immutable in the sense that it shouldn't change the set of constraints once it is created.
XML namespaces are used for providing uniquely named elements and attributes in an XML document. xmlns:android describes the android namespace. Its used like this because this is a design choice by google to handle the errors at compile time.
This class represents the basic building block for user interface components. A View occupies a rectangular area on the screen and is responsible for drawing and event handling. Views are used for Drawing Shapes like Circles,Rectangles,Ovals etc . Just Use View with background and apply a Shape using Custom Drawable.
I'm fascinated that, after several years, this still is an open issue. There only seems to be bad news, though. According to the AOSP Issue Tracker Schema validation currently seems unsupported with the standard Android APIs and Google seems to be unwilling to fix it:
Our XML APIs (including SAX, XmlPull and DOM) don't support any of the following:
XML Schema XML DTDs (including external entity declarations and references) validation element content whitespace
However, one commenter of that same ticket references a workaround, and provides example code using a Xerces port. I don't know if this goes beyond what you've figured out, so far, but I hope it helps.
To wrap this up: The SchemaFactoryFinder only knows the following Schema definitions:
Using any other schema definition causes it to fail (It will however log this on debug level). Obviously this is the case for you, as you're using another reference to the 2011 schema. So "correctly" referencing the Schema Definition should fix this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With