How to check tags in xhtml on facelet-taglib

What I'm trying to do is write a maven plugin that will validate xhtml files, so if any of the tags have attributes that do not belong, are spelled incorrectly or if there are any other validation errors, the assembly will fail.

We are using Primefaces 6.0 and we would like to enable verification of these tags. The problem is that in the jarface Primefaces file I can only find the facelet-taglib file (for Primefaces 6.0 in the META-INF / primefaces-p.taglib.xml folder), and I don't know how to check the xhtml file for the -taglib face file.

I know how to write Java code to verify the use of schema files, but I could not find any Java tag verification examples in my xhtml file against facelet-taglib, specifically the taglib taglib file in Primefaces format.

I tried loading the taglib file as shown below.

SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
InputStream stream = ..[file primefaces-p.taglib.xml]..;
Schema schema = schemaFactory.newSchema(new StreamSource(stream));  

But I just get the following error:

org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 39; s4s-elt-character: characters without spaces are not allowed in schema elements other than "xs: appinfo" and "xs: documentation". Saw ' http://primefaces.org/ui '.

I thought maybe I'm using the wrong XMLConstants variable, but I'm not sure which one to use, or if this will work.

: XML Maven Plugin, facefaces-taglib. - , taglib, !

!

+4
1

Taglib - , . IDE taglib , , -.

+1

Source: https://habr.com/ru/post/1654171/


All Articles