Page 1 of 1

Editing xml from RNG schema with fixed attrib of type QName

Posted: Fri Apr 18, 2008 12:27 pm
by PaulHermans
I have following example schema

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<grammar
xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
xmlns:overheid="test"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<element name="test" >
<attribute name="scheme">
<value type="QName">overheid:Gemeente</value>
</attribute>
</element>
</start>
</grammar>
Starting a fresh document leads to following instance:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="file:/Users/Paul/Desktop/test.rng" type="xml"?>
<test scheme="com.thaiopensource.datatype.xsd.QNameDatatype$QName@6e31ac62"

</test>
Is there something wrong with the schema or ?

Paul

Re: Editing xml from RNG schema with fixed attrib of type QName

Posted: Fri Apr 18, 2008 2:05 pm
by george
Hi Paul,

oXygen tries to insert also the value and it looks like we are using toString() to get a string representation to be inserted. The QName class does not implement toString and thus the default value that you get in the instance document.

Now, things are a little more complicated for inserting QName vales as they need to be resolved in the current namespace context. I will record this problem and we will investigate possible solutions. Of course a simple step is to offer no value when we have a QName, that fixes the wrong behavior at least.

Thanks,
George

Re: Editing xml from RNG schema with fixed attrib of type QName

Posted: Tue Apr 22, 2008 10:16 am
by Radu
Dear Paul,

We fixed QName insertion for RelaxNG to insert the value correctly by taking into account the available prefix in the current context for the QName namespace.
The fix will be available in 9.2 (probably in a couple of weeks).

Regards,
Radu

Re: Editing xml from RNG schema with fixed attrib of type QName

Posted: Tue Apr 22, 2008 11:30 am
by PaulHermans
Thanks.


Paul