Sorry, mailed the wrong list. Feel free to ignore this. I'll send it again to 
the users list.
 
Nick

________________________________

From: Scott, Nick [mailto:nick.sc...@logica.com] 
Sent: 08 September 2009 17:15
To: jibx-devs@lists.sourceforge.net
Subject: [jibx-devs] Best practice for handling multiple, 
alternating,namespaces?


Hi, I'm looking for guidance on the best approach to handling multiple, 
alternating, namespaces. The tutorial hints at a solution:
 
http://jibx.sourceforge.net/binding/tutorial/binding-advanced.html
"...This makes the namespace automatically apply to every name definition 
unless you override it with a specific namespace using the ns attribute...."
 
but provides no example. Try as I might, I keep getting validation errors 
whatever permutation of attributes I go for! 
 
The problem XML is long and tedious with five different namespaces all 
interspersed! To illustrate the problem, consider the following fragment:
 
...
<metadata>
 <ns1:Product xsi:schemaLocation="http://earth.esa.int/geca 
./xsd/geca/geca.xsd" xmlns:ns1="http://ns1"; xmlns:ns2="http://ns2";>
  <ns2:metaDataProperty>
   <ns1:ProductMetaData>
    <ns1:fileIdentifier>urn:x-geca:avdc:500</geca:fileIdentifier>
    ...
 
If the <ns2:metaDataProperty> is simply removed, then the following works:
 
...
<mapping name="Product" class="com.myCode.xxxProductFile">
    <namespace name="ns1" uri="http://ns1 <http://ns1> " default="elements"/>
          <structure name="ProductMetaData">
               <value name="fileIdentifier" field="fileId"/>
                  ...
 
Logically, I would expect a something like: 
 
...
<mapping name="Product" class="com.myCode.xxxProductFile">
    <namespace name="ns1" uri="http://ns1 <http://ns1> " default="elements"/>
    <namespace name="ns2" uri="http://ns2 <http://ns2> " default="none"/>
    <structure ns="ns2" name="metaDataProperty">
          <structure name="ProductMetaData">
               <value name="fileIdentifier" field="fileId"/>
                  ...
 
or
 
...
<mapping name="Product" class="com.myCode.xxxProductFile">
    <namespace name="ns1" uri="http://ns1 <http://ns1> " default="none"/>
    <namespace name="ns2" uri="http://ns2 <http://ns2> " default="none"/>
    <structure ns="ns2" name="metaDataProperty">
          <structure ns="ns1" name="ProductMetaData">
               <value ns="ns1" name="fileIdentifier" field="fileId"/>
                  ...
 
to do the trick - but they both lead to compilation errors ("Namespace prefix 
conflict for namespace element").
 
Is there a "right" approach to alternating namespaces in this manner? All help 
would be much appreciated!
 
Nick

Please help Logica to respect the environment by not printing this email / Pour 
contribuer comme Logica au respect de l'environnement, merci de ne pas imprimer 
ce mail / Bitte drucken Sie diese Nachricht nicht aus und helfen Sie so Logica 
dabei, die Umwelt zu schützen. / Por favor ajude a Logica a respeitar o 
ambiente não imprimindo este correio electrónico. This e-mail and any 
attachment is for authorised use by the intended recipient(s) only. It may 
contain proprietary material, confidential information and/or be subject to 
legal privilege. It should not be copied, disclosed to, retained or used by, 
any other party. If you are not an intended recipient then please promptly 
delete this e-mail and any attachment and all copies and inform the sender. 
Thank you. 


Please help Logica to respect the environment by not printing this email  / 
Pour contribuer comme Logica au respect de l'environnement, merci de ne pas 
imprimer ce mail /  Bitte drucken Sie diese Nachricht nicht aus und helfen Sie 
so Logica dabei, die Umwelt zu schützen. /  Por favor ajude a Logica a 
respeitar o ambiente nao imprimindo este correio electronico.



This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to