Skip to main content

Validate HTML as XHTML in Intelij

When working in intelij with HTML, sometimes we need to make sure our HTML is XHTML compliance, no un ened tags etc.
i.e. we should not have


<img src="myimage.jpg>

If You put above code in an HTML and run it in browser it will work fine, but if you are using some server side framework like Thymeleaf with Spring, it will generate error saying <img> tag must be terminated.

By Default intelij will not complaint about this and when you are writing HTML you may ignore the error and will get the error when you actually run it with in server. Or worst some HTML developer is writing the code HTML code for you and then you will have to fix all these errors.

Intelij can help you to make sure you write a valid HTML(XHTML). You can enable XHTML validation for HTML files by following below steps.

  • Go to Settings(Windows)/Preference(mac) in Intelij.
  • Search for "File Types"
  • Find HTML as shown in image below. You will see HTML has some extension associated with like *.html, *.htm etc

  • Now find XHTML and it will look like this 

  • Click "+" button under "Registered Patterns" and add *.html.
  • It will give following warning, please continue and click on "Reassign Wildcard"


  • Press "ok", Reopen your html file.
  • Right click an HTML file ans click recompile.
  • It will show you error on each line which are incorrect, go and fix them :)

Comments

Popular posts from this blog

How to add custom user attributes in keycloak and access them in spring boot application

Sometime it may be possible you want to add more parameters to standard registration page of keyloak for your users and aaccess that data in your spring boot application. This artical will show step by steps on how to add such extra attributes. What is Keycloak Keycloak is an open source software product to allow single sign-on with Identity Management and Access Management aimed at modern applications and services, to learn more visit  h ttps://www.keycloak.org/ What is Spring boot Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". To learn more visit  https://spring.io/projects/spring-boot To add an extra attribute in keyclkoak server you will need to edit actuall html template and then registaer new attribute in json response so that it will be available on client. Edit HTML template Lets assume we want to add mobile number on default registration page. Go to Keycloak home installation directory edit fil

How to git without finger print confirmation

In this article i will explain how you can run git clone command on a machine without having to accept sh key finger prints manually. Lets you want to write a script to initialise a developer machine, which require you to git clone various projects from gitlab or github or any other git repo. First time you run a git clone command, it will ask you if you accept the signature and it need to be part of automated script, its not nice thing to have. Here is the solution. First you download the git host's key then create its finger print then check this finger print against known valid finge rprint If its good then move downloaded ssh key to ~/.ssh/known_hosts file else throw error ssh-keyscan github.com >> githubKey ssh-keyscan gitlab.com >> gitlabKey export githubfinger=$(ssh-keygen -lf githubKey) export gitlabfinger=$(ssh-keygen -lf gitlabKey) echo $githubfinger echo $gitlabfinger if [[ $githubfinger == *"nThbg6kXUpJWGl7E1IGOCspRomTxdCARL

How to create Spring boot cloud config server

What is Spring boot cloud config server? Spring Cloud Config Server provides an HTTP resource-based API for external configuration (name-value pairs or equivalent YAML content). The server is embeddable in a Spring Boot application, by using the  @EnableConfigServer  annotation. Consequently, the following application is a config server In Simple terms, Spring boot cloud config server takes your application.yml or application.properties from your spring boot application and serve it over HTTP, and spring application which need to use it just need to delete the application.yml or application.properties and create one bootstrap.yml/properties and defined 2 simple properties  spring.application.name  and  spring.cloud.config.uri Create New java project using one of following instructions. Create project with Java, maven and Intellij Edit POM.xml, add following content in pom.xml First specify the packaging jar also add parent of this pom to be NOTE : You can lookup the latest version