xml preserve whitespace in node text

View: New views
6 Messages — Rating Filter:   Alert me  

xml preserve whitespace in node text

by dinges :: Rate this Message:

| View Threaded | Show Only this Message

Hi,

I'm using tidy to tidy up my xml. For that I have a config file that works well in all respects but one: the node text is normalized. However, I want to keep the whitespace (lots of spaces). Is there a config setting to achieve that? I don't have problems with the attributes, only with text nodes.

Re: xml preserve whitespace in node text

by Arnaud Desitter-2 :: Rate this Message:

| View Threaded | Show Only this Message


Hi,

Try to add the attribute "xml:space" set to "preserve" on the related elements.
Tidy option "add-xml-space" may help.

Regards,

2008/12/30 dinges <b.ambrosius@...>:

>
> Hi,
>
> I'm using tidy to tidy up my xml. For that I have a config file that works
> well in all respects but one: the node text is normalized. However, I want
> to keep the whitespace (lots of spaces). Is there a config setting to
> achieve that? I don't have problems with the attributes, only with text
> nodes.
>
> --
> View this message in context: http://www.nabble.com/xml-preserve-whitespace-in-node-text-tp21221443p21221443.html
> Sent from the w3.org - html-tidy mailing list archive at Nabble.com.
>
>
>
>



Re: xml preserve whitespace in node text

by Eric Frost :: Rate this Message:

| View Threaded | Show Only this Message


Dinges,

Does add-xml-space do what you want?

http://tidy.sourceforge.net/docs/quickref.html#add-xml-space

Eric

__
http://www.reviewthemovies.com |
http://www.sc2hacks.com |


--------------------------------------------------
From: "dinges" <b.ambrosius@...>
Sent: Tuesday, December 30, 2008 12:48 PM
To: <html-tidy@...>
Subject: xml preserve whitespace in node text

>
> Hi,
>
> I'm using tidy to tidy up my xml. For that I have a config file that works
> well in all respects but one: the node text is normalized. However, I want
> to keep the whitespace (lots of spaces). Is there a config setting to
> achieve that? I don't have problems with the attributes, only with text
> nodes.
>
 



Re: xml preserve whitespace in node text

by dinges :: Rate this Message:

| View Threaded | Show Only this Message

Thanks, Arnoud and Eric for your trouble.
First of all Happy New Year.

I do not want tidy to add attributes, and the option add-xml-space would do that. Furthermore, according to the documentation the option only works with elements such as <PRE>, <STYLE> and <SCRIPT>, so I did'nt bother to try it. Now I did, just to experiment, and sure enough, no attribute was added by tidy, because I don't have those elements.

I'm not allowed to add attributes because I'm generating an XBRL instance, and there are rules to be followed.

The input for tidy is this:
<bd-bedr:DescriptionDeviatingBusinessAssetsStartFinancialYear contextRef="cd0">Gecorrigeerd vermogen                                                  Correctie op de omzet                                                  Toevoeging van reserves                                               </bd-bedr:DescriptionDeviatingBusinessAssetsStartFinancialYear>

And the output I get from is this:
<bd-bedr:DescriptionDeviatingBusinessAssetsStartFinancialYear contextRef="cd0">Gecorrigeerd vermogen Correctie op de omzet Toevoeging van reserves</bd-bedr:DescriptionDeviatingBusinessAssetsStartFinancialYear>

When I use XmlSpy with the input, the instance is pretty-printed while whitespace is preserved, so it should be possible to get the result I want.

If tidy cannot do this, could you suggest other programs that work on the command line? I'm calling tidy from another program.

Regards,
 

Arnaud Desitter-2 wrote:
Hi,
Try to add the attribute "xml:space" set to "preserve" on the related elements.
Tidy option "add-xml-space" may help.

Regards,

Re: xml preserve whitespace in node text

by Arnaud Desitter-2 :: Rate this Message:

| View Threaded | Show Only this Message


Hi,

Although I have not tried, you could add the the needed
attributexml:space="preserve" where needed, process the data with tidy
and remove the added attribute.

Regards,

2009/1/1 dinges <b.ambrosius@...>:

>
>
> Thanks, Arnoud and Eric for your trouble.
> First of all Happy New Year.
>
> I do not want tidy to add attributes, and the option add-xml-space would do
> that. Furthermore, according to the documentation the option only works with
> elements such as <PRE>, <STYLE> and <SCRIPT>, so I did'nt bother to try it.
> Now I did, just to experiment, and sure enough, no attribute was added by
> tidy, because I don't have those elements.
>
> I'm not allowed to add attributes because I'm generating an XBRL instance,
> and there are rules to be followed.
>
> The input for tidy is this:
> <bd-bedr:DescriptionDeviatingBusinessAssetsStartFinancialYear
> contextRef="cd0">Gecorrigeerd vermogen
> Correctie op de omzet
> Toevoeging van reserves
> </bd-bedr:DescriptionDeviatingBusinessAssetsStartFinancialYear>
>
> And the output I get from is this:
> <bd-bedr:DescriptionDeviatingBusinessAssetsStartFinancialYear
> contextRef="cd0">Gecorrigeerd vermogen Correctie op de omzet Toevoeging van
> reserves</bd-bedr:DescriptionDeviatingBusinessAssetsStartFinancialYear>
>
> When I use XmlSpy with the input, the instance is pretty-printed while
> whitespace is preserved, so it should be possible to get the result I want.
>
> If tidy cannot do this, could you suggest other programs that work on the
> command line? I'm calling tidy from another program.
>
> Regards,
>
>
>
> Arnaud Desitter-2 wrote:
>>
>> Hi,
>> Try to add the attribute "xml:space" set to "preserve" on the related
>> elements.
>> Tidy option "add-xml-space" may help.
>>
>> Regards,
>>
>
> --
> View this message in context: http://www.nabble.com/xml-preserve-whitespace-in-node-text-tp21221443p21239869.html
> Sent from the w3.org - html-tidy mailing list archive at Nabble.com.
>
>
>



Re: xml preserve whitespace in node text

by dinges :: Rate this Message:

| View Threaded | Show Only this Message

Thanks again for your answer quoted below, Arnoud.

Your solution could work, but it's too elaborate for me.
I take it then that there is no config setting to preserve whitespace in element nodes. Seeing that there is at least one application that is able to preserve whitespace (XMLSpy) I think I will issue a feature request. Is Tidy still maintaned?

Regards,

Arnaud Desitter-2 wrote:
Hi,
Try to add the attribute "xml:space" set to "preserve" on the related elements.
Tidy option "add-xml-space" may help.

Regards,