A summary of some common problems with getting started with XML (III.)

Source: Internet
Author: User
Tags object cdata object model return visual studio

Author: Angelgavin Origin: CSDN

How do I load documents with foreign and special characters?

documents can contain foreign characters, such as:

foreign characters (úóí?)

For example  TRIDACNA foreign characters must precede the escape sequence. Foreign characters can be UTF-8 encoded or specified in different encodings, as follows:

foreign characters ( Tridacna)

you can now load the XML correctly.

other characters are kept in XML and need to be handled in a different way. The following XML:

This &
Produces the following error:
Spaces are not allowed here.
Line 0000001:this & that
Location 0000012:----------^

here & is part of an XML syntactic structure that cannot be interpreted as & if it is placed only inside an XML data source. You need to replace a special character sequence called "entity."

This &
The following characters require the corresponding entity:

< <
& &
> >
" "
' '


Quotation marks are used as delimiters for property values in markup, so they are usually not used inside property values. For example, the following content will return an error:

The single quotes here are used both as property delimiters and in the property value itself. To correct this problem, you can change the property delimiter to double quotes:

Or you can escape the single quote as an entity '

Both of these methods return the property value, John's Stuff, through the GetAttribute method in the XML object model. Similarly, for double quotes, you can use the entity
"。
You can also handle special characters in element content by placing text in a CDATA section. Here's what's right:

In this example, the XML object model displays a CDATA node as a child node of an XML node, which returns a string

This & the is just "text" content.
As NodeValue.

How do I use the MSXML COM component in Visual Studio 6.0 c + +?

The easiest way to use the MSXML COM component in Visual C + + 6.0 is to use the #import directive:

#import "Msxml.dll" Named_guids no_namespace#import "Msxml.dll" Named_guids no_namespace
It defines all the ixml* interfaces and interface IDs so that they can be used in the application. You can also get the MSXML type library and header file (in English) from InetSDK, as well as the uuid.lib containing the class IIDs.

How do I use HTML entities in XML?

The following XML contains HTML entities:

The Copyright? Watts, Microsoft INC, All rights reserved.

Total 3 page: previous 1 [2] [3] Next page



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.