Home Download Buy Blog Forum Support

XML commands for sublime text

XML commands for sublime text

Postby edi9999 on Fri Jul 26, 2013 1:06 pm

Hey,

I just had an idea that I think would be nice. It's an xml Parser inside Sublime Text.

For example, say you want to add a label to all of your inputs in HTML. You would write something like this:

Code: Select all
inputs=document.getElementsByTagName('input')
for input in inputs:
    id=input.getAttribute('id')
    label=document.createElement('label').setAttribute('for',id)
    input.before(label)


Is they already support for something like that in Sublime Text, or are they some plugins that extend sublime this way ?
If not, how is it possible to do so ? I never created a plugin and am asking if you can add variables like that accessible from the sublime console.

Thanks in advance!
edi9999
 
Posts: 2
Joined: Thu May 23, 2013 8:37 am

Re: XML commands for sublime text

Postby skuroda on Sat Jul 27, 2013 9:02 pm

I don't know if a plugin like that exist (I wouldn't be surprised if there is one). But you can do it to. Off the top of my head, I would say you could read in the file content using view.substr(0, view.file_size()). Pass that content to an XML manipulation library (which I'm sure python has). Perform whatever manipulation you want (gathering information from the user via input panel). Then replace the content of the file with the manipulated information.
skuroda
 
Posts: 674
Joined: Fri Oct 05, 2012 8:11 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 5 guests