Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 XML

Author  Topic 

jhermiz

3564 Posts

Posted - 2004-07-07 : 12:21:13
I've integrated XML into my vb application for language purposes.
I am trying to use control tips on various controls and it works fine...
however I need carriage returns to work meaning I need text on several lines like this:


<BallonTipUserName>Enter Your User Name.
User name is generally your first initial and complete last name.
Example User: John Smith
User Name: jsmith
</BallonTipUserName>


How do I tell XML those are carriage returns?
Right now..when I pull back into the control tip it just shows the first line!


Jon
www.web-impulse.com

Kristen
Test

22859 Posts

Posted - 2004-07-07 : 12:40:40
Dunno - "\n"? "%13%10"? "<BR>" (which I suppose would be "<BR>")?
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-07-07 : 13:57:46
CDATA tells the parser to ingore validation so you can place code with special characters.
<BallonTipUserName>
<![CDATA[
Enter Your User Name.
User name is generally your first initial and complete last name.
Example User: John Smith
User Name: jsmith
]]>
</BallonTipUserName>
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-07 : 14:05:45
quote:
Originally posted by ehorn

CDATA tells the parser to ingore validation so you can place code with special characters.
<BallonTipUserName>
<![CDATA[
Enter Your User Name.
User name is generally your first initial and complete last name.
Example User: John Smith
User Name: jsmith
]]>
</BallonTipUserName>




Not working:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

An invalid character was found in text content. Error processing resource 'file:///C:/Documents and Settings/jhermiz/Deskto...

