Axel Hecht | 19 Apr 15:26 2006

Re: Pretty print an XML string

Brian King wrote:
> Adam Judson wrote:
>> Do you need to do the formatting yourself?
> 
> Yes, or I wouldn't be asking ;)
> 

You could e4x it.

pretty = XML("..").toXMLString()

Axel
Brian King | 19 Apr 17:19 2006

Re: Pretty print an XML string

Axel Hecht wrote:

> You could e4x it.
> 
> pretty = XML("..").toXMLString()

This works perfect!

--

-- 
Brian King
www.mozdev.org - free project hosting for the Mozilla community
Alex Vincent | 19 Apr 19:30 2006
Picon

Re: Pretty print an XML string

You've gotten my attention.  DevMo is rather sparse on examples of the
XML object, and I'm not able to make what you describe work from the
URL bar with XML or XUL documents:

javascript:alert(XML(document).toXMLString())

On 4/19/06, Axel Hecht <axel <at> pike.org> wrote:
> Brian King wrote:
> > Adam Judson wrote:
> >> Do you need to do the formatting yourself?
> >
> > Yes, or I wouldn't be asking ;)
> >
>
> You could e4x it.
>
> pretty = XML("..").toXMLString()
>
> Axel
> _______________________________________________
> Project_owners mailing list
> Project_owners <at> mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>

--
"The first step in confirming there is a bug in someone else's work is
confirming there are no bugs in your own."
-- Alexander J. Vincent, June 30, 2001
(Continue reading)

Brian King | 19 Apr 22:16 2006

Re: Pretty print an XML string

Alex Vincent wrote:
> You've gotten my attention.  DevMo is rather sparse on examples of the
> XML object, and I'm not able to make what you describe work from the
> URL bar with XML or XUL documents:
> 
> javascript:alert(XML(document).toXMLString())

What type is the document parameter in this example? It has to be a string.

--

-- 
Brian King
www.mozdev.org - free project hosting for the Mozilla community
Jon Stritar | 19 Apr 23:15 2006
Picon

Re: Pretty print an XML string

Do you know how to access the XML function from an XPCOM context?
Firefox just reports the following error:

Error: xml is a reserved identifier

Jon

On Wed, 2006-04-19 at 22:16 +0200, Brian King wrote:
> Alex Vincent wrote:
> > You've gotten my attention.  DevMo is rather sparse on examples of the
> > XML object, and I'm not able to make what you describe work from the
> > URL bar with XML or XUL documents:
> > 
> > javascript:alert(XML(document).toXMLString())
> 
> What type is the document parameter in this example? It has to be a string.
> 
Brian King | 20 Apr 00:48 2006

Re: Pretty print an XML string

Jon Stritar wrote:
> Do you know how to access the XML function from an XPCOM context?
> Firefox just reports the following error:
> 
> Error: xml is a reserved identifier

It seems to only accept well formed nodes, without the XML declaration. 
When I passed a string with the declaration, I got a similar error.

Perhaps you can post your code?

--

-- 
Brian King
www.mozdev.org - free project hosting for the Mozilla community
Jon Stritar | 20 Apr 01:12 2006
Picon

Re: Pretty print an XML string

Oh, that sounds like the problem. I was passing the output of
nsIDOMSerializer (implemented by xmlserializer) directly to it.

XML(serializer.serializeToString(this._doc)).toXMLString();

Jon

On Thu, 2006-04-20 at 00:48 +0200, Brian King wrote:
> Jon Stritar wrote:
> > Do you know how to access the XML function from an XPCOM context?
> > Firefox just reports the following error:
> > 
> > Error: xml is a reserved identifier
> 
> It seems to only accept well formed nodes, without the XML declaration. 
> When I passed a string with the declaration, I got a similar error.
> 
> Perhaps you can post your code?
> 
Thomas Reitmayr | 20 Apr 00:59 2006
Picon

AW: Pretty print an XML string

Hi,
XML in this case is a data type, just try this
  alert(XML("<test><ex>abc</ex></test>").toXMLString());
or just
  alert(<test><ex>abc</ex></test>.toXMLString());
 which should give you the pretty-printed xml.
-Thomas

PS: http://www.ecma-international.org/publications/standards/Ecma-357.htm shows where it's heading

----- Urspr√ľngliche Mail ----
Von: Jon Stritar <jstritar <at> MIT.EDU>
An: Mozdev Project Owners List <project_owners <at> mozdev.org>
Gesendet: Mittwoch, den 19. April 2006, 23:15:00 Uhr
Betreff: Re: [Project_owners] Pretty print an XML string

Do you know how to access the XML function from an XPCOM context?
Firefox just reports the following error:

Error: xml is a reserved identifier

Jon

On Wed, 2006-04-19 at 22:16 +0200, Brian King wrote:
> Alex Vincent wrote:
> > You've gotten my attention.  DevMo is rather sparse on examples of the
> > XML object, and I'm not able to make what you describe work from the
> > URL bar with XML or XUL documents:
> > 
> > javascript:alert(XML(document).toXMLString())
(Continue reading)


Gmane