RE: Large xmldocuments and namespace declarations

2007-12-12 Thread Cezar Andrei
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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
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 [EMAIL PROTECTED] 
Sent by:
[EMAIL PROTECTED] 

12.12.2007 21:07 

Please respond to
user@xmlbeans.apache.org

To

user@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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
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 [EMAIL PROTECTED] 
Sent by:
[EMAIL PROTECTED] 

11.12.2007 03:28 

 

Please respond to

RE: Using cursor to ierate and adding to map

2007-12-12 Thread Cezar Andrei
Zapo,

cursor.getName() returns the name of the current token. You need to make
sure you move the cursor on the right element to get the text and move
back to the parent Testcase and call toNextSibling().

 -Original Message-
 From: Zapo [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 11, 2007 5:17 PM
 To: user@xmlbeans.apache.org
 Subject: Using cursor to ierate and adding to map
 
 
 Greetings,
 
 I am trying to iterate a XML using cursor and then adding to MAP.
 The XML has repetable nodes for example
 
  Testcase
Securityhttps/Security
Serverstaging/Server
  /Testcase
  Testcase
   Securityhttps/Security
   Serverbaijing/Server
  /Testcase
 /Testcases
 
 I have an array of TestCase objects ready, how to iterate and add to a
Map
 or Array
 
 I tried the following way and it did not get too further..I seem to be
 missing the usage of cursor and addin to a MAP, I seem to overwrite my
MAP
 (which I should avoid),
 
   private static void addtoMap(Testcase item2, int i,
   LinkedHashMapString, String linkedHashMap) {
 
   XmlCursor cursor = item.newCursor();
 //Iterate throught the nodes
 
   cursor.toChild(0);
   String name = cursor.getName().toString();
   String value = cursor.getTextValue();
 
   //Add to Map
   linkedHashMap.put(name, value);
 
   //Next Sibling
cursor.toNextSibling();
 
   String name1 = cursor.getName().toString();
   String value1 = cursor.getTextValue();
 
 //Add to Map again
   linkedHashMap.put(name, value);
 
 
   System.out.println(Type of Token is:  +
   cursor.currentTokenType() +
 \nText of Token is + cursor.xmlText());
   //}
   cursor.dispose();
 
   }
 
 
 
 
 
 
 --
 View this message in context: http://www.nabble.com/Using-cursor-to-
 ierate-and-adding-to-map-tp14285663p14285663.html
 Sent from the Xml Beans - User mailing list archive at Nabble.com.
 
 
 -
 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]



RE: Large xmldocuments and namespace declarations

