Need help with XML

May 20, 2008
11,400
99
Syracuse, NY, USA
When DevStudio kept info in the registry I used a BTM (assigned to a PowerPro button) to open my most recent programming project. VS2019 uses an XLM file (21KB with no newlines!) to store such info. I know nothing about XML or TCC's functions to deal with it. Here's a snippet from that file (with some newlines thrown in). It's a bit more complicated than the example in TCC's help.

Code:
<collection name="CodeContainers.Offline">
<value name="value">
[
{"Key":"P:\\Hello\\Hello.sln","Value":{"LocalProperties":{"FullPath":"P:\\Hello\\Hello.sln","Type":0,"SourceControl":null},"Remote":null,"IsFavorite":false,"LastAccessed":"2020-04-02T22:12:51.7492686+00:00","IsLocal":true,"HasRemote":false,"IsSourceControlled":false}},
{"Key":"P:\\4SysUtils\\SysUtilsDll.sln","Value":{"LocalProperties":{"FullPath":"P:\\4SysUtils\\SysUtilsDll.sln","Type":0,"SourceControl":null},"Remote":null,"IsFavorite":false,"LastAccessed":"2020-03-30T20:07:43.1135728+00:00","IsLocal":true,"HasRemote":false,"IsSourceControlled":false}}
]
</value>

What I'm after is the value of the very first "FullPath" (which, above, is "P:\\Hello\\Hello.sln"). I can give that string to START. Can I use TCC's XML functions to dig that out of the file? I could use some help. I hope there's enough information above.

For anyone with DevStudio 2019, the file in question is (here)

Code:
%USERPROFILE\AppData\Local\Microsoft\VisualStudio\16.0_6b6f020f\ApplicationPrivateSettings.xml

Thanks.
 

ben

Jan 3, 2012
44
6
UK
That format is weird. It consists of a thin XML shell:
Code:
<collection name="CodeContainers.Offline">
  <value name="value">
  ...
  </value>
</collection>

with JSON inside:
Code:
  [
    { "Key"   : "P:\\Hello\\Hello.sln"
    , "Value" : { ...
                }
    }
  , ...
  ]

XML routines will be not be able to parse the JSON.
 
May 20, 2008
11,400
99
Syracuse, NY, USA
The wrapper is a little thicker; I didn't post the outer layers. I got something from TCC's XML functions but I can't go further. Below, the last command crashes TCC.

Code:
d:\tc26> echo h=%@xmlopen[c:\users\vefatica\appdata\local\microsoft\visualstudio\16.0_6b6f020f\ApplicationPrivateSettings.xml]
h=0

d:\tc26> echo %@xmlxpath[/content/indexed/collection]
*System.String*Visual Studio 6False

d:\tc26> echo %@xmlxpath[/content/indexed/collection[0]]
TCMD: (XML)  Line: 0; Char: 0   (null)
d:\tc26> echo %@xmlxpath[/content/indexed/collection]
*System.String*Visual Studio 6False

d:\tc26> echo %@xmlnodes[/content/indexed/collection]
2

d:\tc26> echo %@xmlxpath[/content/indexed/collection[1]]
*System.String*Visual Studio 6False

d:\tc26> echo %@xmlxpath[/content/indexed/collection[0]]
TCMD: (XML)  Line: 0; Char: 0   (null)
d:\tc26> echo %@xmlxpath[/content/indexed/collection[2]]

I can accomplish my goal by various other means.

A BTM (@FILEREAD) gives me the desired string in 2.9 seconds.
TPIPE (throw in some newlines, grep, head, replace) gets it in .5 second.
My own EXE gets it in .02 second.

The file is attached in case anyone wants to mess with it.
 

Attachments

  • vsxml.zip
    3 KB · Views: 103

ben

Jan 3, 2012
44
6
UK
I spent a little bit of time on this, but got nowhere. I suspect that these XML routines don't work as well as they might.

I would do this sort of thing with a different scripting language, such as Python or Perl or whatever you prefer, which have libraries that make it easy.
 
Similar threads
Thread starter Title Forum Replies Date
MikeBaas How to? I need help with RD Support 5
J Need activation help. Support 1
C Cmpr_Del.btm need help understanding UDF..... Support 2
Frank How to? need help with "function" Support 10
R How to? i need a little help Support 3
S Need help to execute TCC commands on another system Support 6
H I need a little help. Support 4
M Need help Support 0
D Need to set Take Command font size when switching to high DPI display Support 0
vefatica gcd() and lcm() ... need '%' Support 10
C Touch command — I Need to touch matching files in another directory. Support 5
D I need a debug-plan Support 4
vefatica New desktop, need Explorer PID Support 1
B Need To Deactivate V12.1 Before Reinstall To Different Directory? Support 3
S Re: Release of new version - do we need to download again? Support 8
O Need 'grep' equivalent Support 13
vefatica What environment variables does IDE need? Support 3
T Expired trial...need to evaluate new build Support 1
C how to copy to folder where I need admin rights Support 5
deleyd Need example of @COMPARE Support 1
P Need to use a regex in a "for" loop. Support 54
H New to TCC and I need assistance Support 8
C Add link to ewriter help to program group... Support 3
samintz How to? Search for %(command) in Help? Support 1
Joe Caverly Favorites in eWriter Help Support 6
Joe Caverly Quick Search in eWriter Help Support 1
vefatica Online help? Support 2
fishman@panix.com HELP!! I just updated to Version 28 and as usual I cannot make extended directory search work. Support 2
JohnQSmith New online help file wrong logo Support 7
Jay Sage Documentation Function @DRIVE Missing in Help Lists Support 0
Charles Dye More help nits Support 0
D Documentation Typo in COPY help Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
Joe Caverly Documentation COMMANDS in Version 27 help Support 8
K_Meinhard How to? Help window position Support 7
U Command help on file names Support 5
D Documentation Help "Startup" page does not describe global lists Support 0
vefatica Help disappears? Support 6
rchapmanitt Help Purchasing Support 2
Charles Dye Documentation Help nits: @ZIPFILECRC Support 0
C version help Support 3
C Documentation Help Nit. REN / RENAME Support 0
Dmitry L. Kobyakov Documentation Error in the Help: the WINDOW command Support 0
vefatica Help for @PID Support 2
Alpengreis Documentation Minor issue in help file for view /E Support 1
R Documentation Advanced Directives Help Support 0
R Documentation Help Nit with SETP Support 0
R wmic command help Support 9
R Documentation Help Nit > bdebugger View Menu Support 0
R Documentation A couple of Help nits Support 0

Similar threads