|
i can't find all the nodes...using DOM
Let me expalain the problem
here is my xml
[CODE]
<study>
<document>
<title>title of file</title>
<file-tag info-type="2">
<property info="3">1</property>
</file-tag>
<file-tag info-type="4">
<property info-type="5">2</property>
</file-tag>
<file-tag info="6">
<property type="7">3</property>
</file-tag>
</document>
</study>
[/CODE]
i just want to remove to remove the "property" tag and place them after the "title" tag
i have code it like
<br />
objDomUpdate.Load ("\\Path of XML")<br />
objDomUpdate.async = False<br />
objDomUpdate.validateOnParse = False<br />
objDomUpdate.preserveWhiteSpace = True<br />
Dim i, iCou As Integer<br />
Set oNodeList = objDomUpdate.getElementsByTagName("document")<br />
<br />
Dim Count As Integer<br />
For Count = 0 To oNodeList.length - 1<br />
Set oNode = oNodeList.Item(Count)<br />
For i = 0 To oNode.childNodes.length - 1<br />
If StrComp(oNode.childNodes(i).nodeName, "file-tag", vbTextCompare) = 0 Then<br />
If oNode.childNodes(i).childNodes.length > 0 Then<br />
For iCou = 0 To oNode.childNodes(i).childNodes.length - 1<br />
''Set oDemonode = oNode.appendChild(oNode.childNodes(i).childNodes(iCou))<br />
Set oDemonode = oNode.insertBefore(oNode.childNodes(i).childNodes(iCou), oNode.childNodes(1))<br />
'MsgBox (oNode.childNodes(i).childNodes(iCou).nodeName)<br />
Next<br />
End If<br />
End If<br />
Next<br />
Next<br />
objDomUpdate.Save ("C:\test.xml")<br />
from the above code i just move 2 property tag but i can't move the last one.
why???
where i am wrong ???
please help..
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
I'm no expert in XML, but it would appear that you could do this much easier with an XML Transform. Though, I don't know for sure, nor do I know exactly how to do it.
But, back to your code. XML and XPath give you LOTS of power to do searching and retrieving of nodes and you're not using it at all. There's definitely lots more code here than there needs to be. First, get the document node and hold onto it. Then get a collection of the property nodes. All you need to do is enumerate that collection and call InsertBefore on the document node for each property node:
(assuming VB.NET!)
' Find the first 'document' node wherever it shows up in the XML.
Dim documentNode As XmlNode = objDomUpdate.SelectSingleNode("//document")
' Get all of the 'property' nodes, no matter where they show up inside the 'document' node.
Dim propertyNodes As XmlNodeList = documentNode.SelectNodes("//property")
' Move each 'property' node to before the FirstChild node of the 'document' node.
For Each propertyNode As XmlNode In propertyNodes
documentNode.InsertBefore(propertyNode, documentNode.FirstChild)
Next
Done!
|
|
|
|
|
helloo....
i have problem page navigation in my report viewer,,,the first load page navigation always display total page is totalpage-1
for example, i have 10 page.....
in first load pageNavigation will say 1 of 9, but if I click next page, PageNavigation will say 1 of 10,,what is false in me program
please help me,,,,
|
|
|
|
|
If you click back to the first page, does it still say 1 in 9, or does it say 1 in 10, if the report is 10 pages long??
This post[^] may shed some light on the issue.
|
|
|
|
|
If click back to the first page, it still say 1 in 10,, the problem is only the first load....
what must i do?
|
|
|
|
|
Nothing. The ReportViewer hasn't finished its internal rendering, adn therefor, page count, when you see the first screen. If your report was a thousand pages long, you'd see the same thing. There's really nothing you can do about it.
The reason for this is imple. Say the report is 300 pages long. Would you really want the user staring at a blank screen while the RV control figures out how many pages are in the report? Or would you want the user to start looking at the report's first few pages while the control does its internal rendering and figures out how many pages are in it??
Something else you haven't run into yet is that the number of pages you see in the report (even after rendering is finished) CAN and probably WILL be different than the number of actual pages printed!
|
|
|
|
|
so...
page navigation don't have method to setting it? only to show or hodden it?
thank you..
|
|
|
|
|
No, you can't set the number of pages in the report.
|
|
|
|
|
Thank you very much
|
|
|
|
|
I wants to create a Msi to install software addin (dll). I created msi which copy the dll to the destination folder but how to register the dll using msi? now I have a batch file to do this and I am executing after installation (manually). Is there any good practice to register the dll while installation or to run the batch file during installation?
(vb2005)
Saseendran Kombath
|
|
|
|
|
Saseendran Kombath wrote: I created msi which copy the dll to the destination folder but how to register the dll using msi?
If you did this, there should be an option in the properties for that file, called Register, to register the .DLL. If it's a COM-based .DLL, you set this option to vsdraCOM . Done. No batch file required.
|
|
|
|
|
Below is the code I used in batch file to register the .DLL
c:\windows\microsoft.net\framework\v2.0.50727\RegAsm.exe /codebase "name.dll"
I tried using vsdraCOM but it doesn't worked for my application
Saseendran Kombath
|
|
|
|
|
Saseendran Kombath wrote: :\windows\microsoft.net\framework\v2.0.50727\RegAsm.exe /codebase "name.dll"
This is a .NET DLL, not COM-based.
Saseendran Kombath wrote: tried using vsdraCOM but it doesn't worked for my application
It didn't work because you told the MSI to register a COM-based DLL and that's not what you have. RegAsm registers a .NET assembly as a COM type, IF and only IF the assembly has been properly decorated and coded to support COM, AND is strong-named.
There is no option for a .NET DLL. You'll have to run the batch file from a custom action in the installer. For this, open Visual Studio and hit F1. Search for "custom actions" in the help for examples.
|
|
|
|
|
Thanks a lot for the clarification
Saseendran Kombath
|
|
|
|
|
Hi
I am trying to code in VB.Net 2003 i am a beginner, and i must retrieve a small amount of data from an oracle database. I have been searching online for the last 4-5weeks and cannot seem to get anywhere fast, the internet is just a mine field if you find some code that looks good it comes with errors and as it is new to me it is pretty difficult. I have designed the tables in oracle just need some code to return a small amount of data in VB.NET 2003.
Any help would be appreciated
Thank You beforehand
|
|
|
|
|
Instead of jumpng from article to article, snippet to snippet, you should take a snippet that you find online, read the article, check the error messages you get, and work out what it is that you're doing wrong. Copying and pasting code from the web that you don't take the time to understand is never going to work. Getting another snippet from this site won't make it better. You CAN use this site to ask questions about why the code you're using is not dogn what you want, however. That would make more sense.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks Christian you now it is correct to do that.
thank you
|
|
|
|
|
If I use the System.IO namespace to edit files where is the file default location. Will it be in the projects \bin directory?
|
|
|
|
|
Environment.CurrentDirectory or System.IO.Directory.GetCurrentDirectory() will provide you with the current working directory for your application.
Paul Marfleet
|
|
|
|
|
The default "current directory" is the folder you launched the .EXE from. BUT!! NEVER, and I mean NEVER, depend on the "current directory" to stay set to what you think it is. Your code should always build fully qualified path names to files.
|
|
|
|
|
i want vb6 code to enumerate installed devices
vimlesh
|
|
|
|
|
Noone is going to write it for you if that's what you're looking for.
Other than that, you'll have to ask a specific question about what you want. Somehow, I don't think you know anything about Windows Setup API functions.
|
|
|
|
|
I'm trying to do some Powerpoint automation from an ASP.NET page and generate/modify a slide. That piece of the code works fine but when it's all done running and even after I call the Quit() method on the powerpoint application object, POWERPOINT.EXE remains running and eventually this is causing problems. I've googled this extensively and nothing I've found has seemed to help. I really need this to work properly.
Here's my relevant code. I don't believe i'm using any Global references and I've even removed the COM reference from my website to use Late Binding instead in hopes that it would solve my problems as mentioned in this MSDN Article: http://support.microsoft.com/default.aspx?scid=kb;en-us;319832
Code:
Public Function GenerateDrillDown(ByVal strFileName As String) As Boolean
Dim App As Object = Nothing
Dim pres As Object = Nothing
Dim slide As Object = Nothing
Try
App = CreateObject("PowerPoint.Application")
App.Visible = -1 ' For debugging. Comment this out or set to 0 to keep the application from being visible.
pres = App.Presentations.Open("C:\DevProjects\Docs\DrillDown.ppt", 0, -1, -1)
slide = pres.Slides(1) ' There's only one slide in this ppt i'm using as the template.
slide.Shapes.Item("Text Box 8").TextFrame.TextRange.Text = DecisionTitle ' These are all string variables
slide.Shapes.Item("Text Box 13").TextFrame.TextRange.Text = Narrative
slide.Shapes.Item("Text Box 14").TextFrame.TextRange.Text = Issues
slide.Shapes.Item("Text Box 19").TextFrame.TextRange.Text = Scope
If TopicType = 1 Then
slide.Shapes.Item("Autoshape 9").TextFrame.TextRange.Text = IDNumber.ToString()
slide.Shapes.Item("Autoshape 9").Visible = -1
slide.Shapes.Item("Autoshape 56").Visible = 0
ElseIf TopicType = 2 Then
slide.Shapes.Item("Autoshape 56").TextFrame.TextRange.Text = "ST" & IDNumber.ToString()
slide.Shapes.Item("Autoshape 56").Visible = -1
slide.Shapes.Item("Autoshape 9").Visible = 0
End If
pres.SaveAs(strFilename, 1, 0)
Catch ex As Exception
Return False
Finally
' Most of this is coming from another article I found online to help combat the problem of open references with office automation.
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect() ' Intentionally repeated
GC.WaitForPendingFinalizers()
If Not slide Is Nothing Then
Marshal.FinalReleaseComObject(slide)
slide = Nothing
End If
If Not pres Is Nothing Then
pres.Close()
Masrhal.FinalReleaseComObject(pres)
pres = Nothing
End If
If Not App Is Nothing Then
App.Quit() ' This doesn't do anything, no errors but ap stays open
Marshal.FInalReleaseComObject(App)
App = Nothing
End If
End Try
Return True
End Function
Please give me some guidance as this is an important piece of functionality required by my project. Thanks!
|
|
|
|
|
|
i have a windowform with employee image, Firstname and other data. I can save the image of the employee(when loaded into the image control) but when i dont load the picture in the image control it flags error
t.aransiola
|
|
|
|