Jump to content
Xtreme .Net Talk

hog

Avatar/Signature
  • Posts

    1011
  • Joined

  • Last visited

Everything posted by hog

  1. the source code for the Wrox title Beginning VB.NET XML? If so any chance of a copy as their site no longer lists it. And I have just read they have been sold off!! Thnx:)
  2. Can anyone tell me what is wrong with this DTD and xml file please? <?xml version="1.0" encoding="utf-8" ?> <!ELEMENT config (#PCDATA)> <!ELEMENT version (#PCDATA)> <!ELEMENT released (#PCDATA)> <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE config SYSTEM "xConfig-DTD.xml"> <config> <version>1.1</version> <released>01/09/2003</released> </config> no matter what I do I keep getting an error at <version>? First go at validating by the way :) DOH:) sorted it :):) <?xml version="1.0" encoding="utf-8" ?> <!ELEMENT config (version, released)> <!ELEMENT version (#PCDATA)> <!ELEMENT released (#PCDATA)>
  3. this should help you pull out all the <Search> elements: Dim xPathDocument As XPathDocument = New XPathDocument(strDocument) Dim xPathNav As XPathNavigator = xPathDocument.CreateNavigator xPathNav.MoveToRoot() Dim xPathNodeIterate As XPathNodeIterator = xPathNav.Select("descendant::Search") While xPathNodeIterate.MoveNext ' put your code in here to pull out name, space etc 'xPathNodeIterate.Current.Name 'xPathNodeIterate.Current.Value End While
  4. OK to clarify:) All the apps I have produced to date use a splash form with a timer to display an identical form as displayed on the about menu. Where there is some background procesing going on which would normally delay the app from starting then I do not use a timer as the delay would be too long, (at least we agree on that:) ). As I previously stated I use the splash form basically to advertise to users who it was who wrote the app and display a the apps logo. You cannot be sure every user will bother to look at the about option so in these cases the author remains unknown. If I didn't use this approach then I would not be in the job I'm in now as it was directly though this that my skill was noticed. Worse case in all my apps is a delay of 15 seconds and that is without a timer as it connects via odbc to various remote tables so is unavoidable. Personnaly 15 seconds is a piss in the ocean! But I accept we are all different and thus we can happily agree to disagree:)
  5. What a star:):):)
  6. the file iexmltls.exe? according to various sources on the web including my book on xml I need to download it from http://msdn.microsoft.com/msdn-files/027/000/543/iexmltls.exe. However it ain't there....in fact I can't find that file at all when searching for it on MS site. Anybody know where I can get it?? It's for Internet Explorer Tools for Validating XML and Viewing XSLT Output .
  7. Not half a s glad as I am lol :)
  8. Mmm show me an application that starts these days without a splash screen?? Example Nero 5 displays a splash for 9 seconds before doing anything on my laptop. Mmm having to wait a whole 15 seconds for a splash screen to disapear must really be annoying?? Lastly regardless of whether it does anything in the background or not, (mine usaully do), it is not just sitting there doing nothing.........it is doing what a splash screen is supposed to do....inform the user of the product they are loading plus supply some author detail. Lastly lastly....had I not provided such splash screens with the apps I have developed I would not now be in the job that I am doing now as no one would have heard of me if all I did was put author detail in the About menu.
  9. I have now obtained a book that treats the reader as completely new to xml but who is conversant with VS.Net/VB.Net. "Beginning VB.NET XML Essential XML Skills for VB.NET Programmers" This book has already answered so many of my questions and I'm only 3 pages into the 2nd chapter:):)
  10. From what I know so far I can tell you that you sould leave the fisrt line in as it is a declaration. It is optional but tells the xml parser what version the xml document conforms to. To access a parts of the xml file use XMLElement, XMLComment, XMLAttribute etc from the NodeType enum.
  11. See my post in the general section re splash screen
  12. All my applications use the same approach. Design a splash form with a timer on it. When the time is up it closes the splash form and opens the applications main form. Some may disagree with this approach, but it works fine. I have used it in VBA, VB5, VB6 and now in VB.NET.
  13. Aha makes perfect sense and will make life easier :) Again, perfect sense but need to suss out how to use a schema to validate an xml file. I'm still searching for a good book that works from the basics up with lots of examples. The few I have obtained from Amazon are crap as they just ramble on for pages with the occasional example few and far between. I am starting to get it very slowly but the info is too spread out:( Normally I get hold of one or two good books and dive in until I get it.........you can see this just ain't happening with xml. What makes it more annoying is that everywhere I read how easy it is to use but am yet to find the right tutorial to prove this to be the case :( :( I have this code which I have mdified from the VS Help which is the first real bit of code I have managed to actually get to do anything half way descent with xml. Const strDocument As String = "C:\Documents and Settings\paul\My Documents\Visual Studio Projects\xmlTest1\cd_catalog.xml" Dim xPathDocument As XPathDocument = New XPathDocument(strDocument) Dim xPathNav As XPathNavigator = xPathDocument.CreateNavigator xPathNav.MoveToRoot() Dim xPathNodeIterate As XPathNodeIterator = xPathNav.Select("descendant::CD/TITLE") Dim intCount As Integer = 0 While xPathNodeIterate.MoveNext intCount += 1 Me.rtbCDCollection.Text &= intCount & " <" & xPathNodeIterate.Current.Name & ">" & _ xPathNodeIterate.Current.Value & ControlChars.CrLf End While The xPathNav.Select method above references I presume is the namespace 'descendant'. Is this a default namespace name in all xml files? I understand that this method is selecting the TITLE child element of the CD element in the descendant namespace. Addition: Just got this to work. Is this the normal way to pick out valuse from an xml file? Const strDocument As String = "C:\Documents and Settings\paul\My Documents\Visual Studio Projects\xmlTest1\xconfig.xml" Dim xPathDocument As XPathDocument = New XPathDocument(strDocument) Dim xPathNav As XPathNavigator = xPathDocument.CreateNavigator xPathNav.MoveToRoot() Dim xPathNodeIterate As XPathNodeIterator = xPathNav.Select("descendant::config/version") xPathNodeIterate.MoveNext() Dim strVersion As String = xPathNodeIterate.Current.Value xPathNodeIterate = xPathNav.Select("descendant::config/released") xPathNodeIterate.MoveNext() Dim strReleased As String = xPathNodeIterate.Current.Value Me.rtbCDCollection.Text = "The lastest version of " & strVersion & " was released on " & strReleased
  14. Off the top of my head without much thought:) Have you tried putting a check in the click event that checks the status of the keypress? If it is Enter exit the sub? must be a more elegant way.......
  15. ? what do you mean listens for an xml file. New to all this too so excuse the stupid question:)
  16. Mmm .NET Samples - How To: XML Data gives a long list of examples that can be picked apart and stepped through to see what is happening. Slowly.....very slowly it's starting to gel :)
  17. This is an answer I got from our tech bods: hope this helps
  18. Might not be the answer but have you looked at the details for scheduled jobs as these run when the computer is on but no one is logged in?
  19. According to my book element names can be any length and may contain letters, digits, underscores, hyphens and periods. They must begin with a letter or an underscore. XML is also case sensitive so <Myelement> is not the same as <myelement>
  20. farshad & sonde place your questions in a new thread :)
  21. Okey dokey..... I now have this code: Private Sub cmdLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLoad.Click Dim xDocument As New XmlDocument xDocument.PreserveWhitespace = False xDocument.Load("C:\Documents and Settings\paul\My Documents\Visual Studio Projects\SampleSchema\cd_catalog.xml") Me.rtbCDCollection.Text = DisplayNodeInformation(xDocument) End Sub Public Function DisplayNodeInformation(ByVal xNode As XmlNode, Optional ByVal intIndent As Integer = 0) As String Dim strOutput As String Dim xChildNode As XmlNode If xNode.NodeType = XmlNodeType.Text Then strOutput = Space(intIndent) & xNode.Value & ControlChars.CrLf Else strOutput = Space(intIndent) & xNode.Name & ControlChars.CrLf End If For Each xChildNode In xNode.ChildNodes strOutput = strOutput & DisplayNodeInformation(xChildNode, intIndent + 4) Next Return strOutput End Function which produces this: I'm starting to get this xml stuff but am still struggling to work my way around a document. A few questions.... Am I correct in assuming the program needs to know the format of the expected xml file? I've being working on the idea that it does not so it has to go through all this checking stuff to confirm the format?? Is it better to read the whole xml file into a dataset structure and manipulate the data from there and if so any pointers? Thnx :)
  22. Thnx.....I'll give this a whirl and see how I get on:)
  23. I bought a eBook today, Visual Basic .Net and XML, which started out well in chapter 1 but just rambles on with loads of text and gets mighty confusing re schemas. Does anyone know of any text that speaks plain English for the complete idiot? I am baffled as to why this is leaving me stumped??
  24. I've just released my Maintenance and Servicing Contracts system to allow both our distribution sites to track all service contracts for equipment that require regular servicing, Suppliers, Equipment, Service Costs and Details etc. Also acts as a asset Register. My next project starng very soon is to do with extracting MI from one of out corp systems to aid distribution processing. The game fun side of VB has now hit the back burner. Afterall it's work that pays the bills :):)
  25. OK, for some reason this XML stuff eludes me. I'm trying to do the following as an exercise in learning it. I have an xml file with this content: <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited with XML Spy v4.2 --> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> <CD> <TITLE>Greatest Hits</TITLE> <ARTIST>Dolly Parton</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>RCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1982</YEAR> </CD> </CATALOG> All I want to do is find out how to access the elements that hold the data. I'm tried the DOM and Xpath and now xmlTextReader. I have got further with the latter but it all seems messy. Here is some code: Dim xReader As Xml.XmlTextReader = New Xml.XmlTextReader("C:\Documents and Settings\paul\My Documents\Visual Studio Projects\SampleSchema\cd_catalog.xml") Dim htCDCollection As Hashtable = New Hashtable Dim strNodeName As String Dim intCounter As Integer Do While xReader.Read If xReader.NodeType = XmlNodeType.Element Then htCDCollection.Add(xReader.Name & intCounter, Nothing) strNodeName = xReader.Name & intCounter Me.rtbCDCollection.Text = Me.rtbCDCollection.Text & xReader.Name & vbCrLf & vbTab End If If xReader.NodeType = XmlNodeType.Text Then htCDCollection.Item(strNodeName) = xReader.Value Me.rtbCDCollection.Text = Me.rtbCDCollection.Text & xReader.Value & vbCrLf End If intCounter += 1 Loop xReader.Close() xReader = Nothing The hashtable is there as I'm trying to figure out a way to store the data so I can move back and forth through it. All help gratefully recieved. Thnx:)
×
×
  • Create New...