You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by pink luare <la...@yahoo.com> on 2006/01/23 15:43:24 UTC

Betwixt - namespace

  Hi,
   
  I'm just getting into Betwixt, it's exactly what I need, except for namespace support... 
   
  How do I write a namespace on all (all) my xml tags ?
  I can't have a "default namespace", b/c my XML passes on to a Perl program that can't handle it (it's not even a parser, it just looks for the string pattern "namespace:tag" ).
   
  So my output XML should be:
  ns1:root  xml:ns1=http://mydomain
      ns1:nested  ...   
      ns1:nested ...
      ns1:nested ...
        ns1:nested ...
   

  And not :
  ns1:root  xml:ns1=http://mydomain  xmlns=http://mydomain
        nested  ...  // default namespace - crashes our Perl reader
      nested ...
      nested ...

        nested ...
   

  I'll appreciate it if anyone can point me to how to do this.


		
---------------------------------
 
 What are the most popular cars?  Find out at Yahoo! Autos

Re: Betwixt - namespace

Posted by sol myr <so...@yahoo.com>.
I have been struggling with the same problem myself.
  So far I am able to make it work by creating a ".betwixt" file and specifying a "uri" for the elements.
  Example (from a question I posted about the same subject a while ago):
   
  < ! -- Betwixt file for class 'Book' -- >
    < info primitiveTypes="element" >
    < element name='Book' uri='myuri/read" >
          < element name='title' property='title'  uri='myuri/read' / >
          < element name='author' property='author'  uri='myrui/read' / >
      < / element >
< / info >

  Unfortunatelly I have to copy the 'uri' attribute for each and every element (you can't use 'addDefaults' because this would leave your 'nested' tags *without* a namespace prefix .
   
  But I'm not expert - maybe there *is* a better way to do it !
  If you happen to find a better way, could you please share (if it's not too much trouble). 
   
  aurie.common@yahoo.com> wrote:

  Hi,

I'm just getting into Betwixt, it's exactly what I need, except for namespace support... 

How do I write a namespace on all (all) my xml tags ?
I can't have a "default namespace", b/c my XML passes on to a Perl program that can't handle it (it's not even a parser, it just looks for the string pattern "namespace:tag" ).

So my output XML should be:
ns1:root xml:ns1=http://mydomain
ns1:nested ... 
ns1:nested ...
ns1:nested ...
ns1:nested ...


And not :
ns1:root xml:ns1=http://mydomain xmlns=http://mydomain
nested ... // default namespace - crashes our Perl reader
nested ...
nested ...

nested ...


I'll appreciate it if anyone can point me to how to do this.



---------------------------------

What are the most popular cars? Find out at Yahoo! Autos  


		
---------------------------------
 
 What are the most popular cars?  Find out at Yahoo! Autos