[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    [jira] Created: (XMLBEANS-379) SimpleValue interface doesn't work
From:       "David Gileadi (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date:       2008-08-14 19:21:44
Message-ID: 699355367.1218741704223.JavaMail.jira () brutus
[Download RAW message or body]

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.
-
You can reply to this email to add a comment to the issue online.


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic