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
Labels
status: invalid An issue that we don't feel is valid

Comments

@ghost
Copy link

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)
@ghost
Copy link
Author

ghost commented Jul 18, 2014

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

@ghost
Copy link
Author

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>

@rupert-kim
Copy link

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

@mroodschild
Copy link

mroodschild commented Jul 5, 2016

@phouverney Thanks!!!

@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 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
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants