[jdom-interest] way to not print namespaces?

Beleznay, Dave Dave.Beleznay at webct.com
Wed Jun 26 12:02:49 PDT 2002


I decided to go with extending XMLOutputter,  but like you said, there's *way* too many private methods that have to be copied over just to do a simple modification.   I might be doing something weird as well, as now my XML is getting extra newlines.  I remember this from jdom b7, but i'm using the same source that I made the jar file from, and when i run Ident on the jar file, the CVS version matches the version on the source.  

$Id: XMLOutputter.java,v 1.76 2002/03/15 05:36:48 jhunter Exp $


before:
<ENTERPRISE>
<PROPERTIES xmlns="http://www.imsproject.org/xsd/imsep_rootv1p01">
    <DATASOURCE>WEBCT</DATASOURCE>
    <TYPE>Initial Creation</TYPE>
    <DATETIME>2002-06-25T14:55:19</DATETIME>
</PROPERTIES>
<PERSON xmlns="http://www.imsproject.org/xsd/imsep_rootv1p01" recstatus="1">
    <!-- Person Data Object -->
    <SOURCEDID>
        <SOURCE>WEBCT</SOURCE>
        <ID>faculty00010</ID>
    </SOURCEDID>
    <USERID>faculty00010</USERID>
    <NAME>
        <FN>faculty faculty00010</FN>

after:

<ENTERPRISE>
<PROPERTIES>

    <DATASOURCE>WEBCT</DATASOURCE>
    <TYPE>Initial Creation</TYPE>
    <DATETIME>2002-06-25T14:55:19</DATETIME>
</PROPERTIES>
<PERSON recstatus="1">
    <!-- Person Data Object -->
    <SOURCEDID>

        <SOURCE>WEBCT</SOURCE>
        <ID>faculty00010</ID>

I can live with it for now, but if anyone knows what I did wrong please let me know.  I'll include the source, in case anyone wants a base point for extending XMLOutputter. 

Cheers,

Dave


-------
David Beleznay
Software Engineer
WebCT 

> -----Original Message-----
> From: T.B. Pogie [mailto:pogietb at netscape.net]
> Sent: Wednesday, June 26, 2002 5:23 AM
> To: Beleznay, Dave; jdom-interest at jdom.org
> Subject: RE: [jdom-interest] way to not print namespaces?
> 
> 
> I've been struggling with that problem for some time now but 
> still have no solution. To not read in the namespace at all I 
> extended the Element and DefaultFactoryBuilder classes and 
> changed all Element constructors to only pass one arguement - 
> name. That works fine and the document's elements do not have 
> namespaces but as soon as I use XMLOutputter to write the 
> document the original namespaces somehow reappear (maybe from 
> NamespaceStack??). As you said there are too many private 
> methods to allow you to effectively extend XMLOutputter. If 
> anyone has suggestions I'll be *very* interested.
> TB Pogie
> 
> 
> 
> "Beleznay, Dave" <Dave.Beleznay at webct.com> wrote:
> 
> >Hi there,
> >
> >I'm looking at an xml document that's in one format, and wanting to
> >convert it to another format, and I don't want to use an XSLT because
> >its too slow.  
> >
> >My current problem is, the current format uses Schemas and 
> namespaces,
> >and the old document doesn't.  (I'm trying to go from the current
> >format, back to the old format, for backwards compatibility) 
> >
> >I'd like to just take an XMLOutputter, and tell it to print 
> the document
> >but don't print any namespace information for the elements, but that
> >doesn't seem to be an option.  I'd then like to override the call to
> >printNamespace in XMLOutputter, but it's a private call, so 
> I can't do
> >that.   
> >
> >Is there an easier way to either not read in the name space 
> information
> >/ wipe out the name space information in the document  / not 
> print the
> >namespace information in the final document?
> >
> >Thank you very much.
> >
> >Cheers,
> >
> >Dave
> >
> >-------
> >David Beleznay
> >Software Engineer
> >WebCT 
> >_______________________________________________
> >To control your jdom-interest membership:
> >http://lists.denveronline.net/mailman/options/jdom-interest/y
ouraddr at yourhost.com
>


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop at Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: NoNsXMLOutputter.java
Type: application/octet-stream
Size: 13685 bytes
Desc: NoNsXMLOutputter.java
Url : http://jdom.org/pipermail/jdom-interest/attachments/20020626/ffec073f/NoNsXMLOutputter.obj


More information about the jdom-interest mailing list