Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Jul 18, 2014 · 6 comments

Comments

@ghost
Copy link

@ghost ghost commented Jul 18, 2014

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
Copy link
Member

@philwebb 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.

@ghost
Copy link
Author

@ghost ghost commented 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>
@yoonsubKim
Copy link

@yoonsubKim yoonsubKim commented Jan 16, 2016

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

@mroodschild
Copy link

@mroodschild mroodschild commented Jul 5, 2016

@phouverney Thanks!!!

nasky987 added a commit to nasky987/Spring_Boot that referenced this issue Dec 31, 2016
- 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 test dependencies for saaj-impl and jax-ws since Java 9+ no longer
includes them.

See gh-1270
@bigalnz
Copy link

@bigalnz 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.