File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes assert error using schema 1.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "assert error using schema 1.1" Watch "assert error using schema 1.1" New topic

assert error using schema 1.1

Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104

I am facing problem in creating a schema if anyone could please assist. I am using Oxygen XML Editor. So the problem is that I have a schema declaration as below:

So what teh above intends is that some element has an 'output' attribute which is optional. But if this attribute is defined, then it cannot have values 'result' or 'isTimedOut' i.e. if in the instance xml I say output="result" then it should not validate.
Now the problem is that in the xml I cannot have the element without 'output' attribute even though I am declaring it as optional. So if the tag does not define the output attrbute then the xml is not validated. Could anyone please suggest how to mandate the optional behaviour for this attribute. Below is the error that Oxygen gives:
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 632
Below is the error that Oxygen gives:
view plaincopy to clipboardprint?
Element task does not satisfy assertion (@output ne 'result') and (@output ne 'isTimedOut')

That shouldn't be for a proprely made schema v1.1 support validator. Oxygen probably bundles 3rd parties processors - I do not have Oxygen at my disposal - and that the support of v1.1 is somewhat still "work-in-progress" with compliance improving over time. Hence, you first have to determine which underlying validator you're using and whether it is feasible to update that. That is probably the step you've to take above all.

For a v1.1 compliant schema processor, there should have no need to independently checking for "existence" of output attribute for the test conditions in the xs:assert element. You can do but it should need and if it results in error without, adding existence test would probably not do any better as it signifies the support is already broken at that part.

In the meantime, you can try to rewrite it in a more concise alternative see if it does any magic - I don't expect much, though.
Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104
I changed it as below and it is working now:

I agree. Here's the link:
subject: assert error using schema 1.1
It's not a secret anymore!