Thanks for your reply.

The problem is that when i do a save or a toString on the 
responseDocument, I get the printout below (a small cutout of a complete 
document). As you can see, the namespaces takes a lot of the space in the 
document.

<agr:findAgreementsResponse 
xmlns:agr="http://xmlns.trygvesta.com/dopa/service/agreement";>
    <agr:CollectionOfAgreements>
        <agr1:Agreement 
CustomerUuid="323e8d4e-1935-4895-b613-e4762ee4a98a" 
ProcessingState="noChange" PrimaryKey="1100586549375" 
xmlns:agr1="http://xmlns.trygvesta.com/dopa/object/agreement";>
            <abs:Properties Value="473f1b6d-ebb6-491e-805c-95c2094e181c" 
Name="AgreementUuid" 
xmlns:abs="http://xmlns.trygvesta.com/dopa/object/abstractdopadomain"/>
            <abs:Properties Value="NOR" Name="AgreementType" 
xmlns:abs="http://xmlns.trygvesta.com/dopa/object/abstractdopadomain"/>
            <abs:Properties Value="5035" Name="AgreementPostalCode" 
xmlns:abs="http://xmlns.trygvesta.com/dopa/object/abstractdopadomain"/>
            <abs:Properties Value="5035" Name="PayerPostalCode" 
xmlns:abs="http://xmlns.trygvesta.com/dopa/object/abstractdopadomain"/>
            <abs:Properties Value="false" Name="ManualTaskExist" 
xmlns:abs="http://xmlns.trygvesta.com/dopa/object/abstractdopadomain"/>
            <abs:Properties Value="true" 
Name="PayerAddressAutomaticUpdate" 
xmlns:abs="http://xmlns.trygvesta.com/dopa/object/abstractdopadomain"/>
            <abs:Properties Value="0" Name="AgrUnionDiscountPct" 
xmlns:abs="http://xmlns.trygvesta.com/dopa/object/abstractdopadomain"/>
        </agr1:Agreement>
    </agr:CollectionOfAgreements>
</agr:findAgreementsResponse>

If i use the parse method as described in the first post, these 
namepsacedeclarations are removed and only set once at the top, which 
saves A LOT of sent characters. But I don't want to call the parse-method, 
as it has to go through the entire xmlstructure. And the second problem is 
that i do not control which method is called to actually send the xm. That 
is handled by weblogic which I belive only calls the toString method. What 
I would like was a possibility to set which namespace prefixes to use when 
calling the newInstance on the reponseDocument factory, since this takes a 
xmloption object. Then it could send this down to it's children when i do 
a reponseDocument.addCollectionOfAgreements() and the like. But from the 
javadocs, the method you described only has an effect on the save and 
xmlText methods.

Is there any way to achieve my desired goal, or is this not possible with 
the way xmlbeans works currently?


mvh
Knut-Erik Johnsen




"Jacob Danner" <[EMAIL PROTECTED]> 
Sent by: 
[EMAIL PROTECTED]
11.12.2007 03:28
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: Large xmldocuments and namespace declarations






Hi Knut,
There is a method on XmlOptions that you can populate with a Map
containing Qnames for the namespaces in your document. I don't have
the javadoc in front of me, but I think its setSaveSuggestedPrefix().
I've also had some success walking the instance via the XmlCursor API
and adding namespaces that way.

I'm curious how all the elements in your instance are getting the
namespace declarations. Could you explain a bit more? It might help to
better frame the problem.
 -jacobd

On 12/10/07, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Hi there all :)
>
> We are using xmlbeans in webservices with xfire and are sending quite
> large xmldocuments back and forth between the layers.
>
> Our problem is that the namepace declarations take up almost the same
> amount of space (in the sent xml file) as the actual data. This is due 
to
> the fact that each element declares it's namespace, not using what might
> have been declared allready by it's parentnodes. To remove these 
unwanted
> declarations, we do a :
>
> 
FindAgreementsResponseDocument.Factory.parse(findAgreementsResponseDocument.newReader(getXmlOptions()))
>
>
> where the Xmloptions are
>
> xmlOpt.setSaveAggressiveNamespaces();
> xmlOpt.setSaveNamespacesFirst();
>
> This forces (as I have understood the documentation) a double loop 
through
> the entire xml structure to first find all namespaces, and then to 
update
> all instances with the new ones. This gives us quite a performance hit
> both on memory and on cpu time.
>
> Is there any way to set on the documentinstance which namespaces we are
> going to use and use them when i call i.e.
> findAgreementsResponseDocument.addNewAgreement().
>
> This would solve both the xmlsize problem and the performance hit on the
> xmlOptions approach.
>
> Is there any such way to solve this, or is the xmlOptions the only way?
>
> Thanks in advance.
>
> mvh
> Knut-Erik Johnsen
>
>
> *********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept
> for the presence of computer viruses.
>
> *********************************************************************

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




*********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity whom they
are addressed. If you have received this email in error please notify
the system manager.
  
This footnote also confirms that this email message has been swept
for the presence of computer viruses.
  
*********************************************************************

Reply via email to