Your problem seems to come from the fact that your Schema doesn't
declare a "troubleTicketValue" element, even though there is a
troubleTicketValue type. But I think using "xml-fragment" is the right
way to handle it and should work fine.
What do you mean that the name of the tag is not "troubleTicketValue"?
Can you explain more?

Radu

-----Original Message-----
From: Ramin Roham-Pour [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 10, 2006 1:08 AM
To: [email protected]
Subject: Re: parsing global types

Hi!

Seems like my mail got lost somehow, so I try again now.

My problem:
When I parse the troubleticketvalue everything looks fine, until I add
it to the createTroubleTicketByValueRequest. If I do so the value is
placed into another troubleTicketValue-tag. This does not happen when I
replace the name of the topmost tag in the troubleTicketValue with
"xml-fragment", but then the name of the tag is not troubleTicketValue
when I get it back from the request to compare it.

My code:


String troubleTicketValue = loadXML("PPTTValue.xml");
CreateTroubleTicketByValueRequestDocument createReq = null;
TroubleTicketValue valuedoc = null; try{ createReq =
CreateTroubleTicketByValueRequestDocument.Factory.newInstance();
valuedoc = TroubleTicketValue.Factory.parse(troubleTicketValue);
}catch(Exception e){
log.error("Exception while parsing document: " + e.toString());
fail("Exception while parsing document: " + e.toString()); }


createReq.addNewCreateTroubleTicketByValueRequest().setTroubleTicketValu
e(valuedoc);
String createRequest = createReq.toString();

The PPTTValue.xml:
<troubleTicketValue
xsi:schemaLocation="http://java.sun.com/products/oss/xml/TroubleTicket
XmlTroubleTicketSchema.xsd" xsi:type="tt:TroubleTicketValue">
<co:lastUpdateVersionNumber>0</co:lastUpdateVersionNumber>
<tt:originator>Max Mustermann</tt:originator>
<tt:receivedTime>2004-12-23T00:00:00.0</tt:receivedTime>
<tt:troubleDescription>Fehlerbeschreibung</tt:troubleDescription>
<tt:troubledObject>defektes Ger t</tt:troubledObject>
<tt:troubleState>OPENACTIVE</tt:troubleState>
<tt:troubleStatus>SCREENING</tt:troubleStatus>
<tt:preferredPriority>MINOR</tt:preferredPriority>
</troubleTicketValue>

Please find the schema at:

http://java.sun.com/products/oss/xml/TroubleTicket/XmlTroubleTicketSchem
a.xsd
Regarding its size this might be easier for all than attaching it.

Ramin


Am Mo 06.02.2006 15:56 schrieb Edward Frederick <[EMAIL PROTECTED]>:

> Ramin,
> 
> Could you provide the schema, a sample of the XML you are parsing, and

> a snippet of the code that you're using to instantiate your 
> XMLBean(s)? It may be easier for someone to help with more 
> information. I have a suspicion, but It'd like to see some snippets to

> confirm it.
> 
> 
> Ed
> 
> 
> On 2/6/06, Ramin Roham-Pour <[EMAIL PROTECTED]> wrote:
> > Hi!
> >
> > I have a little problem in handling instances of global types 
> > generated by parsing an xml-string.
> >
> > In my schema there is defined an element containing a complex type, 
> > which is itself a global type in this schema. When I parse a 
> > xml-string to this complex type everything looks fine until I set 
> > this instance of the complex type as the one in an instance of the 
> > element. In the element the complex type is nested into another 
> > instance of the complex type and seems not to be recognized as a 
> > complex type, but as additional data not defined in the schema.
> > If I replace the name of the complex type in the xml-string with 
> > "xml-fragment" before parsing, the above described does not happen, 
> > instead everything works fine again until I compare this instance of

> > complex type to another instance. The comparison fails because the 
> > name of the instance is not the same, it is still xml-fragment...
> >
> > So for the moment I have to decide which of these problems I have to

> > work around, but I really would prefer to know how to handle these 
> > correctly.
> > My best way to avoid this is to write complete elements, parse those

> > and extract the complex types from them, but thats not really 
> > perfect, too.
> >
> > Thanks in advance for helping
> > Ramin
> >
> >
> >
> > --------------------------------------------------------------------
> > - 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]
> 


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

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

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

Reply via email to