Hi Romola,
Please find the code below, I typed out out in notepad, so it might
have syntax errors, but idea should be there
set objXMLDOM = Server.CreateObject("Microsoft.XMLDOM")
objXMLDOM.LoadXml(RQLRequest)
Set objProjectNodeList = objXMLDOM.selectNodes("//PROJECT")
For Each objProjectNode in objProjectNodeList
ProjectGuid = objProjectNode.getAttribute("guid")
ProjectName = objProjectNode.getAttribute("name")
<%
Project Guid: <%= ProjectGuid %>
<br />
Project Name: <%= ProjectName %>
%>
Set objGroupNodeList = objXMLDOM.selectNodes("//PROJECT[@guid='" &
ProjectGuid & "']/GROUPS/GROUP")
For Each objGroupNode in objGroupNodeList
%>
Group Guid: <%= objGroupNode.getAttribute("guid") %>
</BR>
Group Name: <%= objGroupNode.getAttribute("name") %>
</BR>
Checked: <%= objGroupNode.getAttribute("checked") %>
<%
Next
Next
I got lazy and simply used XPATH:
http://www.w3schools.com/xpath/xpath_syntax.asp
Idealy, I should be able to query sub nodes like
objProjectNode.selectNodes("/GROUPS/GROUP")
more information can be found here
http://msdn.microsoft.com/en-us/library/aa468547.aspx
Best,
-Jian
On Dec 19, 3:56 pm, "Chrzanowski, Romola" <[email protected]>
wrote:
> Hello Jian,
>
> Thanks for the code. It does output all of the groups. However, I am trying
> to get the groups listed with each project the groups belong to. Within the'
> for' loop for the Projects, I am trying to see the Groups for that project.
> Instead, I am getting the full list of Groups output. Do you have any
> suggestions for how to get that? This is my code right now:
>
> ' Load Result Into XML DOM
> Call XMLDom.LoadXML (CStr(RQLRequest))
>
> Set XMLDom = XMLDom.ObjectByQuery ("//PROJECTS")
> response.write "PROJECTS ObjectByQuery count=" + Cstr(XMLDom.objects.count) +
> "</BR>"
>
> for iCounter=1 to XMLDom.objects.count
> Response.write "</BR></BR>Project Counter= " + Cstr(iCounter) +"</BR>"
> Response.write "Project guid: " +
> XMLDom.objects(iCounter)("guid")+"</BR>"
> Response.write "Project Name: " +
> XMLDom.objects(iCounter)("name")+"</BR>"
>
> set objXMLDOM = Server.CreateObject("Microsoft.XMLDOM")
>
> objXMLDOM.LoadXml(RQLRequest)
> Set objNodeList = objXMLDOM.selectNodes("//GROUP")
>
> For Each objNode in objNodeList
> isMember = objNode.getAttribute("checked")
> if (StrComp(isMember, "1",0) = 0) then
> %>
> </BR>Group Guid: <%= objNode.getAttribute("guid") %>
> Group Name: <%= objNode.getAttribute("name") %>
> Checked: <%= objNode.getAttribute("checked") %>
> <%
> end if
> Next
>
> Next
>
> I appreciate your help with this.
>
> Romola Chrzanowski
> University Applications Development
> University at Albany
> 518.437.4525
>
>
>
>
>
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Jian Huang
> Sent: Monday, December 19, 2011 9:05 AM
> To: RedDot CMS Users
> Subject: Re: Plugin code to generate report of User Projects and Groups
>
> Hi Romola,
>
> You are close.
>
> set objXMLDOM = Server.CreateObject("Microsoft.XMLDOM")
>
> objXMLDOM.LoadXml(RQLRequest)
> Set objNodeList = objXMLDOM.selectNodes("//GROUP")
>
> For Each objNode in objNodeList
> %>
> Group Guid: <%= objNode.getAttribute("guid") %>
> Group Name: <%= objNode.getAttribute("name") %>
> <%
> Next
>
> On Dec 16, 3:06 pm, "Chrzanowski, Romola" <[email protected]>
> wrote:
> > I will appreciate some assistance if anyone has done something similar. I
> > realize that it will be good to move away from ASP, but I started with this
> > because of the good example I found from Manuel Schnitger's ASP example
> > code. I am writing a plugin to report on a user's details (projects,
> > groups, etc.) Right now I am stuck trying to parse the RQL response to this
> > RQL:
>
> > <ADMINISTRATION>
> > <USER guid="my guid">
> > <PROJECTS action="listgroups"/>
> > </USER>
> > </ADMINISTRATION>
>
> > The RQL output is like this:
> > <IODATA>
> > <PROJECTS>
> > <PROJECT guid="project guid 1" name="Project One"> <GROUPS> <GROUP
> > guid="Group guid 1" name="Group One" checked="1"/> <GROUP guid="Group
> > guid 2" name="Group Two" checked="1"/> </GROUPS> </PROJECT> <PROJECT
> > guid="project guid 1" name="Project Two"> <GROUPS> ... obviously there
> > may be multiple groups listed within one project.
>
> > Although it may be better to move to a different language, for now I would
> > like to finish this in ASP if possible. At this simple level, the code
> > works:
>
> > Call XMLDom.LoadXML (CStr(RQLRequest)) Set XMLDom =
> > XMLDom.ObjectByQuery ("//PROJECTS") for iCounter=1 to
> > XMLDom.objects.count
> > Response.write "iCounter= " +
> > Cstr(iCounter) +"</BR>"
> > Response.write "Project guid: " +
> > XMLDom.objects(iCounter)("guid")+"</BR>"
> > Response.write "Project Name: " +
> > XMLDom.objects(iCounter)("name")+"</BR>"
> > Next
>
> > What I can't figure out is how to get to the GROUPS and each GROUP element
> > in each of the PROJECT elements.
>
> > I will appreciate any advice or assistance.
>
> > Thanks in advance.
>
> > Romola Chrzanowski
> > University Applications Development
> > University at Albany
> > 518.437.4525
>
> --
> You received this message because you are subscribed to the Google Groups
> "RedDot CMS Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://groups.google.com/group/reddot-cms-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"RedDot CMS Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/reddot-cms-users?hl=en.