INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Line Break in Item ID

Line Break in Item ID

(OP)
Hello all, first time poster.

I am trying to create a line break in an XML item id.
I'm using a popular 'off the shelf' software package and I am limited as to what changes I can make.

My website is hosted on Windows Server 2003.

The file is called CCBranding.config:

At the top of the file:

CODE

<?xml version="1.0" encoding="utf-8"?> 

Where I need the line break:

CODE

<item id="SALOON CAR (Standard Class)" type="listitem" img="any_vehicle.png"> 

I want a line break in between the words 'SALOON CAR' and (Standard Class), so it displays like this on the browser:

SALOON CAR
(Standard Class)


The company that wrote the software told me it's not possible, but I'm sure there must be a way to do it.

I have tried using <br> and /n but all that does is place that exact string amongst the text. I have also tried using &#x13&#x10; as suggested on the following: Link but what that actually does is ruin the whole code and the page doesn't display properly.

I have also tried actually placing the two strings on separate lines within the code itself but it ignores the line break and just places the two strings next to each other.

Can anybody here suggest something else to try, or is it simply not possible to place a line break inside an id?

I cannot really go into too much detail as to how the code translates to the final website, but for sure, this is the only instance in the code where I'm able to attempt a line break so any suggestions would be welcome.

Thanks




RE: Line Break in Item ID

Welcome to Tek-Tips.

There are rules in the XML specification for the values of attributes. Furthermore, the XML parser is required to normalize the value in a way that might render anything you try pointless.

Certainly &#x13; and &#x10; are not the character entities that you want; try instead &#xD; and &#xA;. Note however that the page you reference is placing these values into a XML element value, not an attribute value. The XML Specification has different rules for element and attribute values, and embedded whitespace in element values is easier to preserve.

If the translation is being accomplished using XSLT, then it would be possible to make a special rule (template) for accomplishing your goal. But absent other details, one cannot simply state, "Here is your solution."

Tom Morrison
Hill Country Software

RE: Line Break in Item ID

(OP)
Thank you for the reply:

&#xD; AND &#xA; - these two placed on their own or placed together do not corrupt the code but they don't affect the line at all. no line break, no extra space or anything. It's like they aren't even there.

The code outputs to HTML like this:

CODE

<div vtid="SALOON CAR (Standard Class)"  id="SALOON CAR (Standard Class)" class="percar notSeleced" style="width:140px; height:220px; margin-left:  11px ; display:inline;">  
                    <div class="price-status-wrap" style="width:100%;">
                        <div id="left-price" style="float:left;">
                            <div class="clear "><strong>SALOON CAR (Standard Class)</strong></div> 

Not sure what else I can tell you..

RE: Line Break in Item ID

This is not a surprising result. Depending on the way that the attribute id is defined, this would be expected. A conforming XML parser, for most attributes, would eliminate them - so they are not there in the output to the application.

Do you know if this HTML is being created by XSLT or by some other process? If XSLT, it might be possible to get what you wnat. But it might simply be easier to live with what the application can do right now...

Tom Morrison
Hill Country Software

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close