Help:Editing XML

From wiki.opentravel.org

Jump to: navigation, search

If you want to enter XML samples into a wiki page, you have two options.

You can enter it directly into the page, ensuring that every line is indented at least one character off of the left hand margin.

<?xml version="1.0" encoding="UTF-8"?>
<OTA_PingRQ
    xmlns="http://www.opentravel.org/OTA/2002/08"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opentravel.org/OTA/2002/08 /usr/rubicon/spadkins/src/OTA/Business-Travel-OTA/schemas/2002A/OTA_PingRQ.xsd"
    TimeStamp="2002-12-03T11:09:47-05:00"
    Target="Production"
    Version="2002A"
    SequenceNmbr="1" >
  <EchoData>Are you there?</EchoData>
</OTA_PingRQ>

Or you can use the fancy syntax highlighting feature. To do this, you simply surround the XML with <code> tags like this. (You must include the language formatting hint "[xml]" right after the <code> tag.)

<code>[xml]
<xml sample="goes">
  <here/>
</xml>
</code>

Here is an example.

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <OTA_PingRQ
  3. xmlns="http://www.opentravel.org/OTA/2002/08"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://www.opentravel.org/OTA/2002/08 /usr/rubicon/spadkins/src/OTA/Business-Travel-OTA/schemas/2002A/OTA_PingRQ.xsd"
  6. TimeStamp="2002-12-03T11:09:47-05:00"
  7. Target="Production"
  8. Version="2002A"
  9. SequenceNmbr="1" >
  10. <EchoData>Are you there?</EchoData>
  11. </OTA_PingRQ>

There are variations to the formatting hint syntax.

Usage in mediawiki
 <code>[lang,line_no,start_at,range(1-4,6-7)]...</code>
Examples
 <code>[lang]...</code> // line_no default=Y, start_at default=1
 <code>[lang,N]...</code> // no line numbers
 <code>[lang,5]...</code> // start at line 5 (with line numbers
 <code>[lang,Y,5]...</code> // deprecated - same as above
                            // ('Y' is implied by start_at)
 <code>[lang,1,(3-5,7)]...</code> // mark lines 3,4,5 and 7
  - lang is required, others are optional
  - line_no default is Y, start_at is default to 1

The language highlighting feature installed on this wiki are from http://mercury.it.swin.edu.au/swinbrain/index.php/CodeSyntaxHighlight_MediaWiki_Extension.

The syntax highlighting will work for a variety of computer languages, not just "[xml]". So if you want to include code snippets from any of the following languages (i.e. "perl"), just substitute the appropriate hint (i.e. "[perl]" instead of "[xml]").

  • actionscript
  • ada
  • apache
  • applescript
  • asm
  • asp
  • autoit
  • bash
  • blitzbasic
  • bnf
  • c
  • c_mac
  • caddcl
  • cadlisp
  • cfdg
  • cfm
  • cpp-qt
  • cpp
  • csharp
  • css-gen.cfg
  • css
  • d
  • delphi
  • diff
  • div
  • dos
  • eiffel
  • fortran
  • freebasic
  • gml
  • groovy
  • html4strict
  • idl
  • ini
  • inno
  • java
  • java5
  • javascript
  • latex
  • lisp
  • lua
  • matlab
  • mirc
  • mpasm
  • mysql
  • nsis
  • objc
  • ocaml-brief
  • ocaml
  • oobas
  • oracle8
  • pascal
  • perl
  • php-brief
  • php
  • plsql
  • python
  • qbasic
  • rails
  • reg
  • robots
  • ruby
  • sas
  • scheme
  • sdlbasic
  • smalltalk
  • smarty
  • sql
  • tcl
  • text
  • thinbasic
  • tsql
  • vb
  • vbnet
  • vhdl
  • visualfoxpro
  • winbatch
  • xml
  • xpp
  • z80
Personal tools