Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I need to pass an XML value which contains a "<"

 

When I load the XML document containing "<", the program throws an error farther down the line, thinking that I have started a new node

 

Is there a way to pass this value, or do I have to change the character as part of error handling?

 

Here is an example of what I mean:

 

<Contacts>

<Contact Notes>

<RecID> DJDEWYDHD>/#</RecID>

<Notes> Here are some notes</Notes>

</Contact Notes>

</Contacts>

Read the Fovean Chronicles

Because you just can't spend your whole day programming!

  • 5 years later...
Posted

I have a situation where a client doesn't want the character escaped. I am using XMLwriter and I can't seem to find a way to stop "&" from becoming "&amp". Is there a way to do this? This is really the onlyl character I need to do this with.

 

Thanks

 

Zeroeffect

If you can't find it, Build It.

 

There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10

  • Leaders
Posted

When you encode the text into the XML, these characters should be escaped. When you read it back, you need to parse the escape sequences to get the original text.

 

XML isn't my strong suit, but a quick google search gave me this result, which explains how to encode/decode these escape sequences.

[sIGPIC]e[/sIGPIC]
Posted

I am told by them that that is how thier application reads and XML file. I have a feeling they are reading/loading the whole file to a string then parsing the data. I'll go at the again about correcting thier application.

 

I have the application that generates the XML they read that XML file. I wish I knew what they were using to read it.

 

Thanks

 

Zeroeffect

If you can't find it, Build It.

 

There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10

  • Administrators
Posted
I am told by them that that is how thier application reads and XML file. I have a feeling they are reading/loading the whole file to a string then parsing the data. I'll go at the again about correcting thier application.

 

In that case they are probably not actually dealing with XML but their own XML-like syntax. If they are determined to reinvent the wheel on this one rather than use an existing and established way to do things then they are creating work for everyone.

 

I am assuming somewhere in the spec (or what passed for a spec) the client either requested or claimed to support xml - if they are doing it themselves and breaking on simple things like this then they probably have a whole load of other problems facing them (and you), plus they are technically not supporting xml and might even be in breach of the contract.

 

Depending on what they are after you might be able to use a CDATA section, however if they are struggling with a simple character escape sequence then I wouldn't hold my breath on them supporting this at all.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...