Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
On Fri, 14 Jan 2011 00:26:35 -, Tjerk Meesters wrote: What I would like, therefore, is either: a) a way to define my own namespace programmatically before parsing starts b) a way to relax the parser so that namespace checking is not enforced, like how tal ns is also not enforced If you want to have behaviour of TAL namespaces, then PHPTAL_Dom_Defs::registerNamespace() would do that, but that probably requires too much irrelevant code just to fake a declaration. You could wrap the file in in PHPTAL_PreFilter::filter() (it's run before the parser starts). I'm also considering making parser configurable, so you could just replace PHPTAL's standard parser and use your own syntax (XML5, HTML, HAML or whatever you like). I'm not decided on details yet: how to select which parser is used, especially in macros (file extension, doctype, some config vars?). How to load it lazily (probably PluginLoader class should be finished for that, or maybe PHPTAL should just have callback function before reparse?). c) only do namespace checks on the output That's a tough one, as it could potentially depend on runtime behavior and prefixes across files, so don't hold your breath for it. -- regards, Kornel Lesiński ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
On Jan 14, 2011 1:17 AM, "Kornel Lesiński" wrote: > > On Thu, 13 Jan 2011 10:22:52 -, Tjerk Meesters < tjerk.meest...@gmail.com> wrote: > >> Here's the problem; it throw an error, saying that the myns namespace >> is not defined ... is that expected? > > > Yes (if I understood correctly what you're trying to do). > > PHPTAL checks correctness of namespace declarations from perspective of source files, not the output (it probably should check output too, but that's a harder problem). I would say it has to only check on the full output, but I also realize that might be tougher ;) > > So if a file, looked at in isolation (before macros are executed), doesn't have required xmlns, that's an error according to XML. > > > I have a mixed feelings about enforcing XML strictness. It's sometimes annoying, OTOH it's a bit dishonest to call TAL an XML language when it doesn't play by XML rules. Essentially I'm using my own namespaces to do on-the-fly replacements, after which the namespaced element is gone, much like how the tal: is gone after parsing the template, i.e. it only has meaning before that. What I would like, therefore, is either: a) a way to define my own namespace programmatically before parsing starts b) a way to relax the parser so that namespace checking is not enforced, like how tal ns is also not enforced c) only do namespace checks on the output > > -- > regards, Kornel Lesiński > > > ___ > PHPTAL mailing list > PHPTAL@lists.motion-twin.com > http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
On Thu, 13 Jan 2011 10:22:52 -, Tjerk Meesters wrote: Here's the problem; it throw an error, saying that the myns namespace is not defined ... is that expected? Yes (if I understood correctly what you're trying to do). PHPTAL checks correctness of namespace declarations from perspective of source files, not the output (it probably should check output too, but that's a harder problem). So if a file, looked at in isolation (before macros are executed), doesn't have required xmlns, that's an error according to XML. I have a mixed feelings about enforcing XML strictness. It's sometimes annoying, OTOH it's a bit dishonest to call TAL an XML language when it doesn't play by XML rules. -- regards, Kornel Lesiński ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
Hi, Just bumped into something similar. I'm using a so-called skeleton.html (a big macro starting with and defining multiple slots for scripts, styles, content, popups, etc.). Let's say that I define xmlns:myns="http://example.org/myns"; in the of my skeleton.html and then one of my slots gets filled by a tag Using a PreFilter I can then expand the tag into ... something fancy ;-) Here's the problem; it throw an error, saying that the myns namespace is not defined ... is that expected? Best, Tjerk 2010/1/27 Kornel Lesiński : > On 27-01-2010 at 08:39:36 Murat Çorlu wrote: > >> Is there a simple way to define a custom namespace globally for all of our >> templates like tal and metal namespaces? > > No, and I'm not planning to add it. TAL namespaces are already in violation > of the XML spec. > > -- > regards, Kornel > > ___ > PHPTAL mailing list > PHPTAL@lists.motion-twin.com > http://lists.motion-twin.com/mailman/listinfo/phptal > -- -- Tjerk ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
It's not that bad to impose some guidelines :) PHPTAL is that simple and well-working because it discourages "backdoors" and "workarounds" that make code dirty ;) That's what I, for example, liked about this library. It forces people who write "dirt code" to be a bit cleaner... Many people who worked with me told me it's a limit of PHPTAL, but I don't think so... Kornel says he likes things "done the right way"... Maybe there's a quicker way, but I prefer the right way before forgetting some stuff behind me :) It's a good practice to put your namespaces in all your files as you do with your C++/PHP5.3/Java files, don't you think so? 2010/1/30 romtek > 2010/1/27 Kornel Lesiński > > On 27-01-2010 at 08:39:36 Murat Çorlu wrote: >> >> Is there a simple way to define a custom namespace globally for all of >>> our templates like tal and metal namespaces? >>> >> >> No, and I'm not planning to add it. TAL namespaces are already in >> violation of the XML spec. >> > > Not that I need this feature for the time being, but what's the downside of > violating the specs? Nobody is going to fine or imprison you for it. PHPTAL > is an autonomous library. > > ___ > PHPTAL mailing list > PHPTAL@lists.motion-twin.com > http://lists.motion-twin.com/mailman/listinfo/phptal > > -- Marco Pivetta - Ocramius Aethril Sent from Padova, PD, Italy ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
2010/1/27 Kornel Lesiński > On 27-01-2010 at 08:39:36 Murat Çorlu wrote: > > Is there a simple way to define a custom namespace globally for all of our >> templates like tal and metal namespaces? >> > > No, and I'm not planning to add it. TAL namespaces are already in violation > of the XML spec. > Not that I need this feature for the time being, but what's the downside of violating the specs? Nobody is going to fine or imprison you for it. PHPTAL is an autonomous library. ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
On 27-01-2010 at 08:39:36 Murat Çorlu wrote: Is there a simple way to define a custom namespace globally for all of our templates like tal and metal namespaces? No, and I'm not planning to add it. TAL namespaces are already in violation of the XML spec. -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
Is there a simple way to define a custom namespace globally for all of our templates like tal and metal namespaces? romtek wrote: 2009/11/12 Kornel Lesiński > xmlns stops working when you close element. > > > > > does nothing. > > > > > > > > > should work. It worked. Thank you. -- ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
2009/11/12 Kornel Lesiński > xmlns stops working when you close element. > > > > > does nothing. > > > > > > > > > should work. It worked. Thank you. ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
On 12-11-2009 at 01:00:15 romtek wrote: I keep having a problem with this. I now need to have a "Facebook fanbox". The code I need to insert contains . I've added in the beginning of the document and have also tried defining it in the html element like this: , but I keep getting 'PHPTAL_ParserException' with message 'There is no namespace declared for prefix of element < fb:fan >' What I am doing wrong? xmlns stops working when you close element. does nothing. should work. -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
2009/10/28 Kornel Lesiński > On 28.10.2009, at 17:28, romtek wrote: > >> >> In earlier version I was able to add one or more characters to an >> attribute of an HTML element to save it for potentional future use during >> development. E.g., xyz, but this fails now with >> PHPTAL 1.2.1 with the error of "There is no namespace declared for prefix of >> attribute _tal:content of element < a >". In my opinion, PHPTAL shouldn't >> throw an exception when it encounters an attribute that it doesn't >> recognize. It should ignore it. A convinient ability is now gone. >> > > From XML point of view that's a feature and XML _requires_ that parsers > signal a fatal error when this happens. > > You could silence the error by adding: > > > > at the beginning of the document (or on the tag). > > You could also change tal:content to tal:comment. > I keep having a problem with this. I now need to have a "Facebook fanbox". The code I need to insert contains . I've added in the beginning of the document and have also tried defining it in the html element like this: , but I keep getting 'PHPTAL_ParserException' with message 'There is no namespace declared for prefix of element < fb:fan >' What I am doing wrong? Roman ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
Re: [PHPTAL] "There is no namespace declared" error in v. 1.2.1
On 28.10.2009, at 17:28, romtek wrote: In earlier version I was able to add one or more characters to an attribute of an HTML element to save it for potentional future use during development. E.g., xyz, but this fails now with PHPTAL 1.2.1 with the error of "There is no namespace declared for prefix of attribute _tal:content of element < a >". In my opinion, PHPTAL shouldn't throw an exception when it encounters an attribute that it doesn't recognize. It should ignore it. A convinient ability is now gone. From XML point of view that's a feature and XML _requires_ that parsers signal a fatal error when this happens. You could silence the error by adding: at the beginning of the document (or on the tag). You could also change tal:content to tal:comment. -- regards, Kornel ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal
[PHPTAL] "There is no namespace declared" error in v. 1.2.1
Hi, In earlier version I was able to add one or more characters to an attribute of an HTML element to save it for potentional future use during development. E.g., xyz, but this fails now with PHPTAL 1.2.1 with the error of "There is no namespace declared for prefix of attribute _tal:content of element < a >". In my opinion, PHPTAL shouldn't throw an exception when it encounters an attribute that it doesn't recognize. It should ignore it. A convinient ability is now gone. Roman ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com http://lists.motion-twin.com/mailman/listinfo/phptal