Hm, actually I believe ELEMENT_CONTENT is what it should be. The
<xs:any> tells you that you can have any number of arbitrarily named
elements, but you can't have text as a direct child of "blackBox".

And there is a difference between having the XML content as String (like
in a CDATA section) and having it as XML, just from an XML processing
point of view, regardless of XMLSchema.

So you should decide which one makes more sense for you: treating it as
String or treating it as unknown element content (it is also possible to
combine <xs:any> with "mixed", though in your case it sounds like this
is not what you want), and then make sure the XML documents match this
decision.

Radu

-----Original Message-----
From: Jim McMaster [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 05, 2006 2:15 PM
To: user@xmlbeans.apache.org
Subject: Problem with element defined with xs:any


Using xmlbeans-2.0, although I get the same result with 2.1.  

I have defined an element in a schema as follows:

<xs:element name="blackBox">
   <xs:complexType>
      <xs:sequence>
         <xs:any minOccurs="0" 
                 nameSpace="##any" 
                 maxOccurs="unbounded" 
                 processContents="skip" 
         />
      </xs:sequence>
   </xs:complexType>
</xs:element>

I am feeding the compiled schema definition to an XML generator.  The
element contains content passed to us from a third party, and it may or
may not contain valid XML.  In any case, we do not have a definition for
it.  I get it back as a String, and need to write the String out as
content for the blackBox element.

When I compile the schema, the SchemaType generated shows a content type
of 3, or org.apache.xmlbeans.SchemaType.ELEMENT_CONTENT.  The XML
generator only writes out the value if the content type is
NOT_COMPLEX_TYPE || SIMPLE_CONTENT || MIXED_CONTENT.  Having it defined
as ELEMENT_CONTENT means the generator only outputs elements.  

I am not familiar with the innards of the compiler, but it seems to me
ELEMENT_CONTENT is the wrong thing here.  I believe it should be
MIXED_CONTENT.  Should I put in a bug report?  Or does anyone have a
workaround?

-- 
Jim McMaster
mailto:[EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to