tags:

views:

62

answers:

3

i've never used xml before, and now i must chenge the align of text. i try to do it like in html, but it doesn't happen. maybe i do something wrong? here is he script

<gallery>
<title><![CDATA[<FONT SIZE="20" COLOR="#C3A25D"></FONT>]]></title>
<text><![CDATA[<FONT SIZE="20" COLOR="#C3A25D">text, which i want to to be in right position</FONT>]]></text>
<thmb></thmb>
<img wdt="421">images/avetiskhakhamyan.jpg</img>
</gallery>

i try to write align="right" in <font> tag, but it deosn't work. could you tell me what is the problem? thanks

update:

and i can't understand anyway, if i don't set any align attribute, why it show text in center? is it the default value?

+1  A: 

Plain XML? You need to apply a stylesheet to it, and that should be the part that identifies how to display the tag. Alignment is entirely part of display.

You can ask the browser (i.e., I've tested it with Safari and Firefox) to apply an XSLT stylesheet by adding a processing instruction to the XML document – usually immediately below the <?xml…?> declaration – which can do things like changing the document to XHTML (which can support alignment control):

<?xml-stylesheet type="text/xml" href="http://example.com/wherever.xsl"?&gt;

You might also be able to get away with just telling the browser what to do by applying a CSS stylesheet:

<?xml-stylesheet type="text/css" href="http://example.com/wherever.css"?&gt;

Ask further questions here if you need help learning how to use CSS, XSLT, or XHTML.

Donal Fellows
@Donal Fellows where i must apply the stylesheet? i've never work with xml, so could you write more clearly? thanks
Syom
http://w3schools.com/xml/xml_display.asp
ZippyV
+8  A: 

XML is not a display format. It doesn't not "understand" alignments.

As far as XML is concerned, align="right" is an attribute named align with the value right. Noting more and nothing less.

Oded
and what can i do?:)
Syom
@Syom - XML is just a data format, not intended for viewing directly. The answer depends on _how_ you are viewing it and how you want it to be viewed by users of your application.
Oded
@Syom - You can use a CSS stylesheet for that. See this tutorial: http://www.w3schools.com/xml/xml_display.asp
Oded
+2  A: 

XML exists purely to describe and contain data. Presentation (colors, positioning, fonts etc.) is not part of what XML can or should be able to do.

You should take a look at XLST (and therefore too HTML and CSS). That way you can format your data the way you want.

Arve Systad