|
Using BSTR, Variant should be fine but keep in mind that the memory block you are writting to the document must be compliant with allowed characters. This is espcially true with using the attribute data blocks vs a CData section. Just think of handling the transmission over a http connection. You would have to encode/decode the data. The same concept can apply here. Encode the binary into a string and set it to be the attribute value is one path I have used for smaller sets of information.
"I will find a new sig someday."
|
|
|
|
|
Thanks, no one seems to know much about this.....
I have no experiance with http connections/communictions. Is it possible for you to dumb it down a bit?
Encoding/decoding to me means stripping out the " ", "<", ">" etc characters, and replacing them when reading. Is this true? Are you aware of any functions available that will do this for me? I've found http://www.codeproject.com/internet/mimesniffer.asp Is this the sort of thing I should be using?
My data will typically go to 20 to 30 attributes, each of which will be less than 1 KByte.
|
|
|
|
|
Here is some code I did awhile back.
You need to remove nondisplay as well as conflicting characters from the display.
CString EnCodeStr(CString ToCode)
{
CString RetStr,AddStr;
int i,max;
unsigned short asc;
unsigned char c;
max = (unsigned int)ToCode.GetLength();
// For binary you need to send the length, The block could have zeros
for(i=0;i<max;i++)
{
c =="" tocode[i];
asc="c;
if(asc">47 && asc<58)
{
RetStr+=c;
}
else if(asc>64 && asc<91)
{
RetStr+=c;
}
else if(asc>96 && asc<123)
{
RetStr+=c;
}
else if(asc==32)
{
RetStr+="+";
}
else
{
AddStr.Format("%%%02x",asc);
RetStr+=AddStr;
}
}
return RetStr;
}
CString DeCodeStr(CString ToCode)
{
CString RetStr,AddStr;
int i,max;
unsigned short asc;
unsigned char c;
max = (unsigned int)ToCode.GetLength();
for(i=0;i<max;)
{
c =="" tocode[i];
asc="c;
if(asc==37)
{
AddStr=ToCode.Mid(i+1,2);
i+=3;
sscanf((LPCTSTR)AddStr,"%2x",&asc);
RetStr+=(char)asc;
}
else" if(asc="=43)
{
RetStr" +=" " ;
i++;
}
else
{
retstr="" retstr;
}
for="" smaller="" blocks="" that="" you="" mention="" this="" should="" be="" ok.
now="" i="" am="" assuming="" a="" mfc="" solution="" is="" ok.
to="" get="" the="" data="" into="" string="" one="" option="" to="" use="" cmemfile="" detach()="" and="" attach()="" functions.
sorry="" do="" not="" have="" time="" sample.="" would="" think="" could="" search="" on="" above.
=""
<b="">"I will find a new sig someday."
|
|
|
|
|
That sample's great, thanks. My main concern was what you meant by coding and encoding. If that's good enough then fantastic!!!!
thanks again.
|
|
|
|
|
Glad it helped. Take care.
"I will find a new sig someday."
|
|
|
|
|
Maybe I am missing what Michael is getting at but I don't think he is entirely correct. The base64Binary datatype by definition doesn't require any replacements to be legal in an xml document as when it is encoded it uses the characters 0-9 a-z A-Z '+' '/' ie no replacements required see section 6.8 of http://www.ietf.org/rfc/rfc2045.txt for details (this page is linked to by the Schema spec). Also be aware that most XML DOM do translations required ie you set strings containing '>' '&' etc and they will automatically be converted on output to < and &, however I'm not sure if this is the case for binary types.
If possible I would be tempted to use the hexBinary datatype as I find that easier to understand, two characters (0-9 a-f) are used to represent each hex octet ie 0x7f10 would be "7f10" in your XML doc.
Hope I haven't confused you...
|
|
|
|
|
No, that makes a bit more sense to me, and sounds easier to implement and check.
Is there an easy way to convert the 0x7f10 to "7f10"?
sprintf("%08h", intArray[0]) is OK for an int, but a bit tedious for arrays.
Is there a "short cut" here, or am I stuck with a loop?
Being able to calculate the length of the final string from the input string seems to me like a major advantage over Michael's code.
|
|
|
|
|
Thanks for correcting this. I guess I have been working to long. I totally over looked base64Binary was mentioned and just read a binary memory block in a BSTR field.
Take Care.
"I will find a new sig someday."
|
|
|
|
|
I use the MSXML IXMLDOMDocument to load and save settings of a Visual C++ Project. My code looks like this:
<br />
hr = Document.CoCreateInstance(__uuidof(DOMDocument));<br />
if (FAILED(hr) || (Document.p == NULL)) throw (IDS_XML_CANT_CREATE_XML_PARSER);<br />
<br />
VARIANT_BOOL Success = false;<br />
hr = Document->load(CComVariant(m_szFilename), &Success);<br />
if (FAILED(hr) || !Success) throw (IDS_XML_SETTINGS_CANT_LOAD_SETTINGS);<br />
Everything works fine and is square with the MSDN recommandations. But I still have a tiny problem: I decided to use XML in order to allow my users to manually edit the conf file but right now, the parser writes everything on a single row, making it hard to read.
It is important to tell the parser to write tabs, spaces and linefeeds ...
but how ???
|
|
|
|
|
Look for the whitespace settings (options). carraige returns and line feeds are just child text nodes.
Your users should be able to add the linefeed text manually and not impact your reading the data back in as a last option.
"I will find a new sig someday."
|
|
|
|
|
How come the "Copy Project" option in VS.NET is always disabled whenever I need to transfer a finished web service on my local computer to my remote web host's server? (I was always able to use this method to tranfer my ASP.NET projects).
Therefore, I had to copy the files manually via FTP. The files I copied were:
1) myService.asmx
2) myService.vsdisco
3) global.asax
4) web.config
5) bin folder which contains: myService.dll
All these files and the "bin" folder were copied to a folder called MyServiceFolder located at the root of my website's directory structure. But whenever I try to access the service (http://www.mysite.com/MyServiceFolder/myService.asmx) it fails. And it will not display the specific error because it could not locate the web.config (where <customerrors="off">).
However, when I move the web.config file out of the MyServiceFolder and into the parent folder, and tried it again, it was able to tell me the specific error: "Parser Error Message: Could not create type 'MyNamespace.MyClass'." But this means that my web service is still not working.
After some more trial and error, I was able to access my web service. What I did was that I also moved the "bin" folder out of the "MyServicefolder" and into the parent folder (where web.config is sitting). This made everything to work.
The location of my files on the server now looks like this (which is kinda too messy):
1) /web.config
2) /bin/myService.dll
3) /MyServiceFolder/myService.asmx
3) /MyServiceFolder/myService.vsdisco
4) /MyServiceFolder/global.asax
But the point is that I want to be able to organize all of my projects (web service, asp.net apps, etc) into their own folders on the server. So my big question is how can I put this web service into one folder such as MyServiceFolder, and make it work?
Is there some configuration/setup file where I can edit the path directories?
My other big question is how come I cannot use the "Copy Project" option to transfer web services to a remote server?
PLEASE HELP! Thanks.
|
|
|
|
|
Pls look at the link below so as to understand my problem..... its just a very short page so pls look at it.....
http://www.xmlfiles.com/articles/michael/htmlxml/default.asp
For the above link, the datas are being saved to xml using 'processForm.asp', if i cant use 'ASP' and my only choices are 'JSP' or 'Java' , 'XSL' to display. Can it be done???
Any websites that have similar examples or links will be greatly thankful.....
|
|
|
|
|
|
I am working on a parser using VC++ that utilizes MSXML 4.0. I have built a release version . I need to deploy this on another machine that doesnt have MSXML installed. How can I know which components(.ocx's or dll's) to include ?
Please help
|
|
|
|
|
|
You may want to check the legal redistribution on this. It may require you to use their setup vs just including the pieces.
"I will find a new sig someday."
|
|
|
|
|
Thanks for the reply. I would like to know how exactly to use the cab file .
|
|
|
|
|
You may want to ask Richard this. It has been several years since I actually prepared any distributions. At that time I was using the Wise Installer product line.
"I will find a new sig someday."
|
|
|
|
|
Does anybody know about a DTD repository where I can find already defined DTDs for specific applications. For example, I am currently looking for a DTD that defines the rules for XML files that are to include bug information. I would like to integrate this into an Open Source bugtracker.
http://mantisbt.sourceforge.net[^]
Regards,
Victor
phpWebNotes is a page annotation system modelled after php.net.
http://webnotes.sourceforge.net/demo.php[^]
|
|
|
|
|
The purpose of a shared DTD is to established an agreed format between multiple clients. I don't see the purpose of the sort of repository you're proposing.
you should also abandon DTD's - they suck. An XSD is the way to establish schema information.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
If you implement an export-to-xml feature into your software, you will have to define a format for it. So instead of me re-inventing the wheel and defining this format (formally through DTD or informally), I was looking for an already defined format to re-use. Another advantage of using an already defined format, is that it can be used as a standard for exporting defects from one Bug tracker and importing them into another. There can also be an already existing XSLTs to convert it into different formats.
I would expect the format to look like the following:
<bugs>
<summary>
</summary>
<description>
</descripion>
... and so on...
</bugs> Regards,
Victor
phpWebNotes is a page annotation system modelled after php.net.
http://webnotes.sourceforge.net/demo.php[^]
|
|
|
|
|
Yes, but why would competing products publicise their formats so that other products can offer easy export to customers leaving them ? And as you say, XSLT is a good tool for converting formats, although less so DTD, compared to XSD.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
why would competing products publicise their formats
1. If these products are Open Source products, then they actually publicise everything including the code, not just the format!
2. If the DTD or XSD is designed by a standards organisation. The same way HTML DTD are defined by w3c.
3. In some cases there are projects that are focused around XML/DTD. For example, I once saw a Resume project that defines a XML format to store resume information which is then used to different formats including HTML/PDF/...etc with different styles as well.
In addition to all of the above, there is HOPE I was just checking before I go and design my own format. After all we are all here to learn and re-use whatever we can!
Regards,
Victor
phpWebNotes is a page annotation system modelled after php.net.
http://webnotes.sourceforge.net/demo.php[^]
|
|
|
|
|
LOL - I'll give you one and three, excepting that the fact that one person defined a resume DTD does not mean that everyone will use it. But as you say, there is always hope..... :P
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
Yes, but why would competing products publicise their formats so that other products can offer easy export to customers leaving them ?
Because, It is a requirement for my company to purchase 5000 seats of your product, if you want our buisness.
"I will find a new sig someday."
|
|
|
|