|
|
|
date: Mon, 31 Mar 2008 21:34:10 +0100,
group: microsoft.public.xml
back
Re: Formatting: A line break before each attribute?
On Apr 1, 1:34 am, "Adam Byrne" <misterbyrne-iamafr...@ofspam-
yahoo.ie> wrote:
> Hello,
>
> I have to deal with Xml files which mainly consist of nodes which contain a
> large number of attributes. I can manage to format these Xml files to
> nicely indent each node, but all the attributes remain on the same
> (extremely long) line as the node.
>
> Does anyone know of a way I can automatically format an Xml document so that
> each attribute appears on its own line? I don't really mind how it can be
> achieved once it's not by hand (e.g. any programming language, any library> an XSLT, a freeware, shareware, or expensive application - Visual Studio
> .NET 2008?) - any ideas??
>
> Thanks in advance.
>
> -adam
Hi,
Try with cooktop. it's freeware.
http://xmlcooktop.com/
Regards,
Balaji. M
date: Mon, 31 Mar 2008 23:17:03 -0700 (PDT)
author: Balaji
Re: Formatting: A line break before each attribute?
I was scared away by a warning on Cooktop's website that it will save
changes without asking! Anyway, I found a freeware application called
"firstobject XML Editor" that does the trick. As an added bonus, it's only
900K and doesn't require installation.
Thanks for your help.
"Balaji" wrote in message
news:22f11515-6476-4d8e-8e55-8a056d4e0426@d21g2000prf.googlegroups.com...
On Apr 1, 1:34 am, "Adam Byrne" <misterbyrne-iamafr...@ofspam-
yahoo.ie> wrote:
> Hello,
>
> I have to deal with Xml files which mainly consist of nodes which contain
> a
> large number of attributes. I can manage to format these Xml files to
> nicely indent each node, but all the attributes remain on the same
> (extremely long) line as the node.
>
> Does anyone know of a way I can automatically format an Xml document so
> that
> each attribute appears on its own line? I don't really mind how it can be
> achieved once it's not by hand (e.g. any programming language, any
> library,
> an XSLT, a freeware, shareware, or expensive application - Visual Studio
> .NET 2008?) - any ideas??
>
> Thanks in advance.
>
> -adam
Hi,
Try with cooktop. it's freeware.
http://xmlcooktop.com/
Regards,
Balaji. M
date: Tue, 1 Apr 2008 10:18:45 +0100
author: Adam Byrne
Re: Formatting: A line break before each attribute?
Adam Byrne wrote:
> I was scared away by a warning on Cooktop's website that it will save
> changes without asking! Anyway, I found a freeware application called
> "firstobject XML Editor" that does the trick. As an added bonus, it's only
> 900K and doesn't require installation.
If you want to do it programmatically then you can do it with the .NET
framework 2.0 or later by creating an XmlWriter with XmlWriterSettings
to Indent and to have NewLineOnAttributes, then passing in an XmlReader
to the WriteNode method:
public static void PrettyPrint(string input, string output,
XmlWriterSettings settings)
{
using (XmlReader reader = XmlReader.Create(input))
{
using (XmlWriter writer = XmlWriter.Create(output, settings))
{
writer.WriteNode(reader, true);
}
}
}
Call like this
XmlWriterSettings writerSettings = new XmlWriterSettings();
writerSettings.NewLineOnAttributes = true;
writerSettings.Indent = true;
PrettyPrint("input.xml", "output.xml", writerSettings);
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
date: Tue, 01 Apr 2008 12:37:57 +0200
author: Martin Honnen
Re: Formatting: A line break before each attribute?
If you want to do it programmatically without .Net then see the answers to
my question "Inserting newlines into XML document" asked on 3/20/2008 (or
maybe 3/19/2008 depending on timezone, but probably not).
"Adam Byrne" wrote in message
news:uWfUol9kIHA.484@TK2MSFTNGP04.phx.gbl...
>I was scared away by a warning on Cooktop's website that it will save
>changes without asking! Anyway, I found a freeware application called
>"firstobject XML Editor" that does the trick. As an added bonus, it's only
>900K and doesn't require installation.
>
> Thanks for your help.
>
> "Balaji" wrote in message
> news:22f11515-6476-4d8e-8e55-8a056d4e0426@d21g2000prf.googlegroups.com...
> On Apr 1, 1:34 am, "Adam Byrne" <misterbyrne-iamafr...@ofspam-
> yahoo.ie> wrote:
>> Hello,
>>
>> I have to deal with Xml files which mainly consist of nodes which contain
>> a
>> large number of attributes. I can manage to format these Xml files to
>> nicely indent each node, but all the attributes remain on the same
>> (extremely long) line as the node.
>>
>> Does anyone know of a way I can automatically format an Xml document so
>> that
>> each attribute appears on its own line? I don't really mind how it can be
>> achieved once it's not by hand (e.g. any programming language, any
>> library,
>> an XSLT, a freeware, shareware, or expensive application - Visual Studio
>> .NET 2008?) - any ideas??
>>
>> Thanks in advance.
>>
>> -adam
>
> Hi,
>
> Try with cooktop. it's freeware.
>
> http://xmlcooktop.com/
>
> Regards,
> Balaji. M
>
>
date: Tue, 1 Apr 2008 12:56:02 -0700
author: Sam Hobbs _change_social_to_socal
|
|