RNG validation in oXygen 11

This should cover W3C XML Schema, Relax NG and DTD related problems.
madde001
Posts: 80
Location: Durham, NC, USA

RNG validation in oXygen 11

Fri Nov 06, 2009 6:17 am

Hi George et al,

I just noticed a validation behavior in version 11 that strikes me as different from in the past. I'm wondering if I'm hallucinating.

I have a RNG schema like this:

<grammar
xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<element name="root">
<element name="child">
<value>xyz</value>
</element>
</element>
</start>
</grammar>

I create a partial instance like this:

<root>

</root>

I would expect to get a red light, since I am missing required content. But instead I get a green light. What is going on?

John
george
Site Admin
Posts: 2100

Re: RNG validation in oXygen 11

Fri Nov 06, 2009 8:39 am

Hi John,

Trying this but as expected oXygen gives me

Code: Select all

SystemID: /Users/george/test/test.xml
Engine name: Jing
Severity: error
Description: element "root" incomplete; missing required element "child"
Start location: 5:8


Please note that Jing has a property exposed in the oXygen options that makes the validation check if the document is "feasibly valid", that means it can reach a valid state by adding content or markup. When this option is set Jing makes all the patterns optional and then performs the validation. If I enable that then of course I get no validation errors because the document will become valid by adding a child element. So, make sure you have the "Check feasibly valid" option disabled from Options->Preferences -- XML -- XML Parser page in the Relax NG group. You will need to use "Reset cache and validate" first time or reopen the XML file in order to have the new option applied when you perform the validation.

I included my test files below, I added a schema association on the XML file:

test.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="test.rng" type="xml"?>
<root>
 
</root>


test.rng

Code: Select all

<grammar
  xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <element name="root">
      <element name="child">
        <value>xyz</value>
      </element>
    </element>
  </start>
</grammar>


Best Regards,
George
George Cristian Bina
madde001
Posts: 80
Location: Durham, NC, USA

Re: RNG validation in oXygen 11

Fri Nov 06, 2009 4:20 pm

Thanks, George. That was it. When I installed the upgrade, I must have selected "check feasibly valid" in Preferences. (I never until now knew what that meant, so I learned something here.)

Also, the change in Jing did not take effect until I did a "Reset cache and validate" action, so I guess I overlooked it when I previously tried fiddling blindly with Preferences.

John

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 1 guest