<ButtonCancel><![CDATA[L



Jon
www.web-impulse.com
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-07 : 14:06:34
my code btw:

		<ButtonCancel><![CDATA[Löschen]]></ButtonCancel>


Jon
www.web-impulse.com
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-07 : 14:08:58
Err Im thinking it cannot format the ö ....

is there a way around this ?



Jon
www.web-impulse.com
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-07 : 14:19:51
I guess Ill have to change:
the german o to = oe
and the german u to ue
etc...

Thanks



Jon
www.web-impulse.com
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2004-07-07 : 14:21:38
I'm not completely clear on the process here. You're creating some XML somehow, and feeding it through an XSLT processor, right? Any chance of some details here?

If the XSLT processor is choking on the ö it's most likely because it's expecting XML encoded as UTF-8 and the string you're inserting into the middle of the XML is Windows CP-1252 (or ISO Latin 1).
If you know the entire XML document is encoded as ISO Latin 1, you have to say so in the XML declaration at the start of the document, otherwise the XML parser will assume UTF-8:

<?xml version="1.0" encoding="ISO-8859-1"?>

If bits of it are in different character encodings it ain't gonna fly.

Since we're talking about CDATA too, I'd point out that CDATA sections in XML documents encoded as ISO Latin 1 can't contain characters not in the ISO Latin 1 character set since there's no way to put a character reference e.g. &#x4EBA; in a CDATA section. This won't affect your example Latin Small Letter O With Diaeresis, of course.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-07 : 14:24:51
Well

I need to support german, french, spanish, and english...

So what do you suggest? Should I just replace the
ß with ss
ö =oe
ä = ae

etc...for like german...
or should I specify what you said ???

if I specify where exactly does that tag go...
- <Labels>
- <Generic>
<BallonTipExit>Close Form</BallonTipExit>
<BallonTipOk>Ok</BallonTipOk>
</Generic>
- <frmLogin>
<Caption>Login</Caption>
<Title>Strategic Proposal Initiative</Title>
<ButtonOk1>Ok</ButtonOk1>
<ButtonOk2>Ok</ButtonOk2>
<ButtonCancel>Cancel</ButtonCancel>
<ButtonChangePassword>Change Password</ButtonChangePassword>
<ButtonExit>Exit</ButtonExit>
<HyperlinkForgotPassword>Help - I forgot my password!</HyperlinkForgotPassword>
<HyperlinkNewUser>New User? - Sign me up!</HyperlinkNewUser>
<LabelSelectLanguage>Select Language:</LabelSelectLanguage>
<CheckBoxRememberPass>Remember My Password</CheckBoxRememberPass>
<LabelVerify>Verify New Password:</LabelVerify>
<LabelEnterPassword>Enter Password:</LabelEnterPassword>
<LabelEnterUserName>Enter User Name:</LabelEnterUserName>
<LabelEnterNewPassword>Enter New Password:</LabelEnterNewPassword>
<MessageBoxPassRemember>Enter password to be remembered!</MessageBoxPassRemember>
<MessageBoxPassRememberTitle>Enter Password!</MessageBoxPassRememberTitle>
<MessageBoxEnterUserName>Please enter your user name!</MessageBoxEnterUserName>
<MessageBoxEnterUserNameTitle>Enter User Name!</MessageBoxEnterUserNameTitle>
<MessageBoxEnterCurrentPassword>Please enter your current password!</MessageBoxEnterCurrentPassword>
<MessageBoxEnterCurrentPasswordTitle>Enter Current Password!</MessageBoxEnterCurrentPasswordTitle>
<MessageBoxUserNotFound>User not found!</MessageBoxUserNotFound>
<MessageBoxUserNotFoundTitle>User Not Found!</MessageBoxUserNotFoundTitle>
<MessageBoxEnterNewPassword>Please enter a new password.</MessageBoxEnterNewPassword>
<MessageBoxEnterNewPasswordTitle>Enter New Password</MessageBoxEnterNewPasswordTitle>
<MessageBoxVerifyPassword>Please verify password.</MessageBoxVerifyPassword>
<MessageBoxVerifyPasswordTitle>Verify Password</MessageBoxVerifyPasswordTitle>
<MessageBoxVerifyGood>You have changed your password successfully.</MessageBoxVerifyGood>
<MessageBoxVerifyGoodTitle>Password Changed</MessageBoxVerifyGoodTitle>
<MessageBoxVerifyBad>New password and verification do not match!</MessageBoxVerifyBad>
<MessageBoxVerifyBadTitle>Re-Enter Password</MessageBoxVerifyBadTitle>
<MessageBoxNoHomePage>No home page assigned!</MessageBoxNoHomePage>
<MessageBoxNoHomePageTitle>No home page!</MessageBoxNoHomePageTitle>
<BallonTipNewPwd>Enter New Password. Password can be upto 8 characters. Please use alpha-characters / numbers only!</BallonTipNewPwd>
<BallonTipUserName>Enter Your User Name. User name is generally your first initial and complete last name. Example User: John Smith User Name: jsmith</BallonTipUserName>
</frmLogin>
</Labels>


Thanks arnie
my typical xml file looks like this:




Jon
www.web-impulse.com
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-07 : 14:32:34
Ok wont be working with CDATA...
arnold you were right I did not specify the XML document at the type...
Now to get the front end to recognize this...the front end is VB and converts the german letter back to its regular equivalent

Is it possible to change this ?


Jon
www.web-impulse.com
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2004-07-07 : 14:39:00
Yeah: if you're keeping everything as is, try putting that XML declaration at the start. If you're using CP-1252 codepoints in the range 128-159 (e.g. for smart quotes, em dashes), I don't know what will happen -- you could try using encoding="cp1252" if your XML processor is MSXML.
The alternative is to store the XML (or at least, present it to the XML processor) as UTF-8. Windows 2000 and beyond is pretty reasonable at storing text files at UTF-8 -- certainly notepad gives you the choice to save as UTF-8 (on the Save As dialog), but some other editors are a bit patchy. That said, any decent XML editor will read UTF-8.
(sure glad my legs don't look that that guys)
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2004-07-07 : 14:48:35
I wasn't really clear what happened to the output of the XSLT processor -- how does it get into VB?

You can tell XSLT to encode its output as ISO Latin 1 by including an encoding attribute on the xsl:output element, which is one of the top-level elements within xsl:stylesheet. So you'd have something like

<xsl:stylesheet>
<!-- maybe some stuff here -->
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1"/>
<!-- XSLT templates and so on -->
</xsl:stylesheet>

Note that the character encoding of the input to and output of an XSLT processor are entirely independent. So even if your input document is encoded as ISO Latin 1, the output will be UTF-8 unless you tell it otherwise (with the xsl:output as above).

Edit: Sorry, am I being silly here? Is the only XSLT stylesheet the one that Internet Explorer uses to prettify XML documents?
If so, my question simplifies to "how is the XML getting into VB?"
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-07-07 : 19:31:19
Jon,

It appears CDATA does not preserve newline characters. The only other suggestion I have is to perform a newline character test on the string value.
Something like:

<xsl:if test="contains(BallonTipUserName,'#xA;')">
...
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-08 : 08:54:53
Hey Arnie,

The English and German.xml files are fine...
but for some reason my end client (vb) is having trouble reading a Spanish.xml document. Do I need to change the encoding for this ?


<?xml version="1.0" encoding="ISO-8859-1" ?>
- <Labels>
- <Generic>
<BallonTipExit>Cerrar Formulario</BallonTipExit>
<BallonTipOk>Ok</BallonTipOk>
</Generic>
- <frmLogin>
<Caption>Login</Caption>
<Title>Strategic Proposal Initiative</Title>
<ButtonOk1>Ok</ButtonOk1>
<ButtonOk2>Ok</ButtonOk2>
<ButtonCancel>Cancele</ButtonCancel>
<ButtonChangePassword>Cambie el Password</ButtonChangePassword>
<ButtonExit>Salir</ButtonExit>
<HyperlinkForgotPassword>Ayuda - Olvidé mi Password</HyperlinkForgotPassword>
<HyperlinkNewUser>Nuevo Usuario? - Regístreme!</HyperlinkNewUser>
<LabelSelectLanguage>Seleccione el Idioma:</LabelSelectLanguage>
<CheckBoxRememberPass>Recuerde Mi Password</CheckBoxRememberPass>
<LabelVerify>Verifique el Nuevo Password:</LabelVerify>
<LabelEnterPassword>Ingrese el Password:</LabelEnterPassword>
<LabelEnterUserName>Ingrese el Nombre de Usuario:</LabelEnterUserName>
<LabelEnterNewPassword>Ingrese el Nuevo Password:</LabelEnterNewPassword>
<MessageBoxPassRemember>Ingrese el password para memorizarlo!</MessageBoxPassRemember>
<MessageBoxPassRememberTitle>Ingrese el Password!</MessageBoxPassRememberTitle>
<MessageBoxEnterUserName>Por favor, ingrese su nombre de usuario!</MessageBoxEnterUserName>
<MessageBoxEnterUserNameTitle>Ingrese el Nombre de Usuario!</MessageBoxEnterUserNameTitle>
<MessageBoxEnterCurrentPassword>Por favor, ingrese su password actual!</MessageBoxEnterCurrentPassword>
<MessageBoxEnterCurrentPasswordTitle>Ingrese el Password Actual!</MessageBoxEnterCurrentPasswordTitle>
<MessageBoxUserNotFound>Usuario no encontrado!</MessageBoxUserNotFound>
<MessageBoxUserNotFoundTitle>Usuario no encontrado!</MessageBoxUserNotFoundTitle>
<MessageBoxEnterNewPassword>Por favor, ingrese el nuevo password.</MessageBoxEnterNewPassword>
<MessageBoxEnterNewPasswordTitle>Ingrese el Nuevo Password</MessageBoxEnterNewPasswordTitle>
<MessageBoxVerifyPassword>Por favor, verifique el password.</MessageBoxVerifyPassword>
<MessageBoxVerifyPasswordTitle>Verifique el Password</MessageBoxVerifyPasswordTitle>
<MessageBoxVerifyGood>Usted ha cambiado su password con éxito.</MessageBoxVerifyGood>
<MessageBoxVerifyGoodTitle>Password Cambiado</MessageBoxVerifyGoodTitle>
<MessageBoxVerifyBad>El nuevo password y la verificación no coinciden!</MessageBoxVerifyBad>
<MessageBoxVerifyBadTitle>Ingrese el Password nuevamente</MessageBoxVerifyBadTitle>
<MessageBoxNoHomePage>No se ha asignado ninguna página de inicio!</MessageBoxNoHomePage>
<MessageBoxNoHomePageTitle>No hay página de inicio!</MessageBoxNoHomePageTitle>
<BallonTipNewPwd>Ingrese el Nuevo Password. El Password debe tener 8 caracteres máximo. Por favor, use sólo números o caracteres alfabéticos!</BallonTipNewPwd>
<BallonTipUserName>Ingrese su Nombre de Usuario. El nombre de usuario por lo general es la inicial del primer nombre y el apellido completo. Por ejemplo, Usuario: Juan Perez Nombre de usuario: jperez</BallonTipUserName>
</frmLogin>
</Labels>




Jon
www.web-impulse.com
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-08 : 10:35:13
Weird...I recreated the page...exact thing..and it works now.

Just weird...



Jon
www.web-impulse.com
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2004-07-08 : 10:46:33
You shouldn't need to change the character encoding: ISO Latin 1 contains all the standard Spanish accented characters (and even the inverted exclamation and question mark characters).
If that XML file is displaying right in IE, I'm not sure where the problem lies. How's the problem showing itself?

(Must stop this doing two things at once thing.)
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-07-08 : 10:57:51
Yea kind of weird...I just recreated it and it worked.

The front end client doesn't really raise a good error using the DOM XML object model. The best error I got was:

"Could not load file"...no details as to why it couldn't. I'll usually just open the XML file in a browser to see what the error was. Even though this one showed no errors...I decided to delete and recreate...weird cause I even copied and pasted from the previous one to the other one. MS is playing tricks on me!!!

Thanks arnold,



Jon
www.web-impulse.com
Go to Top of Page
   

- Advertisement -