xml-formatting

How to preserve whitespace within an element's opening tag in XSLT

只谈情不闲聊 提交于 2019-12-02 02:25:55
问题 In order to avoid committing sensitive information to an SCM repository, I wrote an XSL stylesheet that removes connection string passwords from ASP.NET Web.config files. It achieves my goal of removing passwords, but it also affects the whitespace within the opening tags of elements. I would like to preserve this whitespace if possible. For example, given this Web.config : <configuration> <connectionStrings> <add name="ApplicationServices" connectionString="Host=localhost;Username=dev

Writing formatted XML with XmlWriter

ぃ、小莉子 提交于 2019-12-01 15:03:09
I'm trying to write to an XML file to the isolated storage but I would like to format it like this:- <SampleData> <Item Property1="AliquaXX" /> <Item Property1="Integer" /> <Item Property1="Quisque" /> <Item Property1="Aenean" /> <Item Property1="Mauris" /> <Item Property1="Vivamus" /> <Item Property1="Nullam" /> <Item Property1="Nam" /> <Item Property1="Sed" /> <Item Property1="Class" /> </SampleData> but I'm buggered if I can work it out, can anyone help? Thanks, struggling newbie. You can customize the xml output via the XmlWriterSettings . You didn't include any code, but you can set the

Need help in formatting JAXB output

醉酒当歌 提交于 2019-12-01 06:37:42
问题 I have some objects let's say two, A and B. These objects from the same class. I need to marshal these objects using JAXB and the output XML should be in this form: <Root> <A> <ID> an id </ID> </A> <B> <ID> an id </ID> </B> </Root> <!-- Then all A and B attributes must be listed !--> <A> <ID> an id </ID> <attribute1> value </attribute1> <attribute2> value </attribute2> </A> <B> <ID> an id </ID> <attribute1> value </attribute1> <attribute2> value </attribute2> </B> How to generate this format

Is there a stylesheet or Windows commandline tool for controllable XML formatting, specifically putting attributes one-per-line?

坚强是说给别人听的谎言 提交于 2019-11-30 08:05:24
问题 I am searching for an XSLT or command-line tool (or C# code that can be made into a command-line tool, etc) for Windows that will do XML pretty-printing. Specifically, I want one that has the ability to put attributes one-to-a-line, something like: <Node> <ChildNode value1='5' value2='6' value3='happy' /> </Node> It doesn't have to be EXACTLY like that, but I want to use it for an XML file that has nodes with dozens of attributes and spreading them across multiple lines makes them easier to