xml-xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Remy" <dr...@bea.com>
Subject RE: How to add SOAPElements to xsd:any portion of XmlObject
Date Wed, 14 Jul 2004 21:33:26 GMT
  _____  

From: Springer, Ian P. [mailto:ian.springer@hp.com] 
Sent: Wednesday, July 14, 2004 8:26 AM
To: xmlbeans-user@xml.apache.org
Subject: RE: How to add SOAPElements to xsd:any portion of XmlObject

 

Hi Eric,

 

Wouldn't it be possible for SchemaCompiler to generate operations along
the lines of:

 

public XmlObject[] getAny()

public void setAny( XmlObject[] xmlObjs )

public addToAny( XmlObject xmlObj )

 

There are problems with unambiguously supporting the getAny() API
related to certain content models (for example when the namespace
attribute on the xsd:any is ##any or matches the target namespace and
the content model supports a multiple occurrence element it is not
possible to distinguish whether the element is associated with the
recurrence or is within the xsd:any).  This mostly a correctness issue
but XMLBeans tends to be anal about getting these things right (IMO
appropriately). 

 

There are three ways to get to elements within an xsd:any all of which
are pretty easy.  The easiest (I think) which we introduced a few months
ago (Cezar did this work), is the selectChildren API
(http://wiki.apache.org/xmlbeans/SelectChildrenAndAttributesFeature) .
Also, you could use selectPath to do the same thing (actually I think
that is all that selectChildren does).  And, of course, you can also use
XmlCursor.

 

I don't remember discussing the update/insert aspects of xsd:any.  From
this email thread it seems that adding elements in an xsd:any scenario
seems like a pain.  I'm not sure that the same ambiguity situation
exists in this situation.  Cezar, you have thought about this some, what
do you think?  

 

? similar to what Axis does when it generates classes for schemas that
contain anys. This would make it a whole lot easier to work with schemas
containing anys. 

 

Regards,

Ian

	 

	
  _____  


	From: Eric Vasilik [mailto:ericvas@bea.com] 
	Sent: Wednesday, July 14, 2004 11:18 AM
	To: xmlbeans-user@xml.apache.org
	Subject: RE: How to add SOAPElements to xsd:any portion of
XmlObject

	XmlCursor is how content is interrogated/manipulated when a
Schema does not provide enough information for generated classes to be
generated (as is the case with xs:any).

	 

	You might be able to use a combination of XmlCursor and the
XmlObject.set to construct the desired document.  Also, you can use
XmlCursor to move content from one doc to another for the same purposes.
Are your soap elements XmlBeans, or is this SAAJ?

	 

	- Eric

	 

	-----Original Message-----
	From: Campana Jr., Salvatore J [mailto:sal.campana@hp.com] 
	Sent: Tuesday, July 13, 2004 2:41 PM
	To: xmlbeans-user@xml.apache.org
	Subject: How to add SOAPElements to xsd:any portion of XmlObject

	 

	I have generated an XmlBean for a schema which contains an
element which is of type xsd:any.  I am trying to determine the easiest
way to insert some SOAPElement objects into the XmlBean into this
xsd:any field.  (Note. I can convert the SOAPElements to String or DOM)

	 

	It seems as though a XmlCursor may provide a way to do it, but I
am not sure....

	 

	Here is a snippet of the schema:

	 

	<xsd:complexContent name="foo">

	    <xsd:sequence>

	      <xsd:any minOccurs="0" maxOccurs="unbounded"/>

	    </xsd:sequence>

	</xsd:complexContent>

	 

	<xsd:element name="FooBar" type="foo"/>

	 

	While a FooBar is generated, there is no direct way (from what I
can tell) in which I can add to the "any"....A XMLCursor will allow me
to create an element and add text, but since I do not know what type the
MessageElements will be, it becomes an exercise in walking all the
elements in the MessageElement structure to add the xml....Is there and
easier way?

	 

	 

	
  _____  


	 

	Sal Campana
	HP Software
	856.638.6284
	sal_campana@hp.com <mailto:sal_campana@hp.com>  

	<mailto:sal_campana@hp.com>  

	 


Mime
View raw message