You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by kn...@trygvesta.no on 2007/12/10 22:09:02 UTC
Large xmldocuments and namespace declarations
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.
*********************************************************************
RE: Large xmldocuments and namespace declarations
Posted by Cezar Andrei <ce...@bea.com>.
I see. Than you shoud make sure you're saving them at the beginning of
the document and for each chunk use the following XmlOption to avoid
outputting the namespaces again:
/**
* If namespaces have already been declared outside the scope of the
* fragment being saved, this allows those mappings to be passed
* down to the saver, so the prefixes are not re-declared.
*
* @param implicitNamespaces a map of prefixes to uris that can be
* used by the saver without being declared
*
* @see XmlTokenSource#save(java.io.File, XmlOptions)
* @see XmlTokenSource#xmlText(XmlOptions)
*/
public XmlOptions setSaveImplicitNamespaces (Map implicitNamespaces)
Cezar
________________________________
From: knut.erik.johnsen@trygvesta.no
[mailto:knut.erik.johnsen@trygvesta.no]
Sent: Wednesday, December 12, 2007 2:22 PM
To: user@xmlbeans.apache.org
Subject: RE: Large xmldocuments and namespace declarations
Yes i did. But the problem with this is that the method must be run
after you build the entire structure in memory. Then it iterates twice
over it and that takes quite a lot of cpu time. I want to be able to add
the namespaces and prefixes at createInstance time, so that i don't need
to run this method to change them afterwards.
mvh
Knut-Erik Johnsen
"Cezar Andrei" <ce...@bea.com>
Sent by:
user-return-5109-knut.erik.johnsen=trygvesta.no@xmlbeans.apache.org
12.12.2007 21:07
Please respond to
user@xmlbeans.apache.org
To
<us...@xmlbeans.apache.org>
cc
Subject
RE: Large xmldocuments and namespace declarations
Knut, did you try using the following save option?
/**
* Causes the saver to reduce the number of namespace prefix
declarations.
* The saver will do this by passing over the document twice, first
to
* collect the set of needed namespace declarations, and then second
* to actually save the document with the declarations collected
* at the root.
*
* @see XmlTokenSource#save(java.io.File, XmlOptions)
* @see XmlTokenSource#xmlText(XmlOptions)
*/
public XmlOptions setSaveAggressiveNamespaces()
Cezar
________________________________
From: knut.erik.johnsen@trygvesta.no
[mailto:knut.erik.johnsen@trygvesta.no]
Sent: Tuesday, December 11, 2007 2:00 AM
To: user@xmlbeans.apache.org
Subject: Re: Large xmldocuments and namespace declarations
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" <ja...@gmail.com>
Sent by:
user-return-5101-knut.erik.johnsen=trygvesta.no@xmlbeans.apache.org
11.12.2007 03:28
Please respond to
user@xmlbeans.apache.org
To
user@xmlbeans.apache.org
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, knut.erik.johnsen@trygvesta.no
<kn...@trygvesta.no> 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(findAgreementsResponseDocum
ent.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: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
*********************************************************************
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.
*********************************************************************
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.
*********************************************************************
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.
*********************************************************************
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.
RE: Large xmldocuments and namespace declarations
Posted by kn...@trygvesta.no.
Yes i did. But the problem with this is that the method must be run after
you build the entire structure in memory. Then it iterates twice over it
and that takes quite a lot of cpu time. I want to be able to add the
namespaces and prefixes at createInstance time, so that i don't need to
run this method to change them afterwards.
mvh
Knut-Erik Johnsen
"Cezar Andrei" <ce...@bea.com>
Sent by:
user-return-5109-knut.erik.johnsen=trygvesta.no@xmlbeans.apache.org
12.12.2007 21:07
Please respond to
user@xmlbeans.apache.org
To
<us...@xmlbeans.apache.org>
cc
Subject
RE: Large xmldocuments and namespace declarations
Knut, did you try using the following save option?
/**
* Causes the saver to reduce the number of namespace prefix
declarations.
* The saver will do this by passing over the document twice, first to
* collect the set of needed namespace declarations, and then second
* to actually save the document with the declarations collected
* at the root.
*
* @see XmlTokenSource#save(java.io.File, XmlOptions)
* @see XmlTokenSource#xmlText(XmlOptions)
*/
public XmlOptions setSaveAggressiveNamespaces()
Cezar
From: knut.erik.johnsen@trygvesta.no
[mailto:knut.erik.johnsen@trygvesta.no]
Sent: Tuesday, December 11, 2007 2:00 AM
To: user@xmlbeans.apache.org
Subject: Re: Large xmldocuments and namespace declarations
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" <ja...@gmail.com>
Sent by:
user-return-5101-knut.erik.johnsen=trygvesta.no@xmlbeans.apache.org
11.12.2007 03:28
Please respond to
user@xmlbeans.apache.org
To
user@xmlbeans.apache.org
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, knut.erik.johnsen@trygvesta.no
<kn...@trygvesta.no> 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: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
*********************************************************************
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.
*********************************************************************
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.
*********************************************************************
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.
*********************************************************************
RE: Large xmldocuments and namespace declarations
Posted by Cezar Andrei <ce...@bea.com>.
Knut, did you try using the following save option?
/**
* Causes the saver to reduce the number of namespace prefix
declarations.
* The saver will do this by passing over the document twice, first
to
* collect the set of needed namespace declarations, and then second
* to actually save the document with the declarations collected
* at the root.
*
* @see XmlTokenSource#save(java.io.File, XmlOptions)
* @see XmlTokenSource#xmlText(XmlOptions)
*/
public XmlOptions setSaveAggressiveNamespaces()
Cezar
________________________________
From: knut.erik.johnsen@trygvesta.no
[mailto:knut.erik.johnsen@trygvesta.no]
Sent: Tuesday, December 11, 2007 2:00 AM
To: user@xmlbeans.apache.org
Subject: Re: Large xmldocuments and namespace declarations
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" <ja...@gmail.com>
Sent by:
user-return-5101-knut.erik.johnsen=trygvesta.no@xmlbeans.apache.org
11.12.2007 03:28
Please respond to
user@xmlbeans.apache.org
To
user@xmlbeans.apache.org
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, knut.erik.johnsen@trygvesta.no
<kn...@trygvesta.no> 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(findAgreementsResponseDocum
ent.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: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
*********************************************************************
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.
*********************************************************************
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.
Re: Large xmldocuments and namespace declarations
Posted by kn...@trygvesta.no.
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" <ja...@gmail.com>
Sent by:
user-return-5101-knut.erik.johnsen=trygvesta.no@xmlbeans.apache.org
11.12.2007 03:28
Please respond to
user@xmlbeans.apache.org
To
user@xmlbeans.apache.org
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, knut.erik.johnsen@trygvesta.no
<kn...@trygvesta.no> 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: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
*********************************************************************
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.
*********************************************************************
Re: Large xmldocuments and namespace declarations
Posted by Jacob Danner <ja...@gmail.com>.
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, knut.erik.johnsen@trygvesta.no
<kn...@trygvesta.no> 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: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org