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