You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Taki Kamiya <tk...@us.fujitsu.com> on 2008/08/06 03:07:47 UTC

getLexicalValue method of XSDateTime does not return original lexical value

Hi,

Given the schema below, with Xerces schema API, having
access to XSDateTime representing the fixed value for
the attribute use, getLexicalValue method returns
"2003-04-24" instead of "2003-04-25+09:00".

I found that, if I changed the order of the checkings that
are done in checkDefaultValid method of  org.apache.xerces.
impl.xs.traversers.XSDAttributeTraverser class as follows,
I get "2003-04-25+09:00".

    // throws an error if the constraint value is invalid for the given type
    void checkDefaultValid(XSAttributeUseImpl attrUse) throws InvalidDatatypeValueException {
        // validate the canonical lexical rep
        ((XSSimpleType)attrUse.fAttrDecl.getTypeDefinition()).validate(attrUse.fDefault.stringValue(), fValidationState,
attrUse.fDefault);
        // validate the original lexical rep, and set the actual value
        ((XSSimpleType)attrUse.fAttrDecl.getTypeDefinition()).validate(attrUse.fDefault.normalizedValue, fValidationState,
attrUse.fDefault);
    }

Regards,

-taki


<xsd:schema targetNamespace="urn:foo"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:foo="urn:foo" >

<xsd:attribute name="date" type="xsd:date" />

<xsd:complexType name="date">
  <xsd:attribute ref="foo:date" fixed="2003-04-25+09:00" />
</xsd:complexType>

</xsd:schema>


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org