[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    How to add namespace information to the first 2 elements of the xml file?
From:       hero Smith <heroneedshelp () yahoo ! com>
Date:       2004-11-22 23:19:29
Message-ID: 20041122231929.61991.qmail () web54209 ! mail ! yahoo ! com
[Download RAW message or body]

Hi All,

Trying this:
XmlObject.factory.marshal(xml,options);

I have a requirement where I get the xml response
without a namespace and I need to add it myself before
unmarshalling it. However, I need to add namespace to
the first 2 elements of my xml file in order to
unmarshal it correctly. I was trying to find out if
there is a way through xmlOptions?. I have tried few
things and ran into following problems.


1. If I use setLoadSubstituteNamespaces in xmlOptions,
namespace information gets added to all the elements
of my xml. 

2. If I do setLoadReplaceDocumentElement,namespace
gets added only to the first element - company. 

For some reason, my xml gets unmarshalled properly
only if I am able to set namespace information to the
first two elements. If you see the xml sample below, I
need to set namespace information to the first two
elements company and department.

Right now, the round about I am using happens in 2
steps. I have to unmarshal twice. After first
unmarshal, I use a cursor to that object and set
namespace to the first two fields, and then unmarshal
the toString() of this object again.

Is there any way I can do it in single step?

<company>
     <department>
         <name/>
         <address/>
         <purpose/>
     </department>
</company>



		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic