You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Robert Liguori (JIRA)" <xm...@xml.apache.org> on 2011/08/07 20:48:27 UTC

[jira] [Commented] (XMLBEANS-379) SimpleValue interface doesn't work for empty types that are extensions of mixed non-empty types

    [ https://issues.apache.org/jira/browse/XMLBEANS-379?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080621#comment-13080621 ] 

Robert Liguori commented on XMLBEANS-379:
-----------------------------------------

I've conversed through e-mail with the creator of this JIRA issue.  

He noted the following in regards to recreating the issue:

"Reproducing the issue is a matter of finding the HL7 v3 schemas (never a simple task; possibly available somewhere here [http://www.hl7.org/v3ballot/html/index.htm]), running them through XmlBeans and then calling set_String on an instance of EnFamily.  Assuming that EnFamily is still defined as being empty with a non-empty ancestor you should be able to reproduce the bug."

> SimpleValue interface doesn't work for empty types that are extensions of mixed non-empty types
> -----------------------------------------------------------------------------------------------
>
>                 Key: XMLBEANS-379
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-379
>             Project: XMLBeans
>          Issue Type: Bug
>         Environment: Windows XP, JDK 1.5.0_16, XmlBeans version 2.4.0 (not available in the list above).
>            Reporter: David Gileadi
>            Priority: Minor
>
> I'm working with the HL7 v3 schemas.  Types like en.family:
>    <xsd:complexType name="en.family" mixed="true">
>       <xsd:complexContent>
>          <xsd:restriction base="ENXP">
>             <xsd:attribute name="partType" type="EntityNamePartType" fixed="FAM"/>
>          </xsd:restriction>
>       </xsd:complexContent>
>    </xsd:complexType>
> are mixed, but have no element children in their definition.  However, in this case the grandparent type, ST, does have element children:
>    <xsd:complexType name="ST" mixed="true">
>       <xsd:annotation>
>          <xsd:documentation>
> The character string data type stands for text data, primarily
> intended for machine processing (e.g., sorting, querying, indexing,
> etc.) Used for names, symbols, and formal expressions.
> </xsd:documentation>
>          <xsd:appinfo>
>             <sch:pattern xmlns:sch="http://www.ascc.net/xml/schematron" name="validate ST">
>                <sch:rule abstract="true" id="rule-ST">
>                   <sch:report test="(@nullFlavor or text()) and not(@nullFlavor and text())">
>                      <p xmlns:hl7="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gsd="http://aurora.regenstrief.org/GenericXMLSchema" xmlns:xlink="http://www.w3.org/TR/WD-xlink">Text content is only allowed in non-NULL values.</p>
>                   </sch:report>
>                </sch:rule>
>             </sch:pattern>
>          </xsd:appinfo>
>       </xsd:annotation>
>       <xsd:complexContent>
>          <xsd:restriction base="ED">
>             <xsd:sequence>
>                <xsd:element name="reference" type="TEL" minOccurs="0" maxOccurs="0"/>
>                <xsd:element name="thumbnail" type="ED" minOccurs="0" maxOccurs="0"/>
>             </xsd:sequence>
>             <xsd:attribute name="representation" type="token_BinaryDataEncoding" fixed="TXT"/>
>             <xsd:attribute name="mediaType" type="cs" fixed="text/plain"/>
>             <xsd:attribute name="language" type="cs" use="optional"/>
>             <xsd:attribute name="compression" type="CompressionAlgorithm" use="prohibited"/>
>             <xsd:attribute name="integrityCheck" type="bin" use="prohibited"/>
>             <xsd:attribute name="integrityCheckAlgorithm" type="IntegrityCheckAlgorithm" use="prohibited"/>
>          </xsd:restriction>
>       </xsd:complexContent>
>    </xsd:complexType>
> and its ancestors do too.
> I'm trying to use the SimpleValue interface to get/set the string value of a generated EnFamily class (and others).  However, the SchemaType for EnFamily has a contentType of EMPTY_CONTENT, not MIXED_CONTENT.  And XmlComplexContentImpl.set_String() throws an IllegalArgumentException if you try to set the string value to a type that isn't no type or MIXED_CONTENT.
> I think that either the type system should change to define a new MIXED_EMPTY_CONTENT type or XmlComplexContentImpl should change to check the ancestor types to see whether they're mixed before throwing the IllegalArgumentException.
> The workaround I'm using is to add an extension to classes like EnFamily that I need to get/set text in, and using an XmlCursor to get/set the text value.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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