[ Back to main index ] | [ Show all FAQs on a single page ]

RXML

Can I use more than one plugin in a <cond>'s <case>

Posted at 2004-11-16 by Sascha Nemecek

Unfortunately, no! You'll have to use the normal <if><else> structure instead.

Applies to: Roxen ,

Developing and testing RXML can be hard when I always have to embed it into HTML pages. Any tip for easy RXML development?

Posted at 2004-11-17 by Michael Stenitzer

Use the demo module, but be careful to restrict access through the security tab.

Applies to: Roxen , ChiliMoon

How can I avoid having so much whitespace in my pages using RXML?

Posted at 2004-11-17 by Michael Stenitzer

Using RXML always causes a lot of spaces and newlines to be added to the code. You can try to put thing that does not have to generate output in a <nooutput>-container. Another way to go is to add the whitespace remover module, which will remove superfluously whitespace, but in doing so you add an additional parsing overhead.

Applies to: Roxen , ChiliMoon

[show comments]

Some RXML is not working as intended after importing configuration to a newer server version

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2004-12-05 by Sascha Nemecek

For Roxen:

Check the compatibility level of your site's settings tab. After an server update it will be set to your old server's level.

For Chilimoon:

ChiliMoon aims to be compatible with RXML 2.0, all other compatibilty layers are removed. If your page contains older RXML-code please update the code even if it still works, it might not work with future versions.

If you think the RXML 2.0 parser is not behaving the way it should, then post a message at the ChiliMoon developers mailinglist (chilimoon-dev.)

Applies to: Roxen , ChiliMoon
Status: Answer to be confirmed

How can I create dynamicly comments with RXML?

Posted at 2004-11-17 by Michael Stenitzer

<maketag>/ is your friend.

 <maketag type=container name=comment>&var.anything;</maketag> 

or

 <maketag type=container name=cdata>&var.anything;</maketag> 

Applies to: Roxen , ChiliMoon

[show comments]

How can I avoid an infinite loop when redefining a HTML tag with RXML?

Posted at 2004-11-17 by Michael Stenitzer

If you want to redefine an HTML tag with RXML's <define>/ you might end up in an infinite loop by parsing the redefined tag again and again. Use the <?noparse ?> processing instruction around the redefined HTML tag in your definition.

Example:

 <define container=h2> 
   <?noparse <h2?> &_.args:none;>Header</h2> 
 </define> 

Applies to: Roxen , ChiliMoon

How can I use arrays in RXML?

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2006-01-07 by Marc Dirix

The new implementation in Roxen and Chilimoon is to use <append type="array">:

<set variable="var.array" value="value1" /> 
<append variable="var.array" value="value2" /> 
<append variable="var.array" value="value3" /> 

Output either by:

<emit source="values" variable="var.array" > 
&_.value; &_.index; 
</emit> 

Or where n is the index of the value (e.g. 1,2,3...):

&var.array.n; 

--

Currently this is only possible in a very restriced way. Use <set> in combination with the split attribute. E.g.:

<set variable="var.array" value="name1::value1;name2::value2;name3::value3" /> 
<emit source="values" scope="outer" variable="var.array" split=";"> 
  <emit source="values" scope="inner" variable="outer.value" split="::"> 
    <cond> 
      <case variable="inner.counter == 1"> 
        <set variable="var.name" from="inner.value" /> 
      </case> 
      <case variable="inner.counter == 2"> 
        <set variable="var.value" from="inner.value" /> 
      </case> 
    </cond> 
  </emit> 
  <p>Name: &var.name;<br /> 
  Value: &var.value;</p> 
</emit> 

Applies to: Roxen , ChiliMoon

What means the RXML parse error: This tag doesn't handle content?

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2004-11-30 by IzNoGooD

Some tags don't take input between open and close tag. They have to be terminated at the end of the opening tag: <tag />.

For example sqltable which takes a query as argument not between open and close tag: <sqltable query="select names from group where age=10" />

Applies to: Roxen , ChiliMoon

How can I change the behaviour of the last row in an <emit>/ container?

