w3c

How to preserve newlines in CDATA when generating XML?

為{幸葍}努か 提交于 2019-12-04 05:57:33
I want to write some text that contains whitespace characters such as newline and tab into an xml file so I use Element element = xmldoc.createElement("TestElement"); element.appendChild(xmldoc.createCDATASection(somestring)); but when I read this back in using Node vs = xmldoc.getElementsByTagName("TestElement").item(0); String x = vs.getFirstChild().getNodeValue(); I get a string that has no newlines anymore. When i look directly into the xml on disk, the newlines seem preserved. so the problem occurs when reading in the xml file. How can I preserve the newlines? Thanks! I don't know how you

Validate markup of password-protected sites with W3C

跟風遠走 提交于 2019-12-04 05:29:38
I have an online app that I am wanting to validate the HTML markup of against the W3C validator. Problem is users need to log in first to access them. How do I go about validating these pages? With this html validator extension . Or by Ctrl-U, copy-paste into the w3c page. You have to run the service they provide on your server: http://validator.w3.org/docs/install.html Thats what we've done, works great. I think it's best practice to be validating your sites source when it's in development not when its in production... Treat this just like running unit tests. You shouldn't have markup errors

Perl CGI with HTTP Status Codes

坚强是说给别人听的谎言 提交于 2019-12-04 03:51:25
问题 I have the following validation in a CGI script that will check for the GET method and return a 405 HTTP status code if the GET method is not used. Unfortunately it is still returning a 200 Status OK when using POST or PUT. my ($buffer); # Read in text $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "GET") { $buffer = $ENV{'QUERY_STRING'}; } else { $cgi->$header->status('405 Method Not Allowed') print $cgi->header('text/plain'); } I am still new to CGI programming so I

What is the correct way to mark up the author of a (block)quote?

老子叫甜甜 提交于 2019-12-04 03:48:51
问题 I'm trying to figure out the correct way to add attribution for a quote. It seems the internet is divided about the correct way. Html5Doctor says the following: <blockquote> <p>A quote...</p> <footer> <a href="source of the quote">Author of the quote</a> </footer> </blockquote> But they also state that eventually the figured out that using the footer element wasn't actually valid. They currently still do not provide the 100% correct way. Their latest update was on 2012-02-14. No further

Web Speech API Custom Words

点点圈 提交于 2019-12-04 03:11:08
I read through the W3C docs on this and I'm thinking that custom words come from custom grammar, but I tried going to this demo and in the console entered the following javascript: recognition.grammars.addFromString('foo'); Which ran fine and recognition.grammars[0].src returns: "data:application/xml,foo" Note : 'foo' is not the word I'm interested in, but the word I'm interested in isn't an english word, using 'foo' for the example. When I speak my custom word normally, it thinks I'm saying something else (which makes sense). I'm using 'foo' here to protect my brand :) So what I want is to be

websocket for binary transfer of data & decode

非 Y 不嫁゛ 提交于 2019-12-04 02:57:40
I was reading through the specification and many examples about usage of websockets. Almost all of them talk about UTF-8 or ascii message transfer using websockets. The latest Hybi websocket spec requested support for binary transfer. REQ 6 in hybi spec Also i read somewhere that chrome supports hybi. But latest release Chrome 7.0 works only when draft-hixie is selected in pywebsocket config. Does any browser have support for hybi spec? Even if it is dev, its ok. It may be a while before non-UTF-8 (i.e. binary) encoding is supported in WebSockets. I suggest using base64 encode/decode on the

is -negative margin or padding invalid CSS according to W3C?

被刻印的时光 ゝ 提交于 2019-12-04 00:32:33
问题 is -negative margin or padding are invalid CSS aaccording to W3C ? 回答1: According to Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification - 8.4 Padding properties, negative margin values are valid, negative padding values are not: Unlike margin properties, values for padding values cannot be negative 来源: https://stackoverflow.com/questions/1623163/is-negative-margin-or-padding-invalid-css-according-to-w3c

Can a td be inside a td

人走茶凉 提交于 2019-12-03 22:44:21
It may be a nonsense question, and I know we have to follow standards as much as possible. But can <td> be a direct child of another <td> , like this: <td class="parent"> <td class="child"> <!-- Some info --> </td> </td> Or it's obligatory to create another <table> with a new <tr> before adding the <td> , which can become heavily populated with table tags and become clustered... not directly but you could place table inside td <td class="parent"> <table><tr> <td class="child"> <!-- Some info --> </td> </tr></table> </td> No, <td> may not be a child of a <td> . A <td> may only be a child of a

Javascript API to explicitly add micro tasks or macro tasks

和自甴很熟 提交于 2019-12-03 22:00:54
问题 From my global understanding of how javascript virtual machines works, i can clearly see that the concept of micro task / macro task play a big role. Here is what i understand about that: A VM 'turn' is the fact of pulling ONE macro task out of the VM macro task queue, and execute it. During a VM turn, micro tasks can be added to the micro tasks queue of the current macro task. Micro tasks can push other micro tasks to the micro tasks queue of the current macro task. A VM turn will end when

Twitter's method for streaming API on w3c

允我心安 提交于 2019-12-03 21:49:03
I am interested in building a streaming API (read-only) similar to what Twitter has built. Data will only be going unidirectional, from server to client. Clients do not have to be web browsers but merely anything that can technically keep a persistent HTTP connection open. I'm fairly certain what Twitter's streaming API is doing is not WebSockets and not COMET. I was wondering if the technology/strategy that they deployed is one with a w3c specification that one can study. I don't necessarily see any links to their strategy on W3C - so it might be something "custom" but any point in the right