with all the fields imported, when I look at the results in the relevance tester I get an error
Error: There is an error in XML document (5, 5159)
does that mean anything that I can use to troubleshoot this issue
after walking through the query line by line I found this to be the error
,
"|" , concatenation
", " of unique values of (
if ( exists result from ( bes property
"command lines for programs run at startup" ) of it ) and ( exists values of result from ( bes property
"command lines for programs run at startup" ) of it ) then ( values of ( results from ( bes property
"command lines for programs run at startup" ) of it ) )
else
"<no data>" )
now this is 1 chunk of the data that i return, I have about 70 pieces like this all appended together…
and only when I add this piece of code do i get the XML error
if clean it all up and place this into the BES Session Relevance Tester
(names of it ,
"|", (
if ( exists result from (bes property
"Command Lines for Programs Run at Startup") of it ) and ( exists values of result from ( bes property
"Command Lines for Programs Run at Startup" ) of it ) then ( values of ( results from ( bes property
"Command Lines for Programs Run at Startup" ) of it ) )
else
"no data" ) ) of bes computers
i get the Error
Error: There is an error in XML document (10,79)
values of ( results from ( bes property
"Command Lines for Programs Run at Startup" ) of it ) of bes computers
Error (10,60)
and the Property “Command Lines for Programs Run at Startup” is
unique values of (
if it ends with
case insensitive regex
"\.lnk" AND exists shortcut of file (following text of first
" " of it) then (it; (
"[Shortcut] " & it) of pathname of shortcut of file (following text of first
" " of it))
else it) of ( (
if (exists key
"HKLM\Software\Microsoft\Windows\CurrentVersion\Run" whose (exists value whose (exists name of it OR it !=
"") of it) of registry) then ((
if it =
"" then
if exists name of it then
"[Registry] No Command Line"
else nothing
else
"[Registry] " & it as string) of values of keys
"HKLM\Software\Microsoft\Windows\CurrentVersion\Run\" of (if x64 of operating system then (x32 registry; x64 registry) else registry)) else nothing) ; (if (exists key "HKCU\Software\Microsoft\Windows\CurrentVersion\Run
" whose (exists value whose (exists name of it OR it != "
") of it) of registry) then ((if it = "
" then if exists name of it then "[Registry] No Command Line
" else nothing else "[Registry]
" & it as string) of values of keys "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\
" of (if x64 of operating system then (x32 registry; x64 registry) else registry)) else nothing) ; (if ((name of it contains "Win2000
" OR name of it contains "WinXP
" OR name of it contains "Win2003
") of operating system) then (if (exists folder (value of variable "ALLUSERSPROFILE
" of environment as string & "\Start Menu\Programs\Startup
")) then ("[Startup-Folder]
" & it) of pathnames of files of folder (value of variable "ALLUSERSPROFILE
" of environment as string & "\Start Menu\Programs\Startup
") else nothing) ; (if (exists folder (value of variable "USERPROFILE
" of environment as string & "\Start Menu\Programs\Startup
")) then ("[Startup-Folder]
" & it) of pathnames of files of folder (value of variable "USERPROFILE
" of environment as string & "\Start Menu\Programs\Startup
") else nothing) else if ((name of it contains "WinVista
" OR name of it contains "Win2008
" OR name of it contains "Win7
") of operating system) then (if (exists folder (value of variable "ALLUSERSPROFILE
" of environment as string & "\Microsoft\Windows\Start Menu\Programs\Startup
")) then ("[Startup-Folder]
" & it) of pathnames of files of folder (value of variable "ALLUSERSPROFILE
" of environment as string & "\Microsoft\Windows\Start Menu\Programs\Startup
") else nothing) ; (if (exists folder (value of variable "USERPROFILE
" of environment as string & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
")) then ("[Startup-Folder]
" & it) of pathnames of files of folder (value of variable "USERPROFILE
" of environment as string & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
") else nothing) else nothing) ; (if version of client >= "8.0
" then ((if (type of it = exec task action type) then ("[Scheduled]
" & path of (it as exec task action)) else nothing) of actions of definitions of it ; (if exists paths of it then ("[Scheduled]
" & it) of paths of it as string else ("[Scheduled]
" & it) of names of it as string)) of scheduled tasks whose (exists definitions whose (exists triggers whose (type of it is logon task trigger type OR type of it is boot task trigger type) of it) of it AND type of actions of definitions of it = exec task action type) else nothing) )
and this is the output on the server, could the quotes or braces be breaking the XML ?
I’m not sure if this is a bug or it’s expected behavior, but it looks like control characters aren’t being escaped properly before the web service sends a response back to the client. Some of the results in this query contain control characters. I think that startup entries from the registry were the offenders, at least that’s what I found from my results.
At first I thought it was just null control characters (%00), but it looks like there could be others as well. Here’s what I had to do to get it to work:
substrings separated by
"||" of concatenation of matches (regex
"\p{Print}") of characters of concatenation
"||" of values of ( results from ( bes property
"Command Lines for Programs Run at Startup" ) of it ) of bes computers
I don’t know if this is the best way to eliminate control characters, but it seems to work for me. By the way, I don’t know much regex, and I found that pattern after some Googling. A better pattern may exist.
( names of it ,
"|" , operating system of it , substrings separated by
"||" of concatenation of matches ( regex
"\p{Print}" ) of characters of concatenation
"||" of values of ( results from ( bes property
"Command Lines for Programs Run at Startup" ) of it ) ) of bes computers
is either one of these more efficient then the other ?
We have a bug report open (#38567) to track this issue.
I see that 7.2 is successful dealing with a null-terminated return value, but it is failing in 8.0.
Boyd has a good workaround.
I was using a different form, that achieves the same results of getting around the issue:
substrings separated by
"%00" whose (length of it > 0) of values of results of bes property
"Your Property".
Lee Wei
Just a heads up, I tried something very similar to that to remove all of the null characters, but there were other control characters in the results of this property that were also causing the return value to fail with an XML error. I couldn’t pin down exactly which ones it was though, so I went with the regex pattern.
Mark, I think Lee’s is faster but it depends how many results you’re returning. If it’s only the results of one system it probably won’t matter (just guessing).
You could replace my regex pattern with Lee’s relevance. If you’re going to use the regex, you don’t need to combine it with Lee’s relevance because the regex will includes “%00”
substrings separated by
"%00" whose (length of it > 0) of values of ( results from ( bes property
"Command Lines for Programs Run at Startup" ) of it ) of bes computers
Oh, and don’t think you would have to rewrite your entire query. Just modify your relevance so that all of the values that you’re returning in your clause are filtered with this.
its not going to be bad, I made a Query builder and just pass it the property name “Command Lines for Programs Run at Startup” and it builds the entire query string
If I run the same query in the Session Relevance Tester, the results are returned successfully, so I think it’s occurring when the xml result is being parsed inside EvaluateRelevance().