invalid characters in tag name

JC

Usenet Archive
Joined
Jan 23, 2000
Messages
427
Reaction score
0
Hi, I want to build a xml translation map as the following

<A english sentence, with punctuations such as "?">translation of this sentence in some language in utf8 </A english sentence, with punctuations such as "?">

My question
1) is there a standard way doing what I want to do?
2) if not, then how do I escape the possible "," and "?" in the sentence in the tag name? because "&" is not allowed in tag name either

Thanks in advacne
 

Kenneth Stephen

Usenet Archive
Joined
Dec 29, 2003
Messages
36
Reaction score
0
jc said:
Hi, I want to build a xml translation map as the following

<A english sentence, with punctuations such as "?">translation of this sentence in some language in utf8 </A english sentence, with punctuations such as "?">

My question
1) is there a standard way doing what I want to do?
2) if not, then how do I escape the possible "," and "?" in the sentence in the tag name? because "&" is not allowed in tag name either
Hi,

Whitespace isnt allowed either in a tag name. I dont believe there is a way to escape any of the illegal characters. Your question indicates, though, that you are misapplying XML concepts. The "sentence" you are dealing with is "data" and you are attempting to put it into "markup". The two should never mix - that is the whole point of having a markup language. Perhaps you can describe what problem you are trying to solve?

Regards,
Kenneth
 

Chris Lovett

Usenet Archive
Joined
Aug 23, 2001
Messages
75
Reaction score
0
<?xml version='1.0' encoding='utf-8'?>
<A>
<A1 xml:lang="en">english sentence, with punctuations such as "?"</A1> <A2 xml:lang="whatever">of this sentence in some language </A1> </A>

Don't confuse language and encoding (utf-8). The encoding applies to the entire file and UTF-8 is a fine choice and can encode any unicode characters, which means any language.

The only characters that need to be escaped in XML text as shown above are "<" and "&". Write these as the character entities "&lt;" and "&amp;" respectiviely and you should be fine.
 

JC

Usenet Archive
Joined
Jan 23, 2000
Messages
427
Reaction score
0
I want to have translation for different languages. so russian.xml will have <my_sentence>russian sentence</my_sentence>; and chinese.xml will have <my_sentence>chinese sentence</my_sentence>, etc. The xml file will be parsed at loading time and proper translated message will be displayed at run time. I am trying to use the english as the lookup key for its equivalent translation. the "sentence" is data, but here it is more of just a key to the the real data. Is there a way to tell parser not to parse the tagname, something like <CDATA>? Or may be xml is just the format for doing what I want to do.
 

Kenneth Stephen

Usenet Archive
Joined
Dec 29, 2003
Messages
36
Reaction score
0
jc said:
I want to have translation for different languages. so russian.xml will have <my_sentence>russian sentence</my_sentence>; and chinese.xml will have <my_sentence>chinese sentence</my_sentence>, etc. The xml file will be parsed at loading time and proper translated message will be displayed at run time. I am trying to use the english as the lookup key for its equivalent translation. the "sentence" is data, but here it is more of just a key to the the real data. Is there a way to tell parser not to parse the tagname, something like <CDATA>? Or may be xml is just the format for doing what I want to do.
Hi,

Wont the following work for you :

<sentence lang="ru">Russian sentence</sentence>
<sentence lang="zh">Chinese sentence</sentence>

...or alternatively :

<sentence>
<lang>ru</lang>
<text>Russian sentence</text>
</sentence>
<sentence>
<lang>zh</lang>
<text>Chinese sentence</text>
</sentence>

...or

<sentence>
<lang name="ru">Russian sentence</lang>
<lang name="zh">Chinese sentence</lang>
</sentence>

I'm sure, with a bit more effort, you can think up a few more combinations. None of the above solutions require any sort of "escaping" because the tags are markup and dont mix with the data that you are interested in.

Regards,
Kenneth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top