0

If I open an XML file in Chrome, I get a nice visual. I want to somehow copy this formatting to other programs like OneNote. It never copies the format/color though. Anything I can do to get it? Maybe even an extension if necessary?

What I see in Chrome and want to copy:

enter image description here

Or even this from SO would be nice:

<Node something="meh">
    Insides http://weblink.com
    <Indented>Super cool</Indented>
</Node>

But I always get a dumb string: <Node something="meh">Insides http://weblink.com<Indented>Super cool</Indented></Node>

CodeMonkey
  • 151
  • 8
  • Your asking for us to recommend a Chrome browser extension. I suspect half your problem is that OneNote doesn't have a copy formatted text option (or more specifically Chrome doesn't consider that content you are copying to be formatted). I wasn't personally able to recreate the bad behavior, i copied the XML content into a text file, dragged and dropped into Chrome and copied the XML content into a separate text file and it was formatted. – Ramhound Sep 01 '21 at 19:43
  • That was an option. Is that a problem? Another option is maybe there are settings somewhere. And yes, OneNote does accept (and copies) formatted text. Sounds like you're saying it the wrong way. – CodeMonkey Sep 01 '21 at 19:44
  • Questions seeking Chrome extensions are likely to be closed as out of scope. There are specific Stack Exchange communities dedicated to providing software recommendations. After I changed the file extension of the file to .XML, I was able to recreate the situation, determined that while Chrome is handling the XML content as XML content. What you are copying isn't actually formatted. *I was able to preserve the spacing and whitespace, by pasting in a .txt file, and dragging that into Chrome.* – Ramhound Sep 01 '21 at 19:50
  • Notice that the indention isn't being copied [here](https://i.stack.imgur.com/8dhmF.png), that is the reason its being copied as a single line into OneNote, although in my own tests were NOT a single line (event with "keep text only") – Ramhound Sep 01 '21 at 19:56
  • So other possibilities could be things like "view source and copy from there" (doesn't work, unfortunately) or use Developer tools and do something. I expect there's a way to do this without extensions, but I wouldn't mind an extension doing the job. – CodeMonkey Sep 01 '21 at 20:01
  • I would blame OneNote's seemingly lack of [RTF](https://superuser.com/questions/452462/how-to-paste-from-putty-to-onenote-with-colors) content handling – Ramhound Sep 01 '21 at 20:05
  • It doesn't paste into Word either and Word even usually let's you paste HTML just fine. Also, from word to OneNote works fine. I paste formatting all the time. It just seems like XML in particular is not copying any formatting for some reason. Not from IE either. I just want the darn formatting in OneNote somehow, darnit! – CodeMonkey Sep 01 '21 at 20:07

1 Answers1

1

I guess this will do if no one has any secrets or workarounds!

https://www.prettifier.net/xml/

CodeMonkey
  • 151
  • 8
  • I'm afraid that is the only answer. What Chrome displays is not the source data and what you copy/paste is the source. – Alexis Wilke Sep 01 '21 at 21:01