Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to split a string across multiple lines in an XML file? If so, how?

Tags:

I've got an XML config file with some really long strings. Generally, I format my source files, etc. so that they can be read without scrolling. I'd like to do the same to this config file.

Is there a way to split the string across more than one line? Hopefully, what I'm asking for is obvious but a picture says a thousand words so, e.g. value, below.

<add name="validation"      type="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF.ValidationElement, Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 

If I break the above string to look like this:

<add name="validation"      type="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF.ValidationElement,      Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 

my apps fails with:

"An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'validation' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions. Parameter name: element "

It seems that it's sensitive to line-breaks in the string.

like image 585
serialhobbyist Avatar asked Jul 26 '09 09:07

serialhobbyist


People also ask

How do I split a string over multiple lines?

You can have a string split across multiple lines by enclosing it in triple quotes. Alternatively, brackets can also be used to spread a string into different lines. Moreover, backslash works as a line continuation character in Python. You can use it to join text on separate lines and create a multiline string.

What is XML string?

String. xml file contains all the strings which will be used frequently in Android project. String. xml file present in the values folder which is sub folder of res folder in project structure.In Android Studio, we have many Views such as TextView,Button,EditText,CheckBox,RadioButton etc.


1 Answers

All line breaks are normalized to spaces, so just put them on a separate line if the space delimiter can handle arbitrary whitespace.

like image 92
thedz Avatar answered Sep 19 '22 09:09

thedz