invalid characters in tag name

Discussion in 'XML' started by jc, Dec 29, 2003.

  1. jc

    jc Guest

    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
     
    jc, Dec 29, 2003
    #1
    1. Advertising

  2. "jc" <> wrote in message
    news:...
    > 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
     
    Kenneth Stephen, Dec 29, 2003
    #2
    1. Advertising

  3. jc

    Chris Lovett Guest

    <?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" <> wrote in message
    news:...
    > 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
     
    Chris Lovett, Dec 29, 2003
    #3
  4. jc

    jc Guest

    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.


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    jc, Dec 29, 2003
    #4
  5. "jc" <> wrote in message
    news:3ff08300$0$202$...
    > 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
     
    Kenneth Stephen, Dec 30, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QW5kZXJzIEphbnNzb24=?=

    Invalid 'name' attribute name

    =?Utf-8?B?QW5kZXJzIEphbnNzb24=?=, Jan 20, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,936
    =?Utf-8?B?QW5kZXJzIEphbnNzb24=?=
    Feb 14, 2006
  2. shruds
    Replies:
    1
    Views:
    932
    John C. Bollinger
    Jan 27, 2006
  3. Patrick.O.Ige
    Replies:
    1
    Views:
    2,005
    Patrick.O.Ige
    Jul 2, 2006
  4. Java Guy
    Replies:
    1
    Views:
    706
    Manish Pandit
    Oct 15, 2006
  5. rote
    Replies:
    2
    Views:
    7,494
    Mark Fitzpatrick
    Jan 23, 2008
Loading...

Share This Page