Jump to content

PuppyOnTheRadio

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by PuppyOnTheRadio

  1. Okay - I've played with this in excel and VBA and have the bones of a script: Sub Macro1() Application.ScreenUpdating = False Do If InStr(ActiveCell.Value, "<timestamp>") > 0 Then If Mid(ActiveCell.Value, 18, 4) < 2010 Then Do ActiveCell.Offset(-1, 0).Select Loop Until InStr(ActiveCell.Value, "<revision>") > 0 Do Selection.Delete Shift:=xlUp Loop Until InStr(ActiveCell.Value, "</revision>") > 0 Selection.Delete Shift:=xlUp Else ActiveCell.Offset(1, 0).Select End If Else If InStr(ActiveCell.Value, "<siteinfo>") > 0 Then Do Selection.Delete Shift:=xlUp Loop Until InStr(ActiveCell.Value, "</siteinfo>") > 0 Selection.Delete Shift:=xlUp Else ActiveCell.Offset(1, 0).Select End If End If Loop Until InStr(ActiveCell.Value, "</mediawiki>") > 0 Application.ScreenUpdating = TrueEnd Sub I'd like to do the same with a VBS that will also: Open the XML as though it were a text file work on a line-by-line basis instead of a cell by cell basis Who can bail me out here?
  2. Hey. I posted something at http://w3schools.invisionzone.com/index.php?showtopic=43927 that I need help with. I was looking for a VBS solution to delete lines of an XML doc (as though it were a text file) based upon lines above and below.It seems like a fairly straightforward idea, but I'm not that fantastic at VBS and thought someone may be able to work out a quicker way of doing this than I can.
  3. It's a wiki. And I'm not the site owner, just contributor/administrator. And given the content needed is around 30% of (estimated) 10GB, I don't really want to manually edit the files. Which is why I was looking for a desktop XML editor with macro functionality. Or a VBS approach, which it looks like I might have to go for.
  4. Sorry - I should have been clearer. I have no access to server side script at all. I can simply upload the XML doc, but due to a sloooooow sever, large XML files have a tendency to time out on upload. Hence I can download big files, but upload small ones. SoI was looking for something to manipulate the XML prior to upload.I have XML notepad, but that has no macro functionality (as far as I can see). I can manipulate it using VBA through excel/Word, but MS has a tendency to do UGLY stuff to XML files when saving.My next option is writing a local VBS which will go through and do the manipulation for me, but I'm not as skilled at VBS as I'd like to be. So I was really looking for a local XML editor that had automation included, or could be included fairly easily.I'm assuming the only nodes I really need are the main node, the page and it's sub-nodes. The site and it's sub-nodes can probably be trimmed. And there is a potential of generating one page at a time XML, so my "nice to have" can be worked around manually.Hope that clears up the question.
  5. My XML knowledge is fairly terrible, but I have an XML issue that someone may have an easy option for processing this. I have an XML document that maps kinda like this: <mediawiki> <siteinfo> <sitename></sitename> <base></base> <generator></generator> <case></case> <namespaces> <namespace></namespace> </namespaces> </siteinfo> <page> <title></title> <id></id> <revision> <id></id> <timestamp>2011-03-23T11:55:10Z</timestamp> <contributor> <username></username> <id></id> </contributor> <comment></comment> <text></text> </revision> <revision> <id></id> <timestamp>2011-03-23T11:57:00Z</timestamp> <contributor> <username></username> <id></id> </contributor> <comment></comment> <text></text> </revision> </page></mediawiki> So what I was wanting to do is remove the <revision></revision> based upon the date in the <timestamp></timestamp> for each revision instance. (A particular page will have numerous revisions but each revision has a unique timestamp). The timestamp is always in that format but to keep it simple I was just going to sweep everything pre 2010 from the XML. The second thing I was wanting to do was split the file so that each <page></page> was in individual xml files. (That's a nice to have rather than a have As we're looking at excess of 10,000 pages with some pages having excess of 100 revisions, obviously going through the XML manually to do this is a bit of a nightmare. What I was looking for was a way to do this via automation. Does anyone know of an effective way to do this?
  6. Hey PuppyOnTheRadio, often seen at uncyclopedia.wikia.com. I'm a shockingly bad coder, but like to use bits and pieces of jscript, vbs/vba, html, css, and xml to decorate birthday cakes. Yep - that's about it.
×
×
  • Create New...