Editing Objects in XML
You can edit objects in XML in the user interface, which allows you to use an external editor and perform a global search and replace, for example. To enable XML editing, you need to set the Allow edit as XML option in the Setting User Parameters. When you export objects, they are saved as XML files in CAR files, see Importing Redwood Server Objects for more information.
You can also expand exported car files, and edit the files. The car files are in fact jar files, which can be opened by programs understanding zip. If you do not use jar
, the Java executable to create jar files, to re-assemble the car file, you will not be able to use the embedded upload functionality found in car files.
Special care needs to be taken when you edit objects in XML.
- Special characters must be escaped using entities
- No trailing spaces are allowed
Special Characters
According to the W3C Recommendation, special characters that must be escaped include the following:
<, >, ", &
The following table lists the characters that have to be escaped and the entities you may use instead.
Character | HTML Entity | Decimal Entity |
---|---|---|
< | < | < |
> | > | > |
" | " | " |
& | & | & |
' | ' | ' |
note
When you use other entities, these are replaced with the actual characters once you save by the XML parser. If you need to use character entities, you should always use decimal entities wherever possible. The above HTML entities are recognized in XML, but others might not be and will prevent you from saving the object.
Example
The following example illustrates what not to do:
<Description>My description contains a trailing space, which is not allowed! </Description>
<Comment>I must remember not to use special characters like <, which needs to be escaped as < or <!</Comment>