|
hello
can someone guide me in opening a document i.e .doc or .pdf or .html or .txt in xml/xsl.
can someone help me out
Asim
|
|
|
|
|
this makes no sense, please give us more detail of what you are trying to do
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I have a big XML file and I want to use some XSLT file to transform it, which is the best choice?
I used the DOM process the file, but I found It need a very huge memory. So I used the SAX, but it cann't transform the file with XSLT file.
|
|
|
|
|
Clark John wrote:
So I used the SAX, but it cann't transform the file with XSLT file.
Brief discussion on the topic[^]
Not having used SAX I am no authority but from what I know you use SAX when you want to do simple enough tasks on large XML documents. I think the main thing about SAX is that it is a stream or forward only type method, not like the DOM. Which is why XSL via SAX could be a b with an itch (e.g. XSL templates jump back and forth in an XML doc.)
Paul Watson Bluegrass Cape Town, South Africa
Ray Cassick wrote:
Well I am not female, not gay and I am not Paul Watson
|
|
|
|
|
Thanks. But the DOM process a 3.89M XML file need about 100M memory, how can I reduce the memory dosage on DOM.
|
|
|
|
|
Clark John wrote:
But the DOM process a 3.89M XML file need about 100M memory, how can I reduce the memory dosage on DOM.
Hmmm, I have not had any experience with working with such large XML files (I would consider 3.89M big for an XML file, must have a ton of entries.) Normally I use XML as an intermediary format (database -> xml -> XHTML/whatever) so the files never get big.
Just a thought and I may be totally off the mark but you might just open the XML file as a normal text file and then extract the block of nodes you want out of it and save those as a subset file of the original XML file. Then run that through DOM.
Also XSL on a 3.89M file could potentially be a killer.
This CP article may have some ideas for you and this seems like a starting point for some info.
Good luck
Paul Watson Bluegrass Cape Town, South Africa
Ray Cassick wrote:
Well I am not female, not gay and I am not Paul Watson
|
|
|
|
|
Think you!
|
|
|
|
|
Paul Watson wrote:
Hmmm, I have not had any experience with working with such large XML files (I would consider 3.89M big for an XML file, must have a ton of entries.)
Actualy you'd be suprised at how big some XML files can get.
Paul Watson wrote:
Just a thought and I may be totally off the mark but you might just open the XML file as a normal text file and then extract the block of nodes you want out of it and save those as a subset file of the original XML file. Then run that through DOM.
That's righ on.
At my last place we handeled transactions/data wharehousing for utility companys. Every company sent data in some bizzare flat-file format, EDI, or XML. Depending on the frequency of the transactions, we could see 10mb+ XML files.
We were just doing XML -> DB or DB ->XML -> format 'X'
Working on the XML files we would open up a stream, and use SAX to quickly parse the XML. At this point one could just use their XSL to verify content (we used a custom rules engine to apply business logic.)
Performance wasn't bad with this approach but, I have qualify this by saying that our implementation was done in <gasp> JAVA. With an optimized JVM.
|
|
|
|
|
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
|
|
|
|