|
If you have
<doc>
<node>1</node>
<node>2</node>
</doc>
then the XPath expression node[text()='1'] should select the node with text contents of '1' (i.e. the first node in that document)
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
That's not completely true. You'll have to already be in the doc element, for that to work. If you're not already traversing thru the XML, you'll need to specify the absolute path to a property you want. You can do this by typing /doc/node . That will give you the value within the node element. If you have attributes, they need to be preceded with the at (@) symbol.
http://www.w3schools.com/xpath/default.asp[^]
Michael Flanakin
Web Log
|
|
|
|
|
Hi
I have lot of config data in a table which I want to put in .config file.
Is there any tool using which I can save the data into customized xml file?
Please advice. Thanks
Pankaj
|
|
|
|
|
May be you should place your data in a table and use the forXML T-SQl extension.
This can be done on MS SQL and SQL Anywhere.
The other option is to put it ina Access tbale and export in XML format.
|
|
|
|
|
I'm fairly new to XML and I'm just wondering if there is any difference between using elements or attributes to store data in an XML file. From a programatic view is is better to use one or the other for having to read in the file and such? Are there any performance differences? Is one more flexible than the other?
Any information on the topic is very appreciated.
- Aaron
|
|
|
|
|
There are no rules about when to use attributes, and when to use child elements. My experience is that attributes are handy in HTML, but in XML you should try to avoid them. Use child elements if the information feels like data.
Some of the problems with using attributes are:
.attributes cannot contain multiple values (child elements can)
.attributes are not easily expandable (for future changes)
.attributes cannot describe structures (child elements can)
.attributes are more difficult to manipulate by program code
.attribute values are not easy to test against a Document Type
.If you use attributes as containers for data, you end up with documents that are difficult to read and maintain.
Try to use elements to describe data. Use attributes only to provide information that is not relevant to the data.
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
-- modified at 3:17 Wednesday 14th December, 2005
|
|
|
|
|
i fairly agree with you, i'm newbie too,and i'm always baffled by configuration of document.
|
|
|
|
|
Hi..
I am new to XML.NET Parser...So can anyone help me in providing some good links for XML .NET Parser so that i can load an xml file and validate it with xsd file in VC++..
Kindly provide the links or any advices regarding this..Plz don't tell me to search in Google..I had searched alot..So whoever familiar with XML .NET Parser,plz help me..
Thanks..
|
|
|
|
|
|
|
I have a project, in which we need to read in an XML file. But, when we read in that file, we need to parse it so that only designated data is used. So we parsed it into a string. We now are running into the difficulty of passing the String into the XSLT.
Is there a way to convert a String with XSLT, or do we need to rewrite the XML file?
TIA,
Scott
|
|
|
|
|
You can load the tring into an XMLDocument object much like you load it from file.
HRESULT loadXML(BSTR bstrXML,VARIANT_BOOL * isSuccessful);
This migth be an Microsoft extension of the DOM model, but it exists in
MSXML.
Then it is possible to transform it using the transformNode method of the XMLDocument object.
HRESULT transformNode(IXMLDOMNode *stylesheet, BSTR *xmlString);
/Per
|
|
|
|
|
What language/technology are you using?
Michael Flanakin
Web Log
|
|
|
|
|
Hi
i have an webpage which at the time of loading populates a table. the user can also populate the table by clicking on a button. There is a column called seqno which is populated in "space-SeqNo-space" fashion at the time of loading time population. Same thing when trying to accomplish through javascript it is seen that xsl loading time space is not identical with javascript space.
for example:
XSL:
" 1 "
" 2 " etc.
Javascript:
" 1 "
" 2 "
(here in example to show the effect i am using two space for javascript)
seeming an indentation problem.
My resolution is 1152 X 864.
Another thing for same color-code from javascript and from xsl it shows different color.
Thanks in advance
Chiranjib
|
|
|
|
|
Make sure you escape your '&' characters. I can't see your XSL output, but I'm guessing the problem is that you're using   , which is the equivalent of (a non-breaking space) in HTML. Try modifying the JavaScript to either parse   and as well as spaces or simply replace all occurrences of   and with a space.
xslOutput = xslOutput.replace(' ', ' ');
xslOutput = xslOutput.replace(' ', ' '); That should work... assuming I've guessed the problem correctly.
Michael Flanakin
Web Log
|
|
|
|
|
IXLMDOMDocument2Ptr pDoc;
// test.xml (UTF-8) encoded, :
//<?xml version='1.0'?><root>你好, hello</root>
// check in IE, no problem.
// resource type HTML, or BINARY tried.
// ... create pDoc, find resource, loadresouce,
// create IStream on HGlobal, everything seems ok
// and i checked the dubug info, show xml content correctly,
// and setting the IStream to the beginning of IStream
// but...
pDoc->async = VARIANT_FALSE;
pDoc->load(_variant_t(pStream)); // FAILs, it complains that no top level element in xml.
// but, when i write the stream into a disk file,
// and load form file, it's OK !!!
// if use loadXML((LPTSTR)hGlobal) the charactor shown is not correct.
|
|
|
|
|
It should not be much of a problem. I do it like this in a project (With all error handling removed. It just clutters up the example.)
int CHookApp::LoadXML (int rsrc, MSXML2::IXMLDOMDocument2Ptr& xml, CString& errMsg)
{
HRSRC hXSLResourceInfoBlock;
HGLOBAL hXSLResource;<br>
hXSLResourceInfoBlock = ::FindResource (m_hInstance, MAKEINTRESOURCE(rsrc), "XSL");<br>
if (hXSLResourceInfoBlock)
hXSLResource = LoadResource (m_hInstance, hXSLResourceInfoBlock);<br>
if (hXSLResourceInfoBlock == NULL || hXSLResource == NULL)
return -1;<br>
try {
_bstr_t xmlText ((char*)LockResource (hXSLResource));
if (xml->loadXML ( xmlText ) == VARIANT_FALSE)
return -1;<br>
}
catch (...) {
return -1;<br>
}<br>
return 0;
}
I wonder why my empty lines are removed from the <pre> block above. It remained in another reply of mine.......
-- modified at 5:03 Wednesday 14th December, 2005
|
|
|
|
|
Dear Experts,
I need some information on dynamic updation of XML file.
Our application asks the user to insert a file by giving the user browsing option.
We want our XML file (which contains the information about the residing files) to be dynamically updated as soon user specifies the path of the inserted file.
The next task is to dynamically update the XML file once the user select the file to be deleted by clicking on the Application UI.
We have to develop the code in C++.
Kindly send across your suggestion, opinion and helpful codes.
Regards,
Mayank Srivastava
Regards,
Mayank Srivastava
|
|
|
|
|
This may not belong in this section, but just a try.
How do you convert ByteArray into a Jpeg image?
|
|
|
|
|
byte[] buffer;
System.IO.MemoryStream ms = new System.IO.MemoryStream(buffer);
System.Drawing.Bitmap bm = new Bitmap(ms);
bm.Save("FilePath", System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
|
|
Thanks a lot. I am really looking for code that can be implemented in the client [in Javascript].
Much obliged.
mysorian
|
|
|
|
|
Alguien tiene informacion sobre integracion de esquemas para base de datos,(teoria) y alguna aplicacion.
|
|
|
|
|
hi, i don't know how to add diferents rows to the same column, and i would like to know if somebody could tell me.:->
La Light
|
|
|
|
|
Iridania wrote: hi, i don't know how to add diferents rows to the same column, and i would like to know if somebody could tell me
You want to insert Row and Column in what thing ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
hi,
Help me anyone please... I want to create a tab control in asp.net application using xml.
baski
|
|
|
|