You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Albert Lu <al...@nmdp.org> on 2004/09/15 21:36:04 UTC

control printing namespace when marshalling

Need help!
how do you control (print/not print namespace) when marshalling a 
xmlbeans object?


Here is my schema with namespace specification
<xs:schema
  xmlns:xs='http://www.w3.org/2001/XMLSchema'
  targetNamespace='http://www.abc.org/t
  xmlns='http://www.abc.org/t'>
...

Here is my data (data.xml)
<?xml version="1.0" encoding="UTF-8"?>
<report version="0.1" xmlns="http://www.abc.org/t">
  <request requestId="12345678" requestDate="20031209"/>
  <provider providerId="xxx"/>
</report>

When I marshall the xmlbeans object, I don't get the same format but
<?xml version="1.0" encoding="UTF-8"?>
<xml-fragment 
version="0.1">                                                                         
<--- <report> element was replaced with <xml-fragment>
  <t:request requestId="12345678" requestDate="20031209" 
xmlns:t="http://www.abc.org/t"/> <----- all elements are prefixed with t:
  <t:provider providerId="xxx" 
xmlns:t="http://www.abc.org/t"/>                                                 
and xmlns:t are used everywhere


Why <report> element changed to <xml-fragment> ?

When marshalling, I just did this in the code. What else can I do here 
to control the namespace printing?
reportDocument.save(new File("out.xml"));


I used namespace because I wanted to store my class in a package which 
required me to specify a namespace!

Thanks,

<>Albert


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


control printing namespace when marshalling (RECALLED)

Posted by Albert Lu <al...@nmdp.org>.
I'm sorry! my fault. It 's never been any problem!

Albert




Albert Lu wrote:

> Need help!
> how do you control (print/not print namespace) when marshalling a 
> xmlbeans object?
>
>
> Here is my schema with namespace specification
> <xs:schema
>  xmlns:xs='http://www.w3.org/2001/XMLSchema'
>  targetNamespace='http://www.abc.org/t
>  xmlns='http://www.abc.org/t'>
> ...
>
> Here is my data (data.xml)
> <?xml version="1.0" encoding="UTF-8"?>
> <report version="0.1" xmlns="http://www.abc.org/t">
>  <request requestId="12345678" requestDate="20031209"/>
>  <provider providerId="xxx"/>
> </report>
>
> When I marshall the xmlbeans object, I don't get the same format but
> <?xml version="1.0" encoding="UTF-8"?>
> <xml-fragment 
> version="0.1">                                                                         
> <--- <report> element was replaced with <xml-fragment>
>  <t:request requestId="12345678" requestDate="20031209" 
> xmlns:t="http://www.abc.org/t"/> <----- all elements are prefixed with t:
>  <t:provider providerId="xxx" 
> xmlns:t="http://www.abc.org/t"/>                                                 
> and xmlns:t are used everywhere
>
>
> Why <report> element changed to <xml-fragment> ?
>
> When marshalling, I just did this in the code. What else can I do here 
> to control the namespace printing?
> reportDocument.save(new File("out.xml"));
>
>
> I used namespace because I wanted to store my class in a package which 
> required me to specify a namespace!
>
> Thanks,
>
> <>Albert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

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