Validating xml without namespace

Posted by / 23-Dec-2019 23:06

Validating xml without namespace

[Download RAW message or body] Well, I recently had quite similar problem: In short I wanted to validate an XML document (an actual XML Schema definition; .xsd) against the schema for XML Schema (weird, I know).

However, Xerces didn't really like that, because of the way schema support is implemented.

You'll know that your xsd file is being used to actually validate your xml if you get errors that require the xsd file, such as "Attribute xxx is not allowed" or "Element yyy is not defined" where xxx and yyy are in your xml but not in your xsd.

If you get errors like this, then you are successfully accessing your xsd file locally, and using it for validation. I'm assuming that the /xsd directory on the domain is treated as any other and won't need any special directves in web.xml, would that be correct?

I'm assuming that the /xsd directory on the domain is treated as any other and won't need any special directves in web.xml, would that be correct?

The xml is generated from our webapp and passed back to the client via Ajax.

I have just got it working using xsi:no Namespace Schema Locat You're right that you should have your file available to other services if you are passing a file back and forth.

I tryed to validate a XML file using a XSD schema with the example from here: Articles/xml/validationxpath/.

When you say "/xsd" it means that the URL is relative to the domain from which the XML was retrieved. The xml is generated from our webapp and passed back to the client via Ajax.

Commonly the URL is a fully qualified URL with domain, so that the file can be validated from any program with an Internet connection. The client stores the xml and my resubmit the xml via an Http Servlet Request at a later date.

there would be a statement before the root element.

Xerces, using my Input Source, would only see the cached and rewritten version. If your input files don't have an xmlns=".." attribute on your root element, you could simply add this in in-memory and then give that cached and edited version of the input stream to Xerces.

validating xml without namespace-70validating xml without namespace-32validating xml without namespace-56

The client stores the xml and my resubmit the xml via an Http Servlet Request at a later date.

One thought on “validating xml without namespace”