You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by java dawg <ja...@yahoo.com> on 2004/09/14 04:21:58 UTC

New User Question: Removing Marshaller Namespace Information

Thank you for this well thoughout implementation.  I
am finding it very useful.

Being new to jaxME, I wanted to ask:
What would be the best way to remove namespace
information from the Marshaller target results?

For example:
java.io.StringWriter sw = new StringWriter();
...
marshaller.marshal(students, sw);

Produces:
<stu:students
xmlns:stu="http://dw.ibm.com/jaxme/student">
  <stu:student>
    <stu:firstName>Brett</stu:firstName>
    ...

I have a consumer of jaxME's generated xml that does
not support namespaces.  I am hoping there is way to
produce:
<students>
  <student>
    <firstName>Brett</firstName>
    ...

Any advise will be greatfully appreciated.

Thank you,
Duane Adkins


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

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


Re: New User Question: Removing Marshaller Namespace Information

Posted by Jochen Wiedmann <jo...@freenet.de>.
java dawg wrote:

> Being new to jaxME, I wanted to ask:
> What would be the best way to remove namespace
> information from the Marshaller target results?

Write a SAX handler, which removes namespace information and pipes its 
output into another SAX handler, for example the XMLWriter. The SAX 
handler could look basically like this:

     public void characters(char[] buffer, int offset, int len)
		throws SAXException {
	// Chacters are simply forwarded
	otherHandler.characters(buffer, offset, len);
     }

     public void startElement(String pNamespaceURI, String pLocalName,
                              String pQName, Attributes pAttrs)
	        throws SAXException {
	pNamespaceURI = "";
	pQName = pLocalName;
	// Likewise, replace Attributes with AttributesImpl,
         // removing namespaces
         ...
         startElement(pNamespaceURI, pLocalName, pQName, pAttrs);
     }



-- 
http://lilypie.com/baby1/050423/1/5/1/+1

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