|
Hi frnds..
Im using for-each and in a particular cell i have to create link and should open other worksheet of the same workbook..
I have used generate_id function but at runtime i will not able to get the sheet name and attach the link do that sheet...
Help me out if there is any other way...
Thnks...
|
|
|
|
|
I've been wondering about this and I've been using IXMLDOMNodePtr.
Is there a difference bet. IXMLDOMNodePtr & IXMLDOMNode *? Which is better than the other??
How come the word Ptr becomes equated with * in actual code??
Any idea or any links for this info??
Thanks!
|
|
|
|
|
It's just a macro, they are the same,
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Hello alls
I am writing a program in which i need to display XML data to table row in loop, in my program i can read XML and also display it using alert() function, but i am not able to display that XML to in table row. my program code is below. Can any one help me regarding it.
function RT(str)
{
for(var i=0; i<6; i++)
{
alert(str.substring(i,1));
}
}
text = new Array();
function parseXML()
{
var module = document.getElementById('module').value;
var version = document.getElementById('version').value;
var s_key = document.getElementById('s_key').value;
var uid = document.getElementById('uid').value;
var lang = document.getElementById('lang').value;
var strUrl = 'api/index.php?module='+module+'&version='+version+'&s_key='+s_key+'&uid='+uid+'&lang='+lang;
var str_xml='';
AjaxRequest.get(
{
'url':strUrl
,'onSuccess':function(req)
{
text = req.responseText;
text = text.substring(4);
text = TrimAll(text);
alert(text);
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(text);
}
catch(e)
{
try // Firefox, Mozilla, Opera, etc.
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(text,"text/xml");
}
catch(e)
{
alert(e.message);
return;
}
}
var data_node=xmlDoc.getElementsByTagName("data").item(0);
var data_node_len=data_node.childNodes.length;
for(var i=0;i<=(data_node_len/2);i++)
{
var id =data_node.getElementsByTagName("id")[i].childNodes[0].nodeValue;
// var dev_name =data_node.getElementsByTagName("device_name")[i].childNodes[0].nodeValue;
// var rep_int =data_node.getElementsByTagName("reporting_interval")[i].childNodes[0].nodeValue;
document.getElementById("device_name"+"i").innerHTML =data_node.getElementsByTagName("device_name")[i].childNodes[0].nodeValue;
document.getElementById("report_inter"+"i").innerHTML =data_node.getElementsByTagName("reporting_interval")[i].childNodes[0].nodeValue;
}
}
}
);
}
here : device_name and report_inter and that td id's where i want to show it ..... This program is not working can any one please told me where i am wrong.
Regard's
Kaushik
|
|
|
|
|
Hi,
I am just new to XSL. Hope anyone can help regarding my problem.
Problem: I only want to display the node for ITEM/DESC and ITEM1/DESC1. How to make conditions or file the xml using XSL.
THank you.
jollymj23
Sample.xsl
<xsl:for-each select="root/child" xmlns:xsl="#unknown">
<xsl:value-of select="childnode">
<xsl:for-each>
Sample.xml
<root>
<child>
<node>
<childnode>ITEM
<childnode>DESC
<node>
<childnode>ITEM1
<childnode>DESC1
<child>
<node>
<childnode>ORDER
<childnode>DESC
|
|
|
|
|
If I've got your sample correct:
<root>
<child>
<node>
<childnode>ITEM</childnode>
<childnode>DESC</childnode>
</node>
<node>
<childnode>ITEM1</childnode>
<childnode>DESC1</childnode>
</node>
</child>
<child>
<node>
<childnode>ORDER</childnode>
<childnode>DESC</childnode>
</node>
</child>
</root>
You can use XPath to filter the result:
<xsl:for-each select="//node[starts-with(string(childnode),'ITEM')]">
<xsl:value-of select="position()"/>
<xsl:text> </xsl:text>
</xsl:for-each>
This should print out 1 2 as it will select the first two node elements.
|
|
|
|
|
Hi,
I'm trying to work out how to do the following..
Within an XML data source, each <data-item> has a <countries> element containing a comma-separated list of country-codes e.g.
<data-item> <countries>GBR,ARG,IRL</countries> </data-item>
Within the XSLT I've build a lookup like...
<CountryList><Country><Code>GBR</Code><Name>United Kingdon</Name></Country></CountryList>.
I want to get a list of all the countries, in <CountryList> order, for which there are entries in one or more <countries> elements.
I've tried using exsl:node-set to build a set of nodes from the CountryList, then for-each to iterate those nodes, but can't work out how, within the for-each, to get an if test to work (somehow using contains() to see if the code for that country is within any <countries> element).
Anyone got any suggestions?
|
|
|
|
|
Hi,
i'm really new to XML, XSL
i'm trying to show a string that is Generated by a Given Loaigcal Algorithem From a JS Function
(I.E if status is Failed so Display XXXX if Passed XXYY .... )
i'm trying to give The String some Colors Like :
I'm (In blue) Trying (In Red)
any IDEA???
Have Fun
Never forget it
|
|
|
|
|
what does displaying colored text using javascript have to do with XML and XSLT?
half-life wrote: Generated by a Given Loaigcal Algorithem
What does Loaigcal mean?
led mike
|
|
|
|
|
|
1.) How do you change the the attribute value of a certain node?? Or add an attribute to a node??
Say for example:
<book id="bk112" status="New">
Then you want to change the status value to "Old" and add another attribute like Cover="SoftBound".
The IXMLDOMNode::Getattributes() can be used to get the attributes of a node. This will return a ptr to IXMLDOMNamedNodeMap. To access each attribute, the Getitem() function which will return a ptr to IXMLDOMNode. I know how to get the attributes name and value but to change it, it seems like Im stuck... I can see a setAttribute() function in IXMLDOMElement... It looks like the answer to my first question.. BUT, how am I gonna implement when the Getitem returns a ptr to IXMLDOMNode and not to IXMLDOMElement?? IXMLDOMElement inherits from IXMLDOMNode but this can't be solve by casting...
2. How can IXMLDOMNode be converted to IXMLDOMElement??
ANy ideas please?? or any solution..
Thanks!
|
|
|
|
|
SimplySane wrote: IXMLDOMElement inherits from IXMLDOMNode but this can't be solve by casting...
If you are using COM interfaces then you use COM interfaces right? QueryInterface()? However for working with the MSXML DOM in C++ I recommend using #import to generate ATL code for you. If you do then you can cast because the ATL code will perform the QueryInterface for you.
http://www.ddj.com/windows/184416877[^]
led mike
|
|
|
|
|
Yes, you're right.. I was able to cast succesfully but I got a runtime error when I tried to use the setAttribute.. Here's what I did:
IXMLDOMNodePtr pAttN = pMapAtt->Getitem( y );
IXMLDOMElementPtr pAtt;
CString csOutAttName = static_cast<LPCTSTR>( pAttN->nodeName );
CString csOutAttText = static_cast<LPCTSTR>( pAttN->Gettext() );
pAtt = (IXMLDOMElementPtr) pAttN;
BSTR bstrOutAttName = csOutAttName.AllocSysString();
pAtt->setAttribute( bstrOutAttName, static_cast<_variant_t>( csInAttText ) );
::SysFreeString( bstrOutAttName );
I've got an exception in this line:
pAtt->setAttribute( bstrOutAttName, static_cast<_variant_t>( csInAttText ) );
Looking up at setAttribute function, it has this syntax:
setAttribute(BSTR, VARIANT)
I havn't figure out what's causing the problem here and Im thinking that passing the _variant_t to a VARIANT might be the problem?? (Assuming I cast the right way..)So I've tried searching for ways on how to cast CString to VARIANT, but didn't find anything that works..
Any idea please... Thanks!
|
|
|
|
|
first why use CString unless you are manipulating the string value?
this should work
pAtt->setAttribute( pAttN->nodeName, pAttN->Gettext());
When you must have a BSTR variable prefer using _bstr_t rather than LPCSTR or
CString<br />
<br />
_bstr_t sname = pAttN->nodeName;<br />
_bstr_t svalue = pAttN->Gettext();<br />
<br />
pAtt->setAttribute(sname,svalue);<br />
Take a look at _bstr_t it has built in conversions to/from BSTRT -LPCTSTR I believe, I haven't worked with this stuff for a couple years now, but I think it's comprehensive, ctors that take either and conversion operators that get either so all you do is cast to the type you want.
led mike
|
|
|
|
|
I am trying to digitally sign an XML document in C++. Yes, I know that it is easy in .NET 2.0, but alas cannot use that!
An extract of the XML document is below.
All I am trying to do is calculate the DigestValue over the XML sub-document with Id=MsgOperation. I know that the data from this sub-document is converted into a hash with SHA-1 and then Base64.
The problem I am having is converting the sub-document using EXEC-C14N. I am trying to use the LibXML2 library (very good), to EXEC-C14N the sub-document with:
[code]
CString CDigitalCerts::C14N( const char* pszXml, const bool bExclusive )
{
CString sRet = _T("");
xmlChar* pOutput = NULL;
xmlDocPtr pXmlDoc = xmlReadMemory( pszXml, (int)strlen( pszXml ), _T("xml"), NULL, 0 );
int result = 0;
void* pData = NULL;
xmlOutputBufferPtr buf = 0;
if ( pXmlDoc )
{
result = xmlC14NDocDumpMemory( pXmlDoc,
NULL,
(int)bExclusive,
NULL,
0,
&pOutput );
}
xmlFreeDoc( pXmlDoc );
if ( result > 0 )
{
sRet = (LPCTSTR)pOutput;
}
xmlFree( pOutput );
pOutput = NULL;
return sRet;
}
[/code]
If anyone has used the xmlC14NDocDumpMemory function before from the libxml2 library and can advise what I need to add to its 2nd argv (nodes) or the 4th argv (inclusive_ns_prefixes), I would appreciate it. Or what the <ns1:operation ...="" xmlns:ns1="#unknown"> node once EXEC_C14N'ed looks like I would again be very grateful.
[code]
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<ns1:Operation Id="MsgOperation" soapenv:mustUnderstand="0" xsi:type="xsd:string" xmlns:ns1="http://www.ros.ie/schemas/service/" xmlns:xsi="http://w
ww.w3.org/2001/XMLSchema-instance">CT1/File</ns1:Operation>
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">
...
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#MsgOperation">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue></ds:DigestValue>
</ds:Reference>
...
</ds:SignedInfo>
<ds:SignatureValue>
</ds:SignatureValue>
<ds:KeyInfo>
<wsse:SecurityTokenReference>
<wsse:Reference URI="#X509Token"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature></wsse:Security> </soapenv:Header>
[/code]
|
|
|
|
|
Andy H wrote: If anyone has used the xmlC14NDocDumpMemory function before from the libxml2 library
No, I have never used the libxml2 library.
Andy H wrote: can advise what I need to add to its 2nd argv (nodes) or the 4th argv (inclusive_ns_prefixes),
Does this help[^]?
led mike
|
|
|
|
|
Well what was the point of your reply? How f******* stupid.
|
|
|
|
|
Andy H wrote: Well what was the point of your reply?
The point was the link I supplied that appears to define the parameters you asked about, you f***ing moron. F*** off a**hole.
led mike
|
|
|
|
|
I am very sorry, I did not spot the link in your reply.
Thanks, but I have seen the page you referred to.
|
|
|
|
|
Andy H wrote: I am very sorry, I did not spot the link in your reply.
Oh, ok, no problem, simple mistake, I make them all the time, I even make complicated mistakes.
Andy H wrote: Thanks, but I have seen the page you referred to.
Ok then I need more specific information about what you need to know.
nodes : Is a NodeSet that will act like a filter so that it will only dump those nodes rather than the entire document.
inclusive_ns_prefixes : Is a string array of the namespaces, where the last element of the array is NULL.
Based on the doc you can pass NULL for both of those and it should still work.
led mike
|
|
|
|
|
I am currently parsing NULL to both those arguments. But because I am extracting the node with the Id attribute set to "MsgOperation", I am obviously missing namespace declarations etc that are in the parent node, as a result my computed DigestValue is incorrect.
All I require at the moment is for someone to let me know what the EXEC_C14N result of the said node which is then fed into the SHA-1 algorithm and Base64'ed the result of which (i.e. DigestValue) is:
wJsL4RtLToFeHW/xt2ewbAAiNxk=
That way at least I could get some idea of what the node is transformed into as a result of the EXEC_C14N process!
|
|
|
|
|
Andy H wrote: All I require at the moment is for someone to let me know what the EXEC_C14N result of the said node
Sorry, I don't have an environment established where I can do that. Since you have the XML yourself why can't you just give the namespace argument to the function?
led mike
|
|
|
|
|
I tried that, didn't work. I will be working on it further tomorrow. If I get it to work I will post what I did to resolve the issue.
|
|
|
|
|
Just to let anyone know, if they are interested, that I have manually worked out the result of the EXEC-C14N for the //ns1:Operation node of the XML posted in my orriginal message above, to be:
[code]
<ns1:Operation xmlns:ns1="http://www.ros.ie/schemas/service/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Id="MsgOperation" soapenv:mustUnderstand="0" xsi:type="xsd:string">CT1/File</ns1:Operation>
[/code]
This helped
|
|
|
|
|
Andy, I'm glad you solved your problem.
The only difference in your solution XML from your original post is the addition of
<br />
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
If that was the question you were asking I never even got close to understanding your question.
led mike
|
|
|
|