Since 2007, we have used a local DTD to add a tag-pair and to define several attributes for PayPlal and google++. This is the local DTD...
<!ELEMENT havindex EMPTY>
<!ATTLIST havindex id CDATA #REQUIRED>
<!ENTITY % head.misc "(script|style|meta|link|object|isindex|havindex)*">
<!ENTITY % html.transitional PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- =========== 3 div attributes for googleplus share button ====== -->
<!ATTLIST div data-action CDATA #IMPLIED>
<!ATTLIST div data-annotation CDATA #IMPLIED>
<!ATTLIST div data-height CDATA #IMPLIED>
<!ATTLIST div data-id CDATA #IMPLIED>
<!-- =========== 2 script attributes for paypal support ========== -->
<!ATTLIST script data-pp-pubid CDATA #IMPLIED>
<!ATTLIST script data-pp-placementtype CDATA #IMPLIED>
%html.transitional;
... We recently converted the entire site to https (not sure that has anything to do with it, but just as an aside - checkout stuff was always htts, of course) and all of a sudden, it seems that the local DTD breaks the W3C validation - it fails immediately on the DTD. When I use a standard DTD, of course, the new tag and attributes are seen as validation errors. Any thoughts on how to use the local dtd or to define the attributes, at least?
The error is "500 Can't connect to www.WHATEVER-SITE.com:443" ... the site is https and on 443.
Anyway - TIA for any suggestions.
Related
Does XForms have a mechanism for manipulating attributes of the resultant HTML?
I guess I mean emitting HTML dynamically and setting the attributes as part of that.
I know that using a xf:repeat - you can effectively emit HTML elements, but I can't work out if this would stretch to attributes?
I'm using XSLTForms as the implementation - so maybe this support hooks for Javascript to do this if there isn't a built-in way?
The reason to ask specifically - I would like to work with the audio element (and some other HTML5 elements).
Yes, it is named AVT for Attribute Value Template. As in XSLT, just wrap XPath expressions into curly braces like in <div class="proto{$myclass}">.
Thanks to the help from Alain Couthures - I was able to put together the following. Sharing in case others find it interesting.
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<title>Podcast Player</title>
<xf:model>
<xf:instance xmlns="">
<data>
<url/>
</data>
</xf:instance>
<xf:instance id="feed" src="https://podcasts.files.bbci.co.uk/b05qqhqp.rss"/>
</xf:model>
<style><![CDATA[
* { font-family: arial; background-color:black; color: white }
]]></style>
</head>
<body>
<h1><xf:output ref="instance('feed')/channel/title"/></h1>
<blockquote><xf:output ref="instance('feed')/channel/description"/></blockquote>
<xf:select1 ref="url" appearance="full">
<xf:itemset nodeset="instance('feed')/channel/item">
<xf:label ref="title"/>
<xf:value ref="enclosure/#url"/>
</xf:itemset>
</xf:select1>
<audio src="{url}" controls="true"/>
</body>
</html>
The relevant bit to this post is the "audio" tag and in particular the "{url}" attribute template.
Here's a screenshot:
For those that wish to try this example, you'll need XSLTForms : https://en.wikibooks.org/wiki/XSLTForms , other XForms implementations are available.
Note: save the file with the extension '.xhtml' and place behind a webserver of your choice.
For instance using test HTTP servers: php, python etc.
Loading XML document with unknown entity results in error:
$ perl -MXML::LibXML -lE 'XML::LibXML->load_xml(string => "<doc> </doc>");'
:1: parser error : Entity 'nbsp' not defined
<doc> </doc>
^
How to make XML::LibXML parse that XML document and recognize and replace it with Unicode non-breaking-space character?
is not a builtin/predefined XML entity. It thus needs to be defined by the particular schema of the XML document.
For example, if you are parsing XHTML, you should have one of the following at the top to define all XHTML entities:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
or
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
If the DTD for your schema doesn't define , you can use an actual non-breaking space or .
Note that using the above DOCTYPE means that parsing the document requires XML::LibXML to fetch xhtml1-strict.dtd or xhtml11.dtd every time you parse such a document that mentions them in this manner, which is a waste of resources. Adding the following to your program avoids that:
use XML::Catalogs::HTML -libxml;
Note that the following DOCTYPE directives are sufficient when using XML::Catalogs::HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
or
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN">
Pro tip: Provide the no_network option to the XML::LibXML parser to ensure that it doesn't accidentally fetch DTDs from the internet. This doesn't prevent XML::Catalogs::HTML from working, so it's a great combination!
XML includes only a few entities. You need to add a DTD that includes the entity. Untested:
<!DOCTYPE just_make_it_work [
<!ENTITY nbsp " ">
]>
<doc> </doc>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<doc> </doc>
I have a jsp page which takes up first name and last name in chinese language. I am using the struts framework.
I need to pass the first name and last name from the JSP to servlet in terms of unicode characters.
I am doing the following changes:
JSP Changes:
1) <%# page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
2) meta content="content-type" content="text/html; charset=utf-8" in the header,
The filter which is called before the action servlet, I have used the following code:
request.setCharacterEncoding("UTF-8");
response.setContentType("UTF-8");
This did not work, the unicode characters which are passed are incorrect, or something not readable.
Considering the MVC framework already creates the request object by the time it reaches the filter,
I modified the JSP to include the following lines of code
<%# taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
< fmt:requestEncoding value="UTF-8" />
< fmt:setLocale value="zh_CN"/>
None of the above changes have worked. Please help me to get the correct unicode characters in the action class.
IS there any modification i need to make in the config files.
You also need to set the Bundle basename.
<fmt:setBundle basename = "[base_file_name_of_language_file]"/>
where [base_file_name_of_language_file] is equal to whatever name you set your language properties file name to be.
For example, the "MyLanguageFileName" in this file name :
MyLanguageFileName_zh_CN.properties
hey everyone am trying to add my title tag but every time i try to put it in the format of Company name| Primary keyword and Secondary keyword i get parsing error which is ''Error parsing XML, line 516, column 29: Element type "ShareFreeTemplates" must be followed by either attribute specifications, ">" or "/>" and here is my html code
<b:include data='blog' name='all-head-content'/>
<!--::::::::::: Block2: Output Index Title,keywords,decription and Post Title,description -->
<!-- Post/Archive Page -->
<b:if cond='data:blog.pageType != "index"'>
<title><data:blog.pageName/></title>
<!-- Index Page -->
<b:else/>
<title><ShareFreeTemplates|Free After Effects Templates And-Tutorials /></title>
<meta content='after effects free templates, templates, after effects project files, free download' name='keywords'/>
</b:if>
if somebody can edit that title tag to give me no errors i want it like that ''Free After Effects Templates and Project Files| ShareFreeTemplates'' and thx in regards
This is how the title tag works in standard HTML coding.
<title> insert words here </title> are the tags used. and then you insert the words in between the two tags like so
<title>ShareFreeTemplates|Free After Effects Templates And-Tutorials </title>
you dont need to encapsulate your title in another pair of tags.
<title><ShareFreeTemplates|Free After Effects Templates And-Tutorials /></title>
^ ^^
//remove the characters where the arrows are pointing at
I am asking this question to test the validity of my HTML. I can very well try this out (and I have, and it's possible), but I'm simply curious whether or not this is allowed in HTML. If not, how can one simulate a div or span element inside a form? Using blockquote?
form is a block-level element in HTML. Typically, block-level elements allow both block-level and inline children. Both div and span are valid children of form.
There are a ton of resources online to learn more about this topic, for example:
http://www.w3.org/TR/html4/struct/global.html#h-7.5.3
It may also benefit you to read about the box model, as this is one of the most fundamental concepts of web design/development.
http://www.w3.org/TR/CSS2/box.html
Yes, you can. And it is also "officially allowed" by the XHTML standard, if you look into the XHTML XSD, you will find
<xs:complexType name="form.content">
<xs:annotation>
<xs:documentation>
form uses "Block" excluding form
</xs:documentation>
</xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="block"/>
<xs:group ref="misc"/>
</xs:choice>
</xs:complexType>
"block" encompasses div and "misc" contains span. The "documentation" part points out one particular thing you are not allowed to do: nest a form within another one.
Yes it's valid and you can use any number of divs, spans or blockquotes inside a form. You can always use W3C Markup Validation Service to check your html.
Eg:
<body>
<form id="Form1">
<div id="wrap">
<div id="content-wrap" class="content-wrap-admin">
</div>
</div>
</form>
</body>
I must correct emboss' answer.
In the XHTML 1.0 Strict DTD that he quotes, the group misc does not refer to inline elements. Instead, it refers to the following 4 elements: noscript, ins, del and script.
<!ENTITY % misc.inline "ins | del | script">
<!ENTITY % misc "noscript | %misc.inline;">
So to answer the question, XHTML 1.0 Strict does not allow span elements inside form elements. You'll need to wrap them inside block elements such as p, dip or fieldset.
This is not the case with XHTML 1.0 Transitional, though. Indeed, the DTD indicates that inline elements are allowed inside form elements:
<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
For reference: XHTML 1.0 - DTDs
Yes.
Did you even try this yourself?