As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What tools are you guys using for XPath and why?
Right now I'm using
SketchPath because its totally awesome, but its a windows app that needs to be installed
WhiteBeam online XPath test bedbecause you can test expressions from the website
SketchPath seems to stand out the most to me because it actually helps you create the xpath and it is very advanced. If you haven't tried it you should.
Cons to SketchPath: you have to install it on the machine, otherwise it is fantastic.
Cons to WhiteBeam: you have to upload your file which I don't always want to do for security reasons and the file size you can upload has some limit on it, and uploading a file is annoying anyways. Also I think there might be some subtle differences between the xpath used for that tool and when running a .NET app. But don't remember any right now. Just keep it in mind.
[Update] XMLQuire was originally recommended in this answer. It was a free XML editor for Windows with the SketchPath XPath Editor built in for XPath testing.
XMLQuire has not been maintained for a few years and has now been retired.
For XPath experimentation etc. XMLQuire's author now recommends the XPath Notebook extension for Visual Studio Code. Developed by the same author, this now supports XPath 3.1 courtesy of Saxonica's Saxon-JS processor.
If you're in a web dev environment, Firefox has a number of great tools for XPath support and analysis:
Firebug has built-in XPath support
XPath Checker I have found to be great
and also maybe of use:
XPath Runner
FireXPath
Be careful with Firebug - the right-click "copy XPath" command copies the path as all lower-case, and some XML parsers (like the MXSML parser used in FinalBuilder) are case-sensitive - so you'll need to correct the casing of your Firebug-copied XPath statement otherwise your parser won't find any matching nodes.
with this xpath tester you can test standard XPath expressions
You can also save your XPath's and XMLs at any point of time to return to it later or post a link in web or email, which is a really handy feature.
SketchPath is the best tool for XPath that I have used so far. I have used oXygen as well, but prefer SketchPath to oXygen for XPath.
I like XPather, a Firefox plugin. It's simple and easy-to-use and it's not a separate program to run as long as you have Firefox running which is when and where I'm usually using XPath.
I use oXygen for xpath work. It's rather easy to test your expression against xml on file. You set the target xml file once and then it's just a button to click to test your expression.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have a web project that I am ripping out all the inline styling and adding it to a CSS file, and I can't help but think there is an easier way to do this.
My current process is:
Search Solution for style=", if none selected, goto: 9
Cut all the text between the quote marks
Create new class in CSS file
Paste code in class
Copy class name
Return to html line and paste class name in between quote marks
Rename style to class
goto: 1
Rejoice!
I would really like to rejoice, but there seems to be a never ending supply of inline styling.
Is there a way to automate this process in Visual Studio 2010? If it requires writing a plugin, that is totally fine! I have this same task to do on many a project.
Also, I'd like to be able to do this for arbitrary tags. For example, I'm also taking all of the data-* tags and doing roughly the same thing, but adding a line of jQuery to add it back in. Something like:
$('SELECTOR').attr('data-bind','visible: IsValid');
The work is too repetitious for me not to believe there is an automated (or at least faster/better/less time consuming) way of doing this.
The project is an MVC project if that changes anything.
If you're looking for tool to replace inline style to css class, there are tools available:
http://www.voodoobytes.info/humbles-tools/
http://www.tinytool.net/96002/inline_css_extractor
You will need a macro. There are hints for realization in one file:
1/ Edit point
Dim EditPt As EditPoint
EditPt = CType(DTE.ActiveDocument.Object, EnvDTE.TextDocument).StartPoint.CreateEditPoint
2/ Searching and replacing
While EditPt.FindPattern("style="".*""")
End While
You can read text EditPt.GetText(6) (returns 'style=') delete text EditPt.Delete(6) (removes 'style=') EditPt.Insert("_") (inserts _ before 'style=').
I don't use CodeRush myself, but they seem to have what you are looking for, if this link is anything to be believed.
Move Style Attributes to External CSS
You may need to write your own plugin to do the other, but CodeRush do support this.
I was unable to find similar functionality in Resharper, although it does support plugins as well..
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Is anyone aware of command line tools that can validate CSS and/or HTML?
The W3C offers its validators for local installation, with directions to use from the command line, but the installation process is a nightmare for anyone who isn't a seasoned Java developer.
I've searched with Google, but can't find anything.
Ideally I'd like to use a tool (or tools) that I can point at my CSS, and have it report back on any errors. I want it to be local to increase the speed of my debugging cycles.
Ideally, the tools will understand HTML5 and CSS3.
There is tidy for HTML. It's more than a validator: it doesn't only check if your HTML is valid, but also tries to fix it. But you can just look at the errors and warnings and ignore the fix if you want.
I'm not sure how well it works with HTML5, but take a look at Wanted: Command line HTML5 beautifier, there are some parameter suggestions.
For CSS there is CSSTidy (I have never used it though.)
Regarding the W3C validator: if you happen to use debian/ubuntu, the package w3c-markup-validator is in the repositories and very easy to install via package management. Packages for other distos are also available.
And the W3C CSS validator is available as a jar, which is easy to use:
java -jar css-validator.jar http://www.w3.org/.
One of the most popular web-based validators is http://validator.nu.
On their About page, they list a command-line script (written in Python) for validation.
On Ubuntu, you can install the package w3c-markup-validator. It provides a CGI web interface. But you do not have to use it.
You can use my w3c-validator-runner to run the validator without having a webserver.
If that does not work, consider starting a webserver. You can then use srackham/w3c-validator.
WC3 has the source to their validators here: https://github.com/w3c
Although not directly a solution to your problem, you could consider using a CSS-extension framework for the validation part. I use SASS extensively in all my web projects and find it indispensible when you get used to it. Besides all the fancy mixins and variables features etc. it will also perform a validation of your CSS/SASS markup and report for errors as it is perfectly backwards compatible with regular CSS3. The nice thing is that it works as a Ruby Gem which means that it runs locally and can be integrated with other workflows through either Ruby or the command line (terminal in unix environment).
Take it for a spin: http://sass-lang.com/docs/yardoc/
Run sass style.scss and see what happens.
Not sure if this works but if you have Node & NPM there is: html-validator and html-validator-cli https://github.com/zrrrzzt/html-validator & https://github.com/zrrrzzt/html-validator-cli
Is xpath-locator plug-in for Firefox can help in locating the elements in selenium script.
Any limitation using this plug-in in script?
It's always better to create your own xpath using firebug, firepath (a firebug extension) , webdeveloper or any other tool. You will learn to create xpaths which are not brittle. :)
Your question is very generic. It is not possible to cover all or at least the most variants of dynamically generated HTML source code to find elements by just using Xpath or CSS selectors. You will need a more "intelligent" logic.
If you tell us what your exact task is, we may help you with a solution for your problem.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Having the best forum website among developers, I think I will find a very good consensus of what policies and best practices make good coding. I will put some of them here, so I give the idea, but I will like to hear your opinion and the votes will probably be the judge of the best policies around.
Specific Indentation for coding between development teams
Specific comments before each method, before each variable declaration
Naming conventions, camel case or any other.
In HTML commenting after each container tag.
In CSS, using each declaration only once.
You get the idea. I will like to know what things company ask us to do, and what of those really work to obtain maintainable and beautiful code.
I would focus any policies around development practices rather than code formatting. Some examples are:
Always use parameterized SQL queries. Never concatenate user input into a query.
Keep HTML, CSS and JavaScript in separate files.
Use jslint or an equivalent tool every time you commit code.
Pick an HTML standard (such as HTML 4.01 strict). All HTML must validate.
And don’t be a policy-nazi. Sometimes rules have to be broken—but there should be a very good reason for doing so.
Code doesn't exist if it's not under version control. More specifically, NOTHING is on a production server unless it's committed to the repository.
If a project presents an opportunity to refactor old code, take that opportunity.
Maintain a wiki or similar to document procedures, standards and use of library code (when such documentation is too much for code comments)
(For PHP projects, at least -- note that PHP is open-source and has an important community ; so, many things are quite driven by what's done in the community)
First of all, when using a Framework on a project (ie, always), we try to stick to its policy, if clearly defined (it's the case for Zend Framework, at least) : it ensures anyone who will come to work on this project can :
find a definition of the standard
re-use it on any other projects that use the same framework
even when going to another company, or working for another client
or when coming from another company ;-)
Considering we are only using between 3 and 5 frameworks for PHP projects in the company I work for, and that many rules defined in their standards are the same, it's not a real problem.
Same applies if coding inside/arround some kind of CMS, for instance, of course.
When not using a specific framework, we try to stick to a common set of rules widely accepted amongst the PHP community : same way, it ensure those rules are well-known (even by new-comers to our company), easy to find, and that many people did try them and enhanced them.
About comments, there is one tool that is well-used in PHP : phpDocumentor (about the same thing as javadoc) ; it defines a standard -- this one is the de-facto standard, as there is no other tool that is used that much.
About specific comment-tags :
we always use #param / #return : they are integrated in the IDE, to provide type-hinting, so are useful
else, we don't use much : a couple of lines to say what the method does if it's not obvious ; a couple of lines if a difficult algorithm is used.
Camel-case or other : we stick to what is common amongst both the PHP community and frameworks :
this_is_a_function
And
ThisIsAClassName
And
thisIsAMethodName
In HTML : as much as possible, we don't use HTML comments, because they are sent to the browser :
means bigger pages (ok, not that much)
means giving away informations the user doesn't need
If possible, we use comments from the templating-engine.
In CSS : we comment when needed ; more important thing is to use several small CSS files, quite specific (even if using a merge-tool during the build process)
But, maybe more important than all this : we try to use "clean" code, with small methods that only do a small "unit" thing, with self-describing names and all
It doesn't do magic, but it helps understanding the code... And, also, testing it, re-using it, ...
Also, as Nate said : these are mostly guidelines -- except if specifically required by a client... In which case you have to put some automatic tool (In your build process, for instance) to verify they are followed by the letter.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Reading the online MSDN docs is a great way to learn more about .NET and other MS technologies. However sometimes I need to read it in an offline mode, like when using an eReader.
Is there a tool, software or some code which can be used to download a section of the MSDN library and convert it to a pdf, by starting from a url in the msdn docs?
Say i want to download the whole section about WCF and the tool would, intelligently, download that part of the MSDN and convert it to pdf? The hyperlinks in the docs need not be followed. They usually point to other subsections in the main section and they will get downloaded during the process.
Update:
App and code is available at http://soofflinereader.codeplex.com/
the solution to convert html to pdf book was simple enough:
https://sitereader.codeplex.com/
Usage:
Download the release build and execute as shown below:
Fluid.SiteReader.Console msdn ms731190
Will convert all documentation underneath the path http://msdn.microsoft.com/en-us/library/ms731190.aspx and create a pdf based on the title of the page stated.
Note:
Will use a sub-folder called 'temp' as a working folder, inspect config file for more details.
See the answers on this forum. May be of help to you.
For single entries you can:
Install PDFCreator from http://sourceforge.net/projects/pdfcreator/
It will then give you a virtual printer driver, that will appear like a normal printer.
From your print option in your browser print your document to a pdf file (or actually any of the other formats on offer).
Don't know any easy way to grab larger subsections.
If you printed multiple sections this way you could then merge them together into a single pdf by using http://www.accesspdf.com/pdftk/.
I paid someone to create one for me.