Custom tld function validation in eclipse - eclipse

I am working in eclipse (Ganymede 3.4.1) and have created a ctl TLD :
<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd">
<tlib-version>2.0</tlib-version>
<short-name>Name</short-name>
<function>
<name>readExtendedField</name>
<function-class>uk.newsint.advertising.wsconnection.ConnectionManager</function-class>
<function-signature>
java.lang.String readExtendedField( uk.newsint.advertising.aws.ExtendedFields , java.lang.String )
</function-signature>
</function>
</taglib>
and referenced it in my jsp (excerpts):
<%# taglib uri="/WEB-INF/appUtils.tld" prefix="au"%>
<c:forEach items="${myAdsForm.result.resultList}" var="lin">
<tr>
<td>${au:readExtendedField(lin,"EXTRDATE")}</td>
</tr>
</c:forEach>
Eclipse is giving me an EL Sytax error on the this section${au:readExtendedField(lin,"EXTRDATE")} and assigning it to the first quote and the closing bracket {" and )}.
The expression works fine under tomcat but eclipse warns me when I try to commit to the repository and of course shows errors in the problems tab.
Has anyone else suffered this and does anyone have a fix?

You've probably already found your answer by now, but in case you haven't (and to enlighten anybody else that comes across this page, but your custom tags should be treated as tags, not merely elements inside another tag body. It should be <au:.../>

Related

Custom tag with variables

I am trying to use custom tag with variables.
for eg)
<c:forEach var="test" items="itemstest">
${test}
</c:forEach>
In the above code i am able to access the test value inside the <c:forEach> tag.
I need to create a custom tag with similar functionality.
I have got info from the oracle docs http://docs.oracle.com/javaee/5/tutorial/doc/bnamu.html under title Declaring Tag Variables for Tag Handlers.
Can anyone pls help me to implement the same with example.
Hi i have solved it in the following way
class: test.java
public void doTag() throws JspException, IOException {
getJspContext().getOut().flush();
//any method or operation
super.doTag();
getJspContext().setAttribute(variable, "Hello");
}
Create getter setter for variable
tld file:
<tag>
<name>test</name>
<tag-class>com.org.test</tag-class>
<body-content>empty</body-content>
<attribute>
<name>inputValue</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>variable</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
jsp file:
<%# taglib uri="/WEB-INF/tld/tldfilename.tld" prefix="tag" %>
<tag:test inputValue="hello" variable="testValue"/>
${testValue}
For something so simple, you may be better off using tag files, which makes it easy to create a tag library using some small additions to the normal jsp syntax (and is part of the standard)
http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPTags5.html
A "tag with variables" is done using an attribute declaration, JSP code is quite simple:
<%#tag pageEncoding="utf-8" %>
<%-- dont forget to add declaration for JSTL here -->
<%#attribute name="test" type="java.lang.String" required="true" %>
<c:forEach var="test" items="itemstest">
${test}
</c:forEach>
See the linked documentation on whre to put and name the files to make them accessible within you own jsp files.

Eclipse validation error with fontawesome-webfont.svg

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?

netbeans, xml autocomplete for attributes fails for default namespace

I've defined two namespaces: beans, aop.
If you cut & paste into a Netbeans the tag that i've written below, and you try to edit a tag inside beans:beans you should observe this behavior:
<beans:import />
typing this the autocomplete assists you, and after the element name, it proposes the list of attributes (in this case just one).
<aspectj-autoproxy />
typing this the autocomplete dosn't propose the list of attributes (there are two attributes: proxy-target-class, expose-proxy)
It happens for the attributes of the default namespace's elements.
Is it a bug? Am I doing something wrong?
I've tested on NB 6.9 and NB 7.0
thanks in advance
<beans:beans
xmlns:beans ="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
try here
</beans:beans>

How to add a colorized HTML code snippet in Sandcastle documentation?

I am using the Sandcastle Help File Builder and would like to include colorized HTML code snippets in the "Conceptual Content". Is this possible and if so, how?
I have tried <code>, <codeExample>, and <sampleCode language="HTML" />.
The best result so far is to HTML-encode the sample HTML and place it in a .snippets file like so.
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="HTML">
<span>My Html</span>
</sampleCode>
</item>
</examples>
Then reference it in the .aml file.
<codeReference>htmlSnippet</codeReference>
I would prefer to have it colorized, but I can't figure out a way to add the formatting.
According to the MAML Guide, the proper way of doing this is to use a <code> tag with a CDATA section:
<code language="xml" title="Example Configuration">
<![CDATA[
<span>My Html</span>]]>
</code>
The contents of the CDATA section will be treated as a literal string, and indentation will be preserved.
I know this is old, but Sandcastle supports html as xml. I figured I should comment in case anyone else comes across this post as I did.
This should work:
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="xml"><!CDATA[[
<span>My Html</span>
]]>
</sampleCode>
</item>
</examples>
If you're using Sandcastle Help File Builder, you may create your own syntax parser as described here and here, although xml is available by default... using the XAML filter's generator, which is defined here if you want to look at the config:
<generator type="Microsoft.Ddue.Tools.XamlUsageSyntaxGenerator"
assembly="{#SandcastlePath}ProductionTools\SyntaxComponents.dll">
<filter files="{#SandcastlePath}Presentation\Shared\configuration\xamlSyntax.config" />
</generator>
According to the SHFB documentation for the Code Block Component, you should be able to just use the <code>.
I got it to work without a problem; here's what I did:
test.html
<html>
<head>Something!</head>
<body>
<h1>Heading</h1>
<!-- #region myhtml -->
<p>Paragraph</p>
<div>Div for <strong>Good</strong> <em>measure</em>.</div>
<!-- #endregion -->
</body>
</html>
SomethingorOther.aml
<code language="html" source="../Examples/test.html" region="myhtml" />
Result:
Please note that in the preview, your sample will appear as unhighlighted XML, but when you build the documentation, everything should like just fine.

RSS Feed created using Zend_Feed - firefox prompts to download not display as RSS

I've created an RSS feed using Zend_Feed.
It seems to have worked in that the resulting XML looks good. My problem is that Firefox won't recognise it as an RSS feed and instead prompts me to download the raw XML.
Trying it in IE gives the error "this feed contains code errors" with the following extra info:
Invalid xml declaration.
Line: 2 Character: 3
< ? xml version="1.0" encoding="UTF-8" ?>
Any help greatly appreciated.
The xml-declaration must be on the absolute first line in the output. I.e. no blank lines or spaces before the xml-declaration tag.
This is valid:
<?xml version="1.0" encoding="UTF-8" ?>
This is not:
<?xml version="1.0" encoding="UTF-8" ?>
Check whether <?xml version="1.0" encoding="utf-8"?> is the first line in the feed file. No empty lines or spaces!
If PHP is spitting out any notices/warnings or such, those will malform the feed. Try setting error_reporting to zero before the feed is sent to test:
error_reporting(0);
good rule of thumb when using php class files and such, never ?> your class files. Only use ?> in template-type files where you are going to have regular output afterwards. All of the major packages do this now for exactly the above reasoning.