You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by krishna Prasad Rao <kp...@yahoo.com> on 2005/04/28 07:54:40 UTC
Java Type of results needed
Hi All,
I am new to XMLBeans as well as xsd schemas ...
I can able to successfully compile my schema and can
able to retrieve my values ... but with in
<xml-fragment> tag only i can view my value ...
expained as below ...
My Java Code :
---------------
EnhancedEventDocument newESEDoc =
EnhancedEventDocument.Factory.parse( msgStr );
EnhancedEvent ese = newESEDoc.getEnhancedEvent();
String str =
ese.getPackageRevenueEnhancement().getPaymentAmount().toString();
System.out.println(str);
My Result Like :
----------------
<xml-fragment>12345</xml-fragment>
** I am expecting Only '12345' as the result.
What could be the Problem
My Schema file like :
--------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:oss="http://www.xyz.com/XSD">
<xsd:element name="EnhancedEvent"
type="EnhancedEvent"/>
<xsd:complexType name="EnhancedEvent">
<xsd:all>
<xsd:element name="package-revenue-enhancement"
type="REVEnhancement" minOccurs="0" maxOccurs="1"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="REVEnhancement">
<xsd:all>
<xsd:element name="no-rev-billing-flag"
type="IA5String" minOccurs="0" maxOccurs="1"/>
<xsd:element
name="first-unsuccessful-delivery-attempt-timestamp"
type="IA5String" minOccurs="0" maxOccurs="1"/>
<xsd:element name="payment-amount"
type="IA5String" minOccurs="0" maxOccurs="1"/>
<xsd:element name="ship-date"
type="IA5String" minOccurs="0" maxOccurs="1"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="IA5String" mixed="true">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:choice>
<xsd:element name="nul" type="NULL"/>
<xsd:element name="soh" type="NULL"/>
<xsd:element name="stx" type="NULL"/>
<xsd:element name="etx" type="NULL"/>
<xsd:element name="eot" type="NULL"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="NULL" />
</xsd:schema>
Thanks & Regards,
Prasad
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: Java Type of results needed
Posted by Haryon <ha...@gmail.com>.
your payment is of type IA5String, which is mixed=true, so you have to
expect not a string but some string mixed with XML elements. I guess
that's why you don't get a pure string, but a xml-fragment type.
I'm no expect of xmlbean, so I might be wrong :)
On 4/28/05, krishna Prasad Rao <kp...@yahoo.com> wrote:
> Hi All,
>
> I am new to XMLBeans as well as xsd schemas ...
> I can able to successfully compile my schema and can
> able to retrieve my values ... but with in
> <xml-fragment> tag only i can view my value ...
> expained as below ...
>
> My Java Code :
> ---------------
>
> EnhancedEventDocument newESEDoc =
> EnhancedEventDocument.Factory.parse( msgStr );
> EnhancedEvent ese = newESEDoc.getEnhancedEvent();
> String str =
> ese.getPackageRevenueEnhancement().getPaymentAmount().toString();
>
> System.out.println(str);
>
> My Result Like :
> ----------------
> <xml-fragment>12345</xml-fragment>
>
> ** I am expecting Only '12345' as the result.
> What could be the Problem
>
> My Schema file like :
> --------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:oss="http://www.xyz.com/XSD">
>
> <xsd:element name="EnhancedEvent"
> type="EnhancedEvent"/>
>
> <xsd:complexType name="EnhancedEvent">
> <xsd:all>
> <xsd:element name="package-revenue-enhancement"
> type="REVEnhancement" minOccurs="0" maxOccurs="1"/>
> </xsd:all>
> </xsd:complexType>
> <xsd:complexType name="REVEnhancement">
> <xsd:all>
> <xsd:element name="no-rev-billing-flag"
> type="IA5String" minOccurs="0" maxOccurs="1"/>
> <xsd:element
> name="first-unsuccessful-delivery-attempt-timestamp"
> type="IA5String" minOccurs="0" maxOccurs="1"/>
> <xsd:element name="payment-amount"
> type="IA5String" minOccurs="0" maxOccurs="1"/>
> <xsd:element name="ship-date"
> type="IA5String" minOccurs="0" maxOccurs="1"/>
> </xsd:all>
> </xsd:complexType>
>
> <xsd:complexType name="IA5String" mixed="true">
> <xsd:sequence minOccurs="0" maxOccurs="unbounded">
> <xsd:choice>
> <xsd:element name="nul" type="NULL"/>
> <xsd:element name="soh" type="NULL"/>
> <xsd:element name="stx" type="NULL"/>
> <xsd:element name="etx" type="NULL"/>
> <xsd:element name="eot" type="NULL"/>
> </xsd:choice>
> </xsd:sequence>
> </xsd:complexType>
>
> <xsd:complexType name="NULL" />
>
> </xsd:schema>
>
> Thanks & Regards,
> Prasad
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org