|
What SAX implementation are you using?
You can definitely transform an xml data set with either (assuming your implementation supports transformations.) However what you have to understand is that the order of processing is not necessarily the same so the XPath expression in the XSLT definition may be different to handle the file depending on a DOM implementation vs a SAX implementation.
For large files SAX definitly takes less memory.
"We are what we repeatedly do. excellence, then, is not an act, but a habit." Aristotle
|
|
|
|
|
Can you get me some advise of SAX implementation? Thank you.
|
|
|
|
|
I definitly will be willing to offer some comments.
Some of my background to let you understand the limits of what I can offer.
For the last 18 months I have not been programming (much), as I am now a system architect (Manager egad.) For our needs we have been building upon the Apache Cocoon project. It however is Java based (again so others have been doing the programming that I have spec'd, I am still a C++ guy.) Due to the above most of our parser usage has been with the Java versions of Apache Xerces and Xalan. A warning here. There are C++ versions but I have found the Xalan is quirky and have stayed away from it.
I am assuming you are using the MSXML parser. I have not used the SAX implementation of it. However:
For some reference just type in MSXML and SAX into google.
I just did and the first page was
http://www.perfectxml.com/msxmlsax.asp
It looks like it has a intro and several references. Might be a starting point.
I then added Transformation to google and found
http://www.perfectxml.com/msxmlxslt.asp
google must like perfetxml today
The big issue is here what is happening between the parsers. In DOM you have the whole thing and can process the data in how ever you see fit. In SAX you are responding to events that are thrown as the data stream is read. You may have to think a little here but the impact is the sequence of how you have to respond to those events may be different.
I suggest get a tool that will step through or at least display the results of a transformation. Start with a simple example to get a feel of what is happening.
Some I can recommend are
Marrowsofts ($ but a 30 day eval)
StylusStudio (Same)
There are some other free tools also.
see http://www.garshol.priv.no/download/xmltools/name_ix.html
I have used "CookTop" http://www.xmlcooktop.com/ in the above list and for a free tool it works fairly well.
I hope this helps some.
"We are what we repeatedly do. excellence, then, is not an act, but a habit." Aristotle
|
|
|
|
|
Mr. Manager:;)
It's a "perfect XML", thank you!
|
|
|
|
|
hello,
i need help on converting xsl-fo to pdf or doc or html , using c#(sharp)
can someone help me.
Asim
|
|
|
|
|
|
My brief exposure to XML has been restricted to writing a compiler using SAX (in Java). I'm now back in C++/MFC land and need to populate a data structure with data read from an XML file, validated against a DTD. I also need to create an XML file, given a DTD.
Can you recommend a good "teach yourself DOM in 21 minutes" book or link? I'd especially like to know how to use DTDs to validate incoming data and write XML files.
Thanks!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello,
I am trying to do some sorting (depending on an attribute) using XSL, it is kindof working, but my attribs are being sorted like strings.
eg. the sequence 1,2,10 when sorted, comes out:
2,10,1 instead of 10,2,1
How could i fix this?
Cheers,
JEremy.
Jeremy Pullicino
Professional C++ Developer
Done any hacking lately?
|
|
|
|
|
<xsl:sort
select="@attribute_name"
order="descending"
data-type="number"
/>
|
|
|
|
|
Hello,
I am trying to load XML document in the browser from a JavaScript variable. The
reason is when I create XML document from a Database I don't want to store it
on a disk and then load from a disk, I just want to pass it to a browser as a
string/variable.
Well, I know how to do it in IE: by using xmlDoc.loadXML method like in example
below
var xmlStr = "<cat><cd><title>Empire<artist>Bob
Dylan<cd><title>Hide<artist>Bonnie";
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.onreadystatechange = tmp;
xmlDoc.loadXML(xmlStr);
function tmp()
{
if (xmlDoc.readyState == 4) generateFromXML();
}
function generateFromXML()
{
// processing code
// ...
}
In Netscape 6 I use:
var xmlStr = "<cat><cd><title>Empire<artist>Bob
Dylan<cd><title>Hide<artist>Bonnie";
xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = generateFromXML;
xmlDoc.loadXML(xmlStr);
function generateFromXML()
{
// processing code
// ...
}
Well, xmlDoc.loadXML(xmlStr) doesn't work.
Does anybody know how to do the same thing in Netscape 6?
Thanks
Hitesh
|
|
|
|
|
I want an xslt-doc that changes an unknown document where the node foo is known to have the attribute bar. bar should change to "changed", but the remainder of the document should remain the same. the xsl:copy is obvious, but how do I copy all attribs but bar?
|
|
|
|
|
I know this might sound like a stupid question...
If I want simple XML capabilities in my C++ application using the MS XML com objects, what needs to be installed on a default W2K installation?
Must I include the MS XML engine in my installation package, or can I recommend a minimum version of IE to be installed?
thanks,
jeremy
Jeremy Pullicino
Professional C++ Developer
Done any hacking lately?
|
|
|
|
|
Full table here[^].
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
|
i have the following xml document with a default namespace.
<?xml version='1.0' ?>
<ROOT xmlns="mynamespace">
<FIRST>something</FIRST>
<ROOT>
i did all the MSXML4 necessary things to work with the default namespace and got the Xpath expression working with the selectsinglenode() and selectnodes().
now when i create the <SECOND> tag , i get an unwanted empty xmlns attribute in the new tag and its causing all the Xpath expression to break.
<?xml version='1.0' ?>
<ROOT xmlns="mynamespace">
<FIRST>something</FIRST>
<SECOND xmlns="">something</SECOND>
<ROOT>
how do i get rid of this xmlns="" attribute? I tried removeNamdItem("xmlns") but it does not work. how do i prevent the empty xmlns attribute from apprearing?
a workaround i did was to get xmldoc->getxml(), search and replace the xmlns="" but that is not a viable solution.
thanks..
meng
|
|
|
|
|
Have you tried using createNode(NODE_ELEMENT, "SECOND", "mynamespace") to create the element?
|
|
|
|
|
thanks for your advise! solved.
if (GetDefaultNamespace().IsEmpty())
{
// Create element with no namespace
spNewNode = spXmlDoc->createNode(MSXML2::NODE_ELEMENT, _bstr_t(_T("SECOND")), "");
}
else
{
// Create element with default namespace
spNewNode = spXmlDoc->createNode(MSXML2::NODE_ELEMENT, _bstr_t(_T("SECOND")), _bstr_t(_T("mynamespace")));
}
huikm
|
|
|
|
|
Hey,
This must be SO easy to do and must be documented SOMEWHERE but I haven't been able to find out it.
What I want to do is
<tag attr="<tag1>">hey</tag>
But the attr doesn't work. It just doesn't display in HTML when formatted by XSL because it is converted as a tag.
Hope this makes sense
Robbie G
|
|
|
|
|
So, do:
<tag attr="<tag1>">hey</tag>
Shog9
------
And on the pedestal, these words appear:
"My name is Ozymandias, King of Kings,
Look on my Works, ye Mighty, and despair!"
Nothing beside remains.
|
|
|
|
|
How to convert a string with special caracters to
a string correctly read by XML ?
A special function in VC++ ?
Used a MSXML parser function ?
Thanks for your response !
|
|
|
|
|
Yes, MSXML should work, you can use SetText(), etc.
Shog9
------
No one's immune now, from a world of problems
No one's exempt now, from a world of pain
That's the way that it goes
when you're down here with the rest of us...
|
|
|
|
|
I have objects that I want to save to a file (XML format, generated by serialization). I also want the data to be encrypted. Should I encrypt the objects before they are serialized/saved to XML, or should I serialize and then encrypt the whole XML document? Which method is easier/more efficient, and why?
On a side note, where can I find a good, straight-forward tutorial for encryption using .NET (specifically, C#)? Thanks in advance.
|
|
|
|
|
Traditionally its better to encrypt something that has little redundancy, i.e. with little repetition. This is often why text files are compressed before they are encrypted, then decrypted and decompressed at the other end.
It's difficult to suggest something without a little more info about what it is you're trying to encrypt. Do you mean encrypt individual members of a type, like a string field containing a name or something?
For ease its probably better to just encrypt the XML document, if you want to you could always find some .NET code to compress the document beforehand and then encrypt that.
--
Paul
"I need the secure packaging of Jockeys. My boys need a house!"
- Kramer, in "The Chinese Woman" episode of Seinfeld
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
i introduced a namespace into the XML document and all the Xpath construct did not work. It was working before i introduced the namespace. what is wrong?
<?xml version="1.0" ?>
<ROOT>
<TEST>something 1</TEST>
<TEST>something 2</TEST>
<ROOT>
selectNodes(_bstr_t(_T("//TEST")); // working
with namespace
<?xml version="1.0" ?>
<ROOT xmlns="http://www.mynamespace.com">
<TEST>something 1</TEST>
<TEST>something 2</TEST>
<ROOT>
selectNodes(_bstr_t(_T("//TEST")); // error
i added the namespace cos i am doing xml schema validation using MSXML4 which turned out to be ok.
but with the xmlns..., all the xpath expressions failed.
This is my first encountered with namespace in xml document
appreciate any help advise. thanks
meng
|
|
|
|
|