Solved

Support of SAX Parser with ASP

Posted on 2001-07-12
3
1,053 Views
Last Modified: 2012-08-13
Hi all
 Can we use a SAX parser in ASP Coding.. How to use it and also provide the code to do socode.

if we instantiate XMLDom at client side does Netscape brwose support . since Msxml dll file comes along with IE will netscape support i.e a system having only Netscape browser support the xmldom instantiation at client side does the msxml dll be present along with  netscape ?

0
Comment
Question by:indu_ma
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
edmund_mitchell earned 50 total points
ID: 6280600
Of course you can use a SAX parser in ASP coding.  One needs only to instantiate the parser, load the file, instantiate the content handler and code the content handler implementation. So certainly you can do a transform using a SAX parser.

ASP
<%Response.ContentType = "text/xml"
     
    Dim generator, ch
    ' instantiate XML generator class
    Set generator = Server.CreateObject("XMLFilesVBSAX.CGenerator")
    Set ch = Server.CreateObject("XMLFilesVBSAX.CSerializer")
    ch.RegisterOutputStream Response
    generator.generateXML ch
%>

Then ->

<%Response.ContentType = "text/xml"
     
    Dim reader, ch
    ' instantiate XMLReader class
    Set reader = Server.CreateObject("MSXML2.VBSAXXMLReader.3.0")
    ' instantiate class that implements IVBSAXContentHandler
    Set ch = Server.CreateObject("XMLFilesVBSAX.CSerializer")
    ch.RegisterOutputStream Response
    ' turn off namespace prefixes
    reader.putFeature "http://xml.org/sax/features/namespace-prefixes", False
    ' register ContentHandler implementation
    Set reader.contentHandler = ch
    ' begin processing document
    reader.parseURL "file://c:\temp\whatever.xml"
%>

And lastly ->

<%    
    Dim reader, ch
    ' instantiate XMLReader class
    Set reader = Server.CreateObject("MSXML2.VBSAXXMLReader.3.0")
    ' instantiate class that implements IVBSAXContentHandler
    Set ch = Server.CreateObject("XMLFilesVBSAX.CInvoice2HTML")
    ' turn off namespace prefixes
    reader.putFeature "http://xml.org/sax/features/namespace-prefixes", False
    ' register ContentHandler implementation
    Set reader.contentHandler = ch
    ' begin processing document    
    reader.parseURL "file://c:\temp\whatever.xml"
%>

These code snippets will serialize XML into HTML or vice versa (uses a whatever.xml file - not included).  There's much more you can do, but this is a simple start.

Also, you might get some mileage from this M$ website:

http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnxml/html/vbsax2jumpstart.asp

Netscape can work with the DOM up to Level 1 in 6.0.  Check out:
http://www.scottandrew.com/index.php/articles/dom_1
for some info.

I hope that answers your questions.

Edmund
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6790047
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.
____________________________________________
---------->  Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

------------->  The ALL TOPICS link has been updated today to reflect all the new TAs.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6867197
Finalized by EE Moderator
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now