XML Leading Space

Hi there,

I'm doing some work with the Aspose.Pdf component in .net at the moment.

I'm utilising the XML templating to generate PDF documents and I have ran into a problem.

Lets say I have the following XML:

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



Hello
World!


I'd like to join the two segments together, which would give me "Hello World!", however the leading space in the second segment is being removed, thus giving me "HelloWorld!". I know I could move the leading space into the first segment at the end and it would work fine, but I'm looking to replace the content of segments at runtime without adding trailing spaces.

I've tried wrapping up the content in the second segment in a CDATA but that doesn't help.

Anyone got any ideas on how to achieve/get around this?

Cheers,

Ben

Hello Ben,

Thanks for using our products.

In order to place a space between two text segments, you can add a third text segment containing a UNICODE for space character. Please try adding the following segment object between text segments containing Hello and World.

<Segment>Hello </Segment>
<Segment>#$UNICODE(32)</Segment>
<Segment>World!</Segment>

Please visit the following link for more information on Replaceable Symbols

In case it does not resolve your problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

Hi Nayyer,

Thanks for the speedy response, that seems to work.

Kind Regards,

Ben Lewis