You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Arthur De Magalhaes (JIRA)" <xe...@xml.apache.org> on 2009/06/11 20:41:07 UTC

[jira] Commented: (XERCESJ-1378) PSVI wrong for laxly validated element with validated attribute

    [ https://issues.apache.org/jira/browse/XERCESJ-1378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718583#action_12718583 ] 

Arthur De Magalhaes commented on XERCESJ-1378:
----------------------------------------------

Upon investigation, I found out this bug is a little bit bigger:  seems like attributes are not taken into consideration AT ALL when making the decision on the ElementPSVI [validation attempted] property.

The example below shows that, if I have an element that contains a not-declared attribute (but the element and its child are themselves declared), the parent element will have the incorrect [validation attempted] property set to FULL (instead of partial, because we never attempted to validate the attribute, since it was not declared).

    public static final String SCHEMA3 =
        "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
                       " xmlns:my='http://example.org'" +
                       " targetNamespace='http://example.org'" +
                       " elementFormDefault='qualified'>\n" +
        "  <xs:attribute name='var' type='xs:integer'/>\n" +

        "  <xs:element name='unknown'>\n" +
        "    <xs:complexType>\n" +
        "      <xs:sequence/>\n" +
        "    </xs:complexType>\n" +
        "  </xs:element>\n" +
        
        "  <xs:element name='foo'>\n" +
        "    <xs:complexType>\n" +
        "      <xs:sequence/>\n" +
        "    </xs:complexType>\n" +
        "  </xs:element>\n" +
        "</xs:schema>\n";

    public static final String INPUT3 =
        "<my:unknown xmlns:my='http://example.org' my:var2='7'><my:foo/></my:unknown>";


======= Ouptut ===========
  Element my:unknown [validation attempted] == full [validity] == invalid
  Attr my:var2 [validation attempted] == none [validity] == not known
    Element my:foo [validation attempted] == full [validity] == valid


>  PSVI wrong for laxly validated element with validated attribute
> ----------------------------------------------------------------
>
>                 Key: XERCESJ-1378
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1378
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema API
>    Affects Versions: 2.9.1
>            Reporter: Arthur De Magalhaes
>            Assignee: Arthur De Magalhaes
>            Priority: Minor
>
> Credit to Henry Zongaro for finding this bug.  
> If an element is laxly assessed and it has an attribute that is strictly assessed, the [validation attempted] property of the element's PSVI should be "partial" according to <http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#sic-e-outcome>.  However, Xerces seems to set that property to "none" unless the element also had a child element whose [validation attempted] not "none".
> Using the two instances below, they both should have the "unknown" element with a validation attempted field as "partial", but only the second instance has that (the first one has validation attempted field as "none")
> ----- Problem recreation ---------------
>     public static final String SCHEMA =
> "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
>                " xmlns:my='http://example.org'" +
>                " targetNamespace='http://example.org'" +
>                " elementFormDefault='qualified'>\n" +
> "  <xs:attribute name='var' type='xs:integer'/>\n" +
> "  <xs:element name='foo'>\n" +
> "    <xs:complexType>\n" +
> "      <xs:sequence/>\n" +
> "    </xs:complexType>\n" +
> "  </xs:element>\n" +
> "</xs:schema>\n";
>     public static final String INPUT1 =
>         "<unknown xmlns:my='http://example.org' my:var='7'/>";
>     public static final String INPUT2 =
>         "<unknown xmlns:my='http://example.org' my:var='7'><my:foo/></unknown>";

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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