16 messages in org.apache.xmlbeans.userRe: Creating complexType objects...
FromSent OnAttachments
Kent SpauldingJul 26, 2005 11:47 am 
Don StewartJul 27, 2005 1:58 am 
Caroline WoodJul 27, 2005 2:01 am 
Kent SpauldingJul 27, 2005 8:05 am 
Cezar AndreiJul 27, 2005 9:55 am 
Dave HarrisonJul 27, 2005 10:09 am 
stephJul 27, 2005 10:41 am 
Dave HarrisonJul 27, 2005 11:09 am 
Kent SpauldingJul 27, 2005 11:28 am 
Stephane MorucciJul 27, 2005 11:29 am 
Kent SpauldingJul 27, 2005 11:44 am 
Cezar AndreiJul 27, 2005 2:10 pm 
Dave HarrisonJul 27, 2005 2:44 pm 
Kent SpauldingJul 27, 2005 3:31 pm 
Dave HarrisonJul 28, 2005 5:43 am 
Kent SpauldingJul 28, 2005 9:56 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Creating complexType objects...Actions...
From:Kent Spaulding (Kent@Sun.COM)
Date:Jul 28, 2005 9:56:32 am
List:org.apache.xmlbeans.user

Hi Dave,

XmlObject.Factory.parse() will try to map to the correct type as long as the generated types can be found on the classpath. I've never had to deal with unknown document types in the real world, only unknown and invalid types within those documents, so I've never actually put this into real code, other than the early days when I always parsed via XmlBeans (through ignorance), but I still knew the Document type.

Indeed it does, I was using a generated type's Factory.parse(xmlString); but the string being parsed was a Document surrounding the type, not an xml-fragment of the type I wanted.

I cannot return the xml-fragment string (spec won't allow that); so now my client just needs to either deal with documents, or convert to the enclosed type.

Vague, I know - but you've helped me out quite a bit - thanks.

However, after the reading the javadoc for the SchemaType interface I'd try something like this: (comments from the javadocs)

XmlObject obj = XmlObject.Factory.parse(xmlString); if(AddRequest.type.isAssignableFrom(obj.type) // True if the specified type derives from this type (or if it is the same type). { AddRequest addRequest = (AddRequest)obj.changeType(AddRequest.type); //Changes the schema type associated with this data and returns a new XmlObject instance whose schemaType is the new type. }

I think this is useful information too - thanks again Dave.

--Kent