SAXParseException when element in html5 is selfing-closing tags ( </link> ) - Spring boot 1.1.4 #1270

Closed
phouverney opened this Issue Jul 18, 2014 · 6 comments

Comments

Projects
None yet
5 participants
@phouverney

When we enable thymeleaf and if the html5 page is with self-closed tag, i get exception:

org.xml.sax.SAXParseException: The element type "link" must be terminated by the matching end-tag "</link>".
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1748)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2957)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
    at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.doParse(AbstractNonValidatingSAXTemplateParser.java:209)
    at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplateUsingPool(AbstractNonValidatingSAXTemplateParser.java:133)
    at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplate(AbstractNonValidatingSAXTemplateParser.java:116)
    at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:277)
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104)
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060)
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011)
    at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335)
    at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1221)
@philwebb

This comment has been minimized.

Show comment
Hide comment
@philwebb

philwebb Jul 18, 2014

Member

You probably need to ask someone from Thymeleaf about this. Spring Boot isn't doing anything special here. Their manual covers some of the templating options here: http://www.thymeleaf.org/doc/usingthymeleaf.html#what-kind-of-templates-can-thymeleaf-process.

You might want to post the question on stackoverflow.

Member

philwebb commented Jul 18, 2014

You probably need to ask someone from Thymeleaf about this. Spring Boot isn't doing anything special here. Their manual covers some of the templating options here: http://www.thymeleaf.org/doc/usingthymeleaf.html#what-kind-of-templates-can-thymeleaf-process.

You might want to post the question on stackoverflow.

@phouverney

This comment has been minimized.

Show comment
Hide comment
@phouverney

phouverney Jul 18, 2014

I resolved the problem.

Set the property "spring,thymeleaf.mode" to "LEGACYHTML5".

spring.thymeleaf.mode=LEGACYHTML5

And in the pom.xml, add the dependency:

<dependency>
   <groupId>net.sourceforge.nekohtml</groupId>
   <artifactId>nekohtml</artifactId>
   <version>1.9.21</version>
</dependency>

I resolved the problem.

Set the property "spring,thymeleaf.mode" to "LEGACYHTML5".

spring.thymeleaf.mode=LEGACYHTML5

And in the pom.xml, add the dependency:

<dependency>
   <groupId>net.sourceforge.nekohtml</groupId>
   <artifactId>nekohtml</artifactId>
   <version>1.9.21</version>
</dependency>
@yoonsubKim

This comment has been minimized.

Show comment
Hide comment
@yoonsubKim

yoonsubKim Jan 16, 2016

@phouverney thanks to your advice.
I resolved this problem.

@phouverney thanks to your advice.
I resolved this problem.

@mroodschild

This comment has been minimized.

Show comment
Hide comment

mroodschild commented Jul 5, 2016

@phouverney Thanks!!!

nasky987 added a commit to nasky987/Spring_Boot that referenced this issue Dec 31, 2016

# 스프링부트 시작하기 - Thymeleaf 오류 수정
- Thymeleaf로 뷰 템플릿 구현후 실행시, html5형식일 경우 오류 발생
- SAXParseException when element in html5 is selfing-closing tags ( </link> )
- spring-projects/spring-boot#1270
- 스프링 설정 추가 및, 의존성 추가하여 해결

@spring-projects spring-projects deleted a comment from Jelly-J Sep 18, 2017

snicoll added a commit to snicoll/spring-boot that referenced this issue May 31, 2018

snicoll added a commit to snicoll/spring-boot that referenced this issue Jun 1, 2018

snicoll added a commit to snicoll/spring-boot that referenced this issue Jun 4, 2018

philwebb added a commit that referenced this issue Jun 4, 2018

Add saaj and jax-ws dependencies for Java 9 build
Add test dependencies for saaj-impl and jax-ws since Java 9+ no longer
includes them.

See gh-1270
@bigalnz

This comment has been minimized.

Show comment
Hide comment
@bigalnz

bigalnz Jun 25, 2018

I am in Springboot 2.0.3 and getting this issue. What is the fix please?

bigalnz commented Jun 25, 2018

I am in Springboot 2.0.3 and getting this issue. What is the fix please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment