472,952 Members | 2,184 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

what can i do if i want to include "<" or ">" in xml document.

hi everybody,
i am useing some classes which in System.Xml to deal with xml document. what
can i do if the document include "<" or ">"?

Thanks.
Nov 18 '06 #1
3 2103
Escape them to "&lt;" and "&gt;" (excluding the surrounding quotes.

">" is ususally safe even unescaped in most contexts.

Sometimes it becomes necessary to escape the quotes and the apostrophe
characters -- accordingly -- with "&quot;" and "&apos;"

Another character to escape almost always is the ampersand character
itself -- this is escaped as "&amp;"
Cheers,
Dimitre Novatchev
"Steven.Xu" <St******@discussions.microsoft.comwrote in message
news:DE**********************************@microsof t.com...
hi everybody,
i am useing some classes which in System.Xml to deal with xml document.
what
can i do if the document include "<" or ">"?

Thanks.

Nov 18 '06 #2
On Sat, 18 Nov 2006 15:36:45 -0800, Dimitre Novatchev wrote:
Escape them to "&lt;" and "&gt;" (excluding the surrounding quotes.

">" is ususally safe even unescaped in most contexts.

Sometimes it becomes necessary to escape the quotes and the apostrophe
characters -- accordingly -- with "&quot;" and "&apos;"

Another character to escape almost always is the ampersand character
itself -- this is escaped as "&amp;"
Cheers,
Dimitre Novatchev
"Steven.Xu" <St******@discussions.microsoft.comwrote in message
news:DE**********************************@microsof t.com...
>hi everybody,
i am useing some classes which in System.Xml to deal with xml document.
what
can i do if the document include "<" or ">"?

Thanks.
Also, this is a .NET XML newsgroup, so presumably you're using .NET to
read/write these strings?
If so, XmlTextReader/Writer and XmlDocument both escape the contents
automatically, so you generally don't have to worry about it.

Cheers,
Gadget
Nov 19 '06 #3
Steven.Xu wrote:
i am useing some classes which in System.Xml to deal with xml document. what
can i do if the document include "<" or ">"?
Do you want to create an XML document that contains those characters? As
already pointed out if you use Xml(Text)Writer then escaping is done
automatically if you use the proper API calls (e.g. WriteElementString).

It is not clear whether you want to create such a document or whether
you want to parse an existing document. Parsing markup with unescaped
'<' or '&' content with an XML parser will give you a parse error as the
markup is not well-formed XML.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
3
by: H. S. | last post by:
Hi, I am trying to compile these set of C++ files and trying out class inheritence and function pointers. Can anybody shed some light why my compiler is not compiling them and where I am going...
10
by: Blue® | last post by:
I would like to call the content of content.htm (containing only HTML codes) into index.htm. This is usually done by renaming index.htm to index.shtml and use this tag: <!--#include...
2
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
1
by: tilt | last post by:
Hello, I use an object element to replace the iframe element in ie, like this: <object id="x_obj" data="http://.../" type="text/html"> <iframe name="x_if" id="x_if"...
10
by: vunet.us | last post by:
What is the workaround of passign a parameter to any included asp file: <!-- #Include File="file.asp" --> This obviously does not work: <!-- #Include File="file.asp?id=123" --> Thank you
23
by: Stanimir Stamenkov | last post by:
I want to find out whether the following usage of the "Bookmark" link type is o.k. An example could be seen at <http://www.geocities.com/stanio/more/horoskop.html>. The text is in Bulgarian and...
36
by: Roedy Green | last post by:
The only browser I have encountered that supports <colgroup><col class="behold"></colgroup> to apply a CSS style to a whole column, is Microsoft Internet Explorer. I have been told it SHOULD NOT...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.