2007-12-12 Thread Cezar Andrei
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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
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 [EMAIL PROTECTED] 
Sent by:
[EMAIL PROTECTED] 

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, [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(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 

RE: newbie--override schemaorg_apache_xmlbeans prefix

2007-12-12 Thread Cezar Andrei
Richard,

It isn't supposed to work like this. 

The XMLSchema spec assumes that everybody is using namespaces and that
the QNames for different types and elements do not collide. This is the
model that XMLBeans uses, which is the same as java packages and classes
work.

In the rare cases when there is a requirement for more than this, as
java solves this problem, the solution is to use different classloaders.
Each classloader will have access to a non-coliding set of schema
artifacts.

If you describe your problem in more details maybe somebody on the list
might come up with a simpler solution.

Cezar


 -Original Message-
 From: Lucente, Richard D [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 11, 2007 12:03 PM
 To: user@xmlbeans.apache.org
 Subject: newbie--override schemaorg_apache_xmlbeans prefix
 
 Is it possible to override the default schemaorg_apache_xmlbeans
 prefix?  There are multiple xbean-packaged.jars on our project.  We
 could go through the pain of generating one for all and deconflicting,
 but it would be much easier if we could avoid package name overlaps.
 Any suggestions?
 
 -
 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]



RE: newbie--override schemaorg_apache_xmlbeans prefix

2007-12-12 Thread Lucente, Richard D
Cezar,

Thanks for the reply.  The issue is that we're using XMLBeans indirectly
as the data binding option with the Apache Axis2 WSDL2Java tool.
Several services are providing convenience libraries to simplify
interfacing to the service.  These convenience libraries are being
placed in common locations, so I can't take advantage of heirarchical
class loaders.  What complicates this even more is that namespace to
package overrides are being inconsistently applied so the same schema
may have several implementation mappings based on the package prefix
that was passed to WSDL2Java through the .xsdconfig file.

From your response, the right approach would seem to be a single
XMLBeans representation of common types that uses a consistent
.xsdconfig file rather than multiple flavors.  This is looking more like
a configuration management issue.

Still, it would be nice to have an option to override the default Schema
Type System name.  The downside seems to be redundant implementations of
common types, but I believe the result should still work.  Is that true?

-Original Message-
From: Cezar Andrei [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 12, 2007 3:08 PM
To: user@xmlbeans.apache.org
Subject: RE: newbie--override schemaorg_apache_xmlbeans prefix

Richard,

It isn't supposed to work like this. 

The XMLSchema spec assumes that everybody is using namespaces and that
the QNames for different types and elements do not collide. This is the
model that XMLBeans uses, which is the same as java packages and classes
work.

In the rare cases when there is a requirement for more than this, as
java solves this problem, the solution is to use different classloaders.
Each classloader will have access to a non-coliding set of schema
artifacts.

If you describe your problem in more details maybe somebody on the list
might come up with a simpler solution.

Cezar


 -Original Message-
 From: Lucente, Richard D [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 11, 2007 12:03 PM
 To: user@xmlbeans.apache.org
 Subject: newbie--override schemaorg_apache_xmlbeans prefix
 
 Is it possible to override the default schemaorg_apache_xmlbeans
 prefix?  There are multiple xbean-packaged.jars on our project.  We 
 could go through the pain of generating one for all and deconflicting,

 but it would be much easier if we could avoid package name overlaps.
 Any suggestions?
 
 -
 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]


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



RE: Large xmldocuments and namespace declarations

2007-12-12 Thread knut . erik . johnsen

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 [EMAIL PROTECTED] 
Sent by: 
[EMAIL PROTECTED]
12.12.2007 21:07
Please respond to
user@xmlbeans.apache.org


To
user@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: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] 
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 [EMAIL PROTECTED] 
Sent by: 
[EMAIL PROTECTED] 
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, [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 

Re: Using cursor to ierate and adding to map

2007-12-12 Thread Zapo

Thanks J,

I can, but the XML has multiple items, so I may need to do that in a loop
and then iterate to the next node.

Regards
Sunder

Jacob Danner-2 wrote:
 
 Why don't you just do
 linkedHashMap.put (
 item1.getSecurity() ,
 item1.getServer() )
 
 Or are you trying to do something else? ie, what are you trying to
 store in this hashmap?
 -jacobd
 
 On Dec 11, 2007 3:17 PM, Zapo [EMAIL PROTECTED] wrote:

 Greetings,

 I am trying to iterate a XML using cursor and then adding to MAP.
 The XML has repetable nodes for example

  Testcase
Securityhttps/Security
Serverstaging/Server
  /Testcase
  Testcase
   Securityhttps/Security
   Serverbaijing/Server
  /Testcase
 /Testcases

 I have an array of TestCase objects ready, how to iterate and add to a
 Map
 or Array

 I tried the following way and it did not get too further..I seem to be
 missing the usage of cursor and addin to a MAP, I seem to overwrite my
 MAP
 (which I should avoid),

 private static void addtoMap(Testcase item2, int i,
 LinkedHashMapString, String linkedHashMap) {

 XmlCursor cursor = item.newCursor();
 //Iterate throught the nodes

 cursor.toChild(0);
 String name = cursor.getName().toString();
 String value = cursor.getTextValue();

 //Add to Map
 linkedHashMap.put(name, value);

 //Next Sibling
cursor.toNextSibling();

 String name1 = cursor.getName().toString();
 String value1 = cursor.getTextValue();

 //Add to Map again
 linkedHashMap.put(name, value);


 System.out.println(Type of Token is:  +
 cursor.currentTokenType() +
   \nText of Token is + cursor.xmlText());
 //}
 cursor.dispose();

 }






 --
 View this message in context:
 http://www.nabble.com/Using-cursor-to-ierate-and-adding-to-map-tp14285663p14285663.html
 Sent from the Xml Beans - User mailing list archive at Nabble.com.


 -
 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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Using-cursor-to-ierate-and-adding-to-map-tp14285663p14305461.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


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



RE: Using cursor to ierate and adding to map

2007-12-12 Thread Zapo

Thanks a lot, yeah it solved the issue.



Cezar Andrei wrote:
 
 Zapo,
 
 cursor.getName() returns the name of the current token. You need to make
 sure you move the cursor on the right element to get the text and move
 back to the parent Testcase and call toNextSibling().
 
 -Original Message-
 From: Zapo [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, December 11, 2007 5:17 PM
 To: user@xmlbeans.apache.org
 Subject: Using cursor to ierate and adding to map
 
 
 Greetings,
 
 I am trying to iterate a XML using cursor and then adding to MAP.
 The XML has repetable nodes for example
 
  Testcase
Securityhttps/Security
Serverstaging/Server
  /Testcase
  Testcase
   Securityhttps/Security
   Serverbaijing/Server
  /Testcase
 /Testcases
 
 I have an array of TestCase objects ready, how to iterate and add to a
 Map
 or Array
 
 I tried the following way and it did not get too further..I seem to be
 missing the usage of cursor and addin to a MAP, I seem to overwrite my
 MAP
 (which I should avoid),
 
  private static void addtoMap(Testcase item2, int i,
  LinkedHashMapString, String linkedHashMap) {
 
  XmlCursor cursor = item.newCursor();
 //Iterate throught the nodes
 
  cursor.toChild(0);
  String name = cursor.getName().toString();
  String value = cursor.getTextValue();
 
  //Add to Map
  linkedHashMap.put(name, value);
 
  //Next Sibling
cursor.toNextSibling();
 
  String name1 = cursor.getName().toString();
  String value1 = cursor.getTextValue();
 
 //Add to Map again
  linkedHashMap.put(name, value);
 
 
  System.out.println(Type of Token is:  +
  cursor.currentTokenType() +
\nText of Token is + cursor.xmlText());
  //}
  cursor.dispose();
 
  }
 
 
 
 
 
 
 --
 View this message in context: http://www.nabble.com/Using-cursor-to-
 ierate-and-adding-to-map-tp14285663p14285663.html
 Sent from the Xml Beans - User mailing list archive at Nabble.com.
 
 
 -
 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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Using-cursor-to-ierate-and-adding-to-map-tp14285663p14305560.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


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



Incompatible minor version error

2007-12-12 Thread jgardner16

Hi,
I am getting a strange error when I am using the xmlbeans maven pluggin
and when I build it generates all the classes just fine and the runs unit
tests an everything works great.  However when I fire up tomcat and run in
tomcat I get the following error 

java.lang.ExceptionInInitializerError

XML-BEANS compiled schema: Incompatible minor version - expecting up to 23,
got 24
(schemaorg_apache_xmlbeans.system.sE8ABD9B84DDFBD246368593B1BE8D816.index) -
code 3

Any ideas what might be causing this.  I have xmlbeans 2.2.0.


thanks

-- 
View this message in context: 
http://www.nabble.com/Incompatible-minor-version-error-tp14308172p14308172.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


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