比如我想写上:
<?xml-stylesheet href="a.xsl" type="text/xsl" ?>怎么搞?
<?xml-stylesheet href="a.xsl" type="text/xsl" ?>怎么搞?
解决方案 »
- 幫我取個好的函數名字
- COM访问总是失败
- 今天真郁闷,刚买的nokia QD 丢了
- 请帮忙用BASE64算法测试我做出的结果对不对!重谢
- Link错误,为什么?看看
- isapi大讨论:主要是想编辑一个控件,这个控件能够定时的从服务器收到某个文件,然后在客户端显示出来
- 求救!!!!!!!!!!!!
- 上面的大侠们通常工作几小时,一天?好象老板根本不关心!
- 在vc6.0中建了一个单文档类型应用程序,然后给其视类添了几个消息响应函数后,为什么在classview选项卡中就没有了视类图标呢??急急急。望赐教
- VC实现温度计类
- MFC缂栫▼
- 加载xml生成Tree,然后在遍历Tree生成xml,哪位有示例??急!!!
并且仔细研读了一遍然后移植到我的源码中,
但createProcessingInstruction和appendChild函数说我参数个数有误
只好估摸着修改了参数个数,就产生了异常(AppendChild处)。
这个是不是XML的版本差异性?我的MSDN版本2001JUL
编译环境:WindowsXPsp2+VC6+SP5附:MSDN中的原文
mk:@MSITStore:D:\Program%20Files\Microsoft%20Visual%20Studio\MSDN\2001JUL\1033Example
#import "msxml3.dll"
using namespace MSXML2;#define CHECK_AND_RELEASE(pInterface) \
if(pInterface) \
{\
pInterface->Release();\
pInterface = NULL;\
}\#define RELEASE(pInterface) \
{\
pInterface->Release();\
pInterface = NULL;\
}\BOOL BuildDynamicXMLwithProcessingInstruction()
{
BOOL bResult = FALSE;
IXMLDOMDocument *pIXMLDOMDocument=NULL;
IXMLDOMElement *pIXMLDOMElement=NULL;
IXMLDOMProcessingInstruction *pIXMLDOMProcessingInstruction=NULL;
IXMLDOMNode *pIXMLDOMNode = NULL;
HRESULT hr ;
BSTR bstrValue ; try
{
hr=CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_SERVER,
IID_IXMLDOMDocument2, (LPVOID*)(&pIXMLDOMDocument));
SUCCEEDED(hr) ? 0 : throw hr; if(pIXMLDOMDocument)
{
hr=pIXMLDOMDocument->createElement(_T("Node1"), &pIXMLDOMElement);
if(SUCCEEDED(hr) && pIXMLDOMElement)
{
hr=pIXMLDOMElement->put_text(_T("test"));
if(SUCCEEDED(hr))
{
hr=pIXMLDOMDocument->createProcessingInstruction(_T("xml"),
_T("version='1.0'"), &pIXMLDOMProcessingInstruction);
if(SUCCEEDED(hr) && pIXMLDOMProcessingInstruction)
{
pIXMLDOMDocument->appendChild(
pIXMLDOMProcessingInstruction, &pIXMLDOMNode);
pIXMLDOMDocument->putref_documentElement(pIXMLDOMElement);
hr=pIXMLDOMDocument->get_xml(&bstrValue);
if(SUCCEEDED(hr))
{
::MessageBox(NULL, bstrValue, _T("Loaded Doc"), MB_OK);
bResult=TRUE;
}
CHECK_AND_RELEASE(pIXMLDOMNode);
RELEASE(pIXMLDOMProcessingInstruction);
}
}
RELEASE(pIXMLDOMElement);
}
RELEASE(pIXMLDOMDocument);
}
}
catch(...)
{
CHECK_AND_RELEASE(pIXMLDOMElement);
CHECK_AND_RELEASE(pIXMLDOMDocument);
CHECK_AND_RELEASE(pIXMLDOMNode);
CHECK_AND_RELEASE(pIXMLDOMProcessingInstruction);
DisplayErrorToUser();
}
return bResult;
}
Output (in a message box)<?xml version="1.0"?>
<Node1>test</Node1>
--------------------Configuration: FileStream - Win32 Debug--------------------
Compiling...
FileStreamDlg.cpp
d:\microsoft visual studio\myprojects\filestream\filestreamdlg.cpp(4) : warning C4652: compiler option 'Generate Browser Info' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
D:\Microsoft Visual Studio\MyProjects\FileStream\FileStreamDlg.cpp(285) : error C2664: 'createElement' : cannot convert parameter 1 from 'char [6]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\Microsoft Visual Studio\MyProjects\FileStream\FileStreamDlg.cpp(288) : error C2664: 'put_text' : cannot convert parameter 1 from 'char [5]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\Microsoft Visual Studio\MyProjects\FileStream\FileStreamDlg.cpp(292) : error C2664: 'createProcessingInstruction' : cannot convert parameter 1 from 'char [4]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.FileStream.exe - 3 error(s), 1 warning(s)