Eclipse validation error with fontawesome-webfont.svg - eclipse

The Eclipse IDE validators complain about fontawesome-webfont.svg - which is part of the project http://fortawesome.github.io/
The content of element type "font-face" is incomplete, it must match "((font-face-src,(desc|title|metadata))|((desc|title|metadata)+,font-face-src,((desc|title|metadata))?))".
(EDIT: clarifying question)
Is the XML schema really being violated?
Is there an error in fontawesome-webfont.svg? How could you fix fontawesome-webfont.svg?
Is there an issue with with the Eclipse validator?
fontawesome-webfont.svg:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata></metadata>
<defs>
<font id="fontawesomeregular" horiz-adv-x="1536" >
<font-face units-per-em="1792" ascent="1536" descent="-256" />
<missing-glyph horiz-adv-x="448" />
<glyph unicode=" " horiz-adv-x="448" />
...
<glyph unicode="" horiz-adv-x="1792" />
</font>
</defs></svg>

This is the validator telling you your file is invalid. The message means that the contents of your font-face element have to match the sequence it relates. It can not be EMPTY. Try letting Eclipse generate a new XML file from the same DTD and you'll see what it needs to look like.

This is a problem related with the validator I guess, since the definition is right, if you check the definition of defs Element it allows an font element.
Also from mozilla sources:
Permitted content:
Any number of the following elements, in any order:
Animation elements
Descriptive elements
Shape elements
Structural elements
Gradient elements
and
<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view>
Normative document SVG 1.1 (2nd Edition)
So you can add to ignore in eclipse validator, please check this topic: How to exclude specific folders or files from validation in Eclipse?

Related

How would I handle RTF hyperlinks using Apache Tika in XSLT?

This question is a follow-up to: What are some methods to converting RTF text nodes in XML using XSLT 2 / Saxon HE 11.3?.
After implementing the answered solution, I ran the code against a large dataset. During the processing of all that data, an item in source RTF caused the application to error.
The error:
Error on line 11 column 92 of urn:from-string: SXXP0003 Error reported by XML parser: The element type "a" must be terminated by the matching end-tag "</a>".: The element type "a" must be terminated by the matching end-tag "</a>".
I took a look at the source xml, which contained several RTF HYPERLINK codes. Source:
<SPECORMETHOD>{\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset1 Times New Roman;}{\f2\fnil\fcharset1 WingDings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red128\green128\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl720\margr720\margt720\margb720\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.17;}{\stylesheet{\s1\li0\fi0\ri0\sb0\sa0\ql\vertalt\fs20 Normal;}{\s2\li0\fi0\ri0\sb0\sa0\ql\vertalt\fs20 Default Paragraph Font;}{\s3\li0\fi0\ri0\sb0\sa0\ql\vertalt\fs20\cf3\ul\sbasedon2 Hyperlink;}}{\pard\plain\plain\f1\fs36\par\pard\plain\plain\f1\fs36\par\plain\f1\fs28\tab 10\'94Flour Tortilla\par\plain\f1\fs28\tab Caesar \f1\b\i DIP\f1\i0 : {\field{\*\fldinst{HYPERLINK "..\\\\..\\\\SAUCES\\\\Dips\\\\Dip, Caesar.doc"}}{\*\fldtitle{..\\\\..\\\\SAUCES\\\\Dips\\\\Dip, Caesar.doc}}{\fldrslt{\f1\cf3\cs103\ul\cs3 Dip, Caesar.doc\plain\f1\fs28\b}}}\par\plain\f1\fs28\tab Ripped Romaine\par\plain\f1\fs28\tab Blackened Salmon julienne\par\plain\f1\fs28\tab Shaved Red Onion\par\plain\f1\fs28\tab Julienne Tomato\par\plain\f1\fs28\tab Grated Parmesan\par\plain\f1\fs28\tab Blackening spice: {\field{\*\fldinst{HYPERLINK "..\\\\..\\\\SPICE\\\\Blackening Spice.doc"}}{\*\fldtitle{..\\\\..\\\\SPICE\\\\Blackening Spice.doc}}{\fldrslt{\f1\cf3\cs103\ul\cs3 Blackening Spice.doc\plain\f1\fs28}}}\par\pard\plain\plain\f1\fs28\par\plain\f1\fs28 Method\par\plain\f1\fs28 Procedure Text \par\pard\plain\plain\f1\fs36\par}}</SPECORMETHOD>
For my purposes, the URL is not going to be a functional component, but for the sake of utility of this RTF conversion project, what might be needed to have the hyperlink codes work correctly, or to output them as text for reference? One way I can handle this is in the XSLT by intercepting the element, looking for the HYPERLINK code and replacing it with regular text.
The desired output for a hyperlink from this example would be (text only):
CAESAR DIP: ..\..\SAUCES\Dips\Dip, Caesar.doc
The only modification to the original code was in XSLT to do a check for an empty element when processing the <SPECORMETHOD>.
<xsl:choose>
<xsl:when test="string-length(SPECORMETHOD) > 0">
<rtf-as-xhtml>
<xsl:sequence select="tika:parse-rtf(SPECORMETHOD[string-length(.) > 0])"/>
</rtf-as-xhtml>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'[EMPTY]'"/>
</xsl:otherwise>
</xsl:choose>
I've built this project in Eclipse 2022-12 (4.26.0). It's a Maven project using Apache Tika 2.7.0, and Saxon HE 11.3, using Java SE 1.8. Special thanks to Martin H.
I have run your sample rtf through Tika and the supposed XHTML output is unfortunately not well-formed:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="X-TIKA:Parsed-By" content="org.apache.tika.parser.DefaultParser" />
<meta name="X-TIKA:Parsed-By" content="org.apache.tika.parser.microsoft.rtf.RTFParser" />
<meta name="Content-Type" content="application/rtf" />
<title></title>
</head>
<body><p />
<p />
<p> 10”Flour Tortilla</p>
<p> Caesar <b><i>DIP</i>: <a href="..\\..\\SAUCES\\Dips\\Dip, Caesar.doc">Dip, Caesar.doc</b><b /></b></p>
<p><b /> Ripped Romaine</p>
<p> Blackened Salmon julienne</p>
<p> Shaved Red Onion</p>
<p> Julienne Tomato</p>
<p> Grated Parmesan</p>
<p> Blackening spice: Blackening Spice.doc</p>
<p />
<p>Method</p>
<p>Procedure Text </p>
<p />
<p />
</body></html>
So the error is in the fragment <p> Caesar <b><i>DIP</i>: <a href="..\\..\\SAUCES\\Dips\\Dip, Caesar.doc">Dip, Caesar.doc</b><b /></b></p>.
I don't know for sure whether that is a problem with the input somehow not being proper rtf but it looks more like a bug in the Tia parser and ToXmlContentHandler.
I have raised the potential issue https://issues.apache.org/jira/browse/TIKA-3972
In the end, with the help of the Saxonica guys (thanks to Michael Kay and Norm Walsh) I have found a better (probably anyway) approach of using Saxon with the Tika parser; instead of using Tika's ToXMLContentHandler() and its toString() method result fed to Saxon's DocumentBuilder it is possible to pass a Saxon BuildingContentHandler to Tika's parser directly to get an XdmNode:
public static XdmNode parseRtfToHTML2(String rtf, Processor processor) throws IOException, SAXException, TikaException, URISyntaxException, SaxonApiException {
DocumentBuilder docBuilder = processor.newDocumentBuilder();
BuildingContentHandler handler = docBuilder.newBuildingContentHandler();
AutoDetectParser parser = new AutoDetectParser();
Metadata metadata = new Metadata();
try (InputStream stream = new ByteArrayInputStream(rtf.getBytes("utf8"))) {
parser.parse(stream, handler, metadata);
return handler.getDocumentNode();//docBuilder.build(new StreamSource(new StringReader(handler.toString())));
} catch (SaxonApiException e) {
throw new RuntimeException(e);
}
}
Using that approach, at least in a short test, no error is thrown for the hyperlink RTF example, see the updated project https://github.com/martin-honnen/SaxonTikaRtfTest1 for the code in more context.

JAXB binding XBRL element does not work

I am trying to generate localised XBRL classes with JAXB in Eclipse, but I have been getting an error:
[ERROR] Property "Title" is already defined. Use <jaxb:property> to resolve this conflict.
line 145 of http://www.xbrl.org/2003/xl-2003-12-31.xsd
[ERROR] The following location is relevant to the above error
line 151 of http://www.xbrl.org/2003/xl-2003-12-31.xsd
As the error suggests, an element and an attribute name conflicts. These are lines 145 and 151:
<element ref="xl:title" minOccurs="0" maxOccurs="unbounded" />
<attribute ref="xlink:title" use="optional" />
So I'd need to rename either (or both). This is what I've been trying to do - bind the element title to titleElement:
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xl="http://www.xbrl.org/2003/XLink"
schemaLocation="http://www.xbrl.org/2003/xl-2003-12-31.xsd">
<jxb:bindings node="//element[#ref='xl:title']">
<jxb:property ref="xl:titleElement"/>
</jxb:bindings>
</jxb:bindings>
This produces the following error, plus the original "title already defined" errors:
[ERROR] XPath evaluation of "//element[#ref='xl:title']" results in empty target node
line 6 of titleElementAttributeFixer.xjb
Suggestions to get it working?
EDIT: as helderdarocha suggested, my expression was wrong. I am new to XML and XPath, and it was a bit confusing since the element does not have the "xs:" namespace typed excplicitly. After I fixed that error, I got another one:
[ERROR] XPath evaluation of "//xs:element[#ref='xl:title']" results in too many (3) target nodes
As all the "ref" attributes need to be updated, I put the tag "multiple='true'" in the binding. Now I am getting the following error, and cannot figure out how to solve it:
[ERROR] cvc-complex-type.3.2.2: Attribute 'ref' is not allowed to appear in element 'jxb:property'.
Ideas for this? I do want to bind the contents in the attribute 'ref' for the element in question to another name.
I solved the problem after all by applying these SO questions:
JAXB fails to generate Java classes for XBRL
JAXB XJC Two declarations cause a collision. Customized binding cannot be honored
So after I solved the original problem, I had additional problems with objectfactory collisions, which I fixed as well. This is how my working bindings.xjb looks in general:
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
version="2.1">
<bindings schemaLocation="http://www.xbrl.org/2003/xl-2003-12-31.xsd"
node="//xsd:schema//xsd:element[#name='title']">
<property name="xlTitle"/>
</bindings>
<bindings schemaLocation="<local_dimension_file_D002>.xsd"
node="//xsd:schema//xsd:element[#name='AcceleratedDepreciation']">
<factoryMethod name="AcceleratedDepreciationD002"/>
</bindings>
...many more objectfactory collisions solved...
</bindings>
I hope this helps other XBRL/XML/JAXB newcomers to get started.
Your XPath expression is incorrect. Your bindings XML declares an xs prefix to qualify all XML Schema elements, but your XPath expression tries to find an element element from no-namespace since it's not qualified.
You should use:
<jxb:bindings node="//xs:element[#ref='xl:title']">
<jxb:property ref="xl:titleElement"/>
</jxb:bindings>

Can I use css3 in my Birt Report?

I want to use CSS3 in my Birt Report. But its showing the problem of CSS2.
A BIRT exception occurred.
Plug-in Provider:Eclipse BIRT Project
Plug-in Name:BIRT Model
Plug-in ID:org.eclipse.birt.report.model
Version:4.3.1.v201308301349
Error Code:Error.StyleSheetException.SYNTAX_ERROR
Error Message:There are some syntax errors inconsistent with CSS2.
So can anyone help me like how can I use my CSS3 file for my report. Is there any plugin or some steps then please let me know.
You can use css3 in html format only, by including the css file at viewtime. But it would be ignored by pdf & other formats.
For example, we are going to include this jquery-mobile theme at viewtime:
//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.2/jquery.mobile.min.css
To test this example, add a BIRT text element in the report, set type to HTML and include fragment below:
<button data-icon="star" data-theme="a" data-form="ui-btn-up-a" class=" ui-btn ui-btn-a ui-icon-star ui-btn-icon-left ui-shadow ui-corner-all">Button</button>
Run the report, you will see a great jqueryMobile-like css3 button!
You can also load the external files in the clientScripts of the report using head.js. For example, in a report's clientScripts > clientInitialize event, add:
head.js("http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js",
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css");
In the XML source, this appears as the last line in the following code.
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 4.4.0.v20150206-1039 Build <4.2.3.v20150206-1039></property>
<property name="units">in</property>
<method name="clientInitialize"><![CDATA[head.js("http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js", "http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css");
]]></method>

Xforms checkbox - replacing True / False with Y / N

I am writing a form (betterFORMs/Xforms) to be displayed to the user with a selection of checkboxes.
If a checkbox is empty the form should bind an "N" into the element. When ticked, a "Y".
I realise there are answers to this question already but I have tried all answered solutions with no luck.
The first solution I attempted to use is here - stackoverflow link
(the first solution looks good, but I have had more success with solution 2 as I am not using Orbeon)
The answer given is what I am looking for, but I am having trouble implementing this into my form. I am not using Xhtml or Orbeon and so the binding I use seems to be different to that used in the solution.) I have tried tweaking this code to fit into my form but I get a repetitive error from the xml parser every time I load the page - but it doesn't point me to anywhere related to the new code.
The next solution I have tried is found here - stackoverflow link
This answer has had the best results in my code because the checkbox values change to N when not used and when they are deselected. The problem I have with this solution is that the Y set in the form element is contained in braces - [].
output example:
<addressProof>N</addressProof><other>[Y]</other><otherText>_text_</otherText>
Here is a snippet of my form:
model:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/2002/06/xhtml2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<xsl:output method="xml" />
<xsl:template match="/">
<xforms:model id="documentsChecklist">
<xforms:instance>
<actionform xmlns="">
<xforms:model id="documentsChecklist">
<xforms:instance>
<actionform xmlns="">
<detail>
<other></other>
<otherText></otherText>
</detail>
</actionform>
</xforms:instance>
<xforms:bind id="other" nodeset="/actionform/detail/other" calculate="choose(. = 'Y', ., 'N')"/>
<xforms:bind nodeset="/actionform/detail/otherBox" relevant="/actionform/detail/other ='Y'" />
</xforms:model>
form:
<div id="formBody"><br />
<xforms:select bind="other" appearance="full" align="right">
<xforms:item>
<xforms:label>Other</xforms:label>
<xforms:value>Y</xforms:value>
</xforms:item>
</xforms:select>
<xforms:input ref="/actionform/detail/otherText">
<xforms:label>Please specify:*</xforms:label>
</xforms:input>
</div>
</xsl:template>
</xsl:stylesheet>
Why does the checkbox value now get set to "[Y]" instead of "Y"? (Could it be something to do with an Array?) Thanks.
PS. I know I could do this using a boolean for each checkbox, with the checkbox value corresponding to the boolean, which in turn updates the bind value. I would rather not have to have a big block of boolean elements and binds as I have a large amount of check boxes. this solution has an example here - stackoverflow link
A select control allows you to select more than one item and I wonder if it is why the XForms implementation you are using is adding square brackets (according to specifications selected values have to be separated by a space character, which is not always very convenient by the way).
I am afraid that XForms 1.1 and XForms 2.0 require to use extra intermediate nodes and bindings. It would be useful to be able to add 2 XPath expressions for bindings: one to convert node value to control value and the other one back from control value to node value.
As a workaround, I use another extension in XSLTForms: XSLT stylesheets for converting instances.
-Alain

How do I update an Eclipse template variable on the fly?

I've added the following new Eclipse template via extension point. It simply adds a template for a sample testTag tag.
<!-- Add code template -->
<extension point="org.eclipse.ui.editors.templates">
<template autoinsert="true"
contextTypeId="html_tag"
description="[Description] Template populated by Snippet values ***"
id="org.eclipse.jst.jsf.ui.newHtmltag"
name="testTag">
<pattern>
<![CDATA[
<testTag style="background: ${color}"></testTag>
]]>
</pattern>
</template>
<resolver
contextTypeId="html_tag"
type="src"
class="TestTagTemplateVariableResolver">
</resolver>
</extension>
What I'd cannot figure out is how to change the value of the $(color) variable at runtime. More specifically, when the user presses Ctrl + Space (or the equivalent for content-assist) and types in "testTag" and presses Enter -- instead of the "color" placeholder text, I'd like it replaced by some other text value I have in another class. How do I do this?
This email chain from 2004 says it might not be possible:
the Java editor chooses not to respect resolvers contributed to its two context types ('java' and 'javadoc'), but only recognizes the built-in resolvers.
The html editor you are working with may have a similar restriction.