xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Sateesh.Ku...@iflexsolutions.com>
Subject RE: toString() gives me <xml-fragment>...</xml-fragment>
Date Tue, 03 Aug 2004 04:52:59 GMT
Thanks Eric,
	This solves my problem.

Regards,
Sateesh

-----Original Message-----
From: Eric Vasilik [mailto:ericvas@bea.com] 
Sent: Monday, August 02, 2004 10:18 PM
To: xmlbeans-dev@xml.apache.org
Subject: RE: toString() gives me <xml-fragment>...</xml-fragment>

What seems to be happening is that you are populating an instance XML
Schema Balance type.  In XML Schema and XmlBeans, instances of Schema
types do not include the element/attribute which contains them.  So if
you have a schema like (severely abbreviated):
 
    schema
        element name = Balance
            complexType
                element name = Foo type=xs:string
 
XmlBeans generates two (2) types for the Balance global element.  The
first is called BalanceDocument and the second is called Balance.  To
illustrate the difference between these two types, consider a DOM
document holding an instance:
 
    DOMDocument
        <Balance>
            <foo>some string</foo>
        </Balance>
 
A BalanceDocument is a type whose content model allows for a single
<Balance> element.  An instance of a BalanceDocument schema type would
most likely be associated with the DOMDocument above, because the
DOMDocument contains a Balance element. 
 
Now, the Balance schema type (who is nested inside the BalanceDocument
type, similar in fashion to local/anonymous types) is a type whose
content model allows for a single foo element.  This type would be
associated with the <Balance> element, but the <Balance> element is
*not* part of its content model.  Only the contents of the <Balance>
element are part of its content model.
 
Thus, if you have an instance of the Balance type and you try to save it
out (xmlText), the <Balance> element, not being a part of this instance,
will not be saved out, which is why you get the xml-fragment syntax.  
 
If you want the <Balance> element to be saved out, you can, with this
example, save out the containing Document.
 
Make sense?
 
- Eric
 
-----Original Message-----
From: Sateesh.Kumar@iflexsolutions.com
[mailto:Sateesh.Kumar@iflexsolutions.com] 
Sent: Sunday, August 01, 2004 11:35 PM
To: xmlbeans-dev@xml.apache.org
Subject: RE: toString() gives me <xml-fragment>...</xml-fragment>
 
Eric,
I'm trying to create an xml dynamically from Database. I have populated
the xml objects from the result set and said toString of root
(objDBGMMessage.toString()), it is giving me the following result. Since
I'm going to generate a huge 40 MB xml file, I wanted to write the
<Balance> ...</Balance> elements to the Database instead of adding it to
the xml document itself because of the memory that is required to hold
the xml object is huge.
 
<DBGMMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Balances>
------------------------------------------------------
      <Balance>
        <Product>
          <AcsType>MMLOAN</AcsType>
          <AssetLiability>A</AssetLiability>
          <InstrumentType>LDD</InstrumentType>
          <ProductType>MMX</ProductType>
        </Product>
      </Balance>
            .
            .
            .
            .
------------------------------------------------------
    <Balances/>
</DBGMMessage>
 
When I populate the Balance elements in a loop and say
objBalance.toString() it gives me 
 
<xml-fragment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Product>
  <AcsType>MMLOAN</AcsType>
  <AssetLiability>A</AssetLiability>
  <InstrumentType>LDD</InstrumentType>
  <ProductType>MMX</ProductType>
</Product>
</xml-fragment>
 
Instead of giving <Balance>...</Balance>, it generates <xml-fragment>...
</ xml-fragment>
 
Regards,
Sateesh
  _____  

From: Eric Vasilik [mailto:ericvas@bea.com] 
Sent: Friday, July 30, 2004 9:17 PM
To: xmlbeans-dev@xml.apache.org
Subject: RE: toString() gives me <xml-fragment>...</xml-fragment>
 
Can you please post a simple example which demonstrates your issue?
 
-----Original Message-----
From: Sateesh.Kumar@iflexsolutions.com
[mailto:Sateesh.Kumar@iflexsolutions.com] 
Sent: Friday, July 30, 2004 5:19 AM
To: xmlbeans-dev@xml.apache.org
Subject: toString() gives me <xml-fragment>...</xml-fragment>
 
Hi,
I have created an element without and adding it to the parent I did
toString() it gives me <xml-fragment>...</xml-fragment>. Can somebody
suggest how can I generate the toString() properly without adding it to
the parent.
 
Thanks Regards,
Sateesh
 

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message