Posted at 2004-11-17 by Michael Stenitzer

Use <delimiter>/ which adds the content of this container to every processed row except the last one.

 <set variable="var.test" value="this,that,other"/> 
 <emit source="values" values="&var.test;" split=","> 
     team LIKE '&_.value;' <delimiter>OR</delimiter> 
 </emit> 

Result:

  team LIKE 'this' OR team LIKE 'that' OR team LIKE 'other' 

Applies to: Roxen , ChiliMoon

Why does <insert href=http://host/path/> not work?

Posted at 2004-11-17 by Michael Stenitzer

You explicitly have to allow <insert#href/> in the admin-interface in the additional rxml-tags' module. Note that the thread will be blocked while it fetches the web page.

Applies to: Roxen , ChiliMoon

Why is the <attrib>/ container of an <define>/ not working as intended?

Posted at 2004-11-17 by Michael Stenitzer

If you are setting an attribute with a value not available at the time a <define>/ is parsed, you might end up in an empty attribute.

Example:

 <define container="c"> 
  <attrib name="headline">&var.name;</attrib> 

The problem is, that the <attrib>/ containers being parsed at definition time (together with define, as they are actually belonging to define). At that time your variable var.name has no value assigned.

Applies to: Roxen , ChiliMoon

Is there a way to handle cases when <emit>/ does not return any rows?

Posted at 2004-11-17 by Michael Stenitzer

Use

 <emit></emit> 
 <else>No rows returned</else> 

See also documentation for <emit></emit>.

Applies to: Roxen , ChiliMoon

Why does inserting a file with <eval><insert file="file" /></eval> not work as intended?

Posted at 2004-11-17 by Michael Stenitzer

The intention of the concept <eval><insert file="file" /></eval> is to insert a file into another one and parse it (<eval>/) after insertion. Therefore it is important NOT to use extensions which will be parsed by the RXML parser (like rxml, html, xml etc., set in the rxml-parser module interface) at the stage of insertion.

Applies to: Roxen , ChiliMoon

How can I avoid caching of a page?

Posted at 2004-11-17 by Michael Stenitzer

 <expire-time now="now"/> 

Applies to: Roxen , ChiliMoon

Using <header /> does not show the expected behaviour in the browser

Posted at 2004-11-17 by Michael Stenitzer

Be careful that header names in http are case sensitive.

Applies to: Roxen , ChiliMoon

How can I insert an tag's attribute stored in a variable?

Posted at 2004-11-17 by Michael Stenitzer

<tag &var.test; /> is not allowed according to XML specifications and does not work in Roxen. Variables (entity references) are only recognized in normal text and in argument values.

You can achieve this by using a "splice" argument:

 <tag ::="&var.test;" /> 

Applies to: Roxen , ChiliMoon

How can I create a tag from a variable <&var.name;>?

Posted at 2004-11-17 by Michael Stenitzer

You have to use <maketag>/

Applies to: Roxen , ChiliMoon

How can I insert a tag within another one's attribute (e.g. <form action="<tag />" />)?

Posted at 2004-11-17 by Michael Stenitzer

Roxen parses the arguments to all tags, but only for entity references and not other tags (which would encourage invalid XML).

  <set variable="var.tmp"><tag/></set> (verify) 
  <form action="&var.tmp;">...</form> 

You can also build your tag (<form> in the example above) by using <maketag>/

Applies to: Roxen , ChiliMoon

Why are my UTF-8 characters in form variables treated as two separate single-byte characters

Posted at 2007-01-24 by Michael Stenitzer

The reason is that the server does not know about the encoding in a form because this information is usually not sent by the browser. This is also the reason why <vform> might fail verification for an input-length.

Use <roxen-automatic-charset-variable/> in the form, so Roxen will know about your encoding. See the Roxen manual page for further information.

Applies to: Roxen , ChiliMoon

How can I prevent variables from being parsed?

Posted at 2004-11-16 by Sascha Nemecek, Last updated at 2004-11-22 by Michael Stenitzer

If one wants to specify a variable reference in the content that should not be expanded right away, it is possible to use the special syntax with a ":" first, e.g. "&:foo.bar;". Every parse step just removes one colon at the front and leaves the rest.

Applies to: Roxen , ChiliMoon

How can I test if a variable is empty / not set / not empty?

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2007-01-26 by Michael Stenitzer

 <if sizeof="var.test = 0">empty or not set</if> 
 <if match="&var.test; = ">empty or not set</if> 
 <if variable="var.test = ">empty, but set</if> 
 <if variable="var.test = ?*">the variable contains 1 or more characters</if> 
 <if sizeof="var.test">variable set (might be empty)</if> 
 <if sizeof="var.test > 0">the variable contains 1 or more characters</if> 

Applies to: Roxen , ChiliMoon

What is the difference between a <define>/ and a <set>/ container?

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2004-11-22 by Michael Stenitzer

<define></define>, unlike most RXML tags, does not preparse its content while <set></set> does. Use either the preparse="preparse" attribute to parse it immediately or use <eval>/ to parse it at the time of inserting the variable.

Applies to: Roxen , ChiliMoon

I have found no docs or reference for <cset>/

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2004-11-22 by Michael Stenitzer

It is depreciated. Use <set></set>. But <cset>/ also has an advantage to <set>/: it does not need type conversion. see Bug 3553 community.roxen.com/crunch/show_bug.cgi?id=3553 .

Applies to: Roxen , ChiliMoon

I have a dot in my variables name and I get the error 'no current scope'

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2004-11-22 by Michael Stenitzer

Escape the dot in the variable name with a second dot.

Example:

 scope: form, variable: test.1 
 &form.test..1; 

Applies to: Roxen , ChiliMoon

I get the error 'no current scope'

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2004-12-07 by Sascha Nemecek

Only the scope "var" and "form" are always available. If you temporarily want to add an additional scope, you can do this by using the <scope>/ container.

If you have problems with the extend attribute, you should have a look at roxens bug crunch and check if you are using a recent rxmltags.pike (>1.471). See: https://community.roxen.com/crunch/show_bug.cgi?id=3831.

Applies to: Roxen , ChiliMoon

How can I handle a variable coming from a multiple value form?

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2004-11-22 by Michael Stenitzer

The values are split by NULL characters.

form.ID=v1\0v2\0v3\0v4 

Use <emit#value> to retrieve all single values

 <emit source="values" value="&form.ID;"> 
   &_.value; <br /> 
 </emit> 

You can also use &form.ID.1;, if you know what index your value has.

Applies to: Roxen (2.1+) , ChiliMoon

[show comments]

How can I insert a variable into a variable?

Posted at 2004-11-17 by Michael Stenitzer, Last updated at 2007-01-26 by Michael Stenitzer

 <set variable="var.1" value="1" /> 
 <set variable="var.test1" value="finally!" /> 
 &var.test&var.1;; <!-- does not work! --> 

Solution 1:

 <eval>&var.test&var.1;;</eval> 

Solution 2:

 <insert variable="var.test&var.1;" /> 

Solution 3:

 <if variable="var.test&var.1;"> 
    <!-- Checking if the variable exists first since next variable assignment generates run error --> 
     <set variable="var.tmp" from="var.test&var.1;"/> 
     &var.tmp; 
 </if> 

Applies to: Roxen , ChiliMoon

[show comments]

Why do I sometimes get an error when use <set>/ or <append>/ containers?

Posted at 2004-11-22 by Michael Stenitzer

Possible error messages are:

 RXML parse error: Cannot append another value ... to non-sequential type any. 

or

 RXML parse error: Unknown tag ... is not allowed in context of type any. 

This is due to the fact that <set>/ and <append>/ needs type conversion if the content is not a string but of type "text/html". The type conversion attribute in <set> is undocumented.

Example:

 <set variable="var.test" type="text/html">this is a <a href="#">link</a></set> 

Applies to: Roxen , ChiliMoon

[show comments]

[ Back to main index ] | [ Show all FAQs on a single page ]