Using the HTML Parser as a filter

I have the need to take an HTML file, filter it so that the SOURCE attribute on all of the IMG tags are modified, and then write the filtered file out. This seems pretty straight forward, but I can't seem to figure out how to get the Swing HTML parser to do what I want.
If I had some way to parse the file into some structure, and then be able to take that structure and "unparse" it back into a file I would be fine. This assumes that I'd be able to override the handling of the IMG tag (or I guess all of the simple tags) on the parser side so that I'd be able to replace one of the attributes with something that's more meaningful for my purpose.
I know this is not so difficult, I just can't see how to do it. Any help? Thanks in advance.
Sander Smith

If the problem is that simple, I'd use java.util.regex classes(Pattern and Matcher) and could write the program in an hour.

Similar Messages

  • Can multiple APEX application use the same parsing schema?

    Hi,
    I have 4.2 APEX thru pl/sql Gatewat, 11gr2 DB and using theme 24.
    Due to the APEX limitation for version control I would be splitting 1 big ERP applications into 24 different APEX applications and each application would be considered as 1 unit for version control.
    I have about 800 tables and I would assume that all of these would need to be stored in 1 schema since a lot of these table are linked thru FK.
    Can I have multiple APEX APPS using the same parsing schema? or is there a better way to do this?
    Thanks in advance!

    Hi,
    Multiple applications can have same (one) parsing schema.
    You can test that on e.g. apex.oracle.com, where normally you have only one schema and you create multiple applications and all use that same schema.
    Regards,
    Jari
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai
    Edited by: jarola on Jan 28, 2013 7:15 PM

  • HOW TO: Use the XML parser in Oracle 8.1.7

    I am trying to figure out how to use the xml parser provided in oracle 8.1.7. all i want to do is parse a xml report that is defined using a schema, and place the data into the proper tables. i am totally unfamiliar with the xml parser and how it works. i have done some reading on the subject, but seem to be getting some conflicting infromation about which utilites i need and how to invoke them. can someone please tell me what utilities i need, how to invoke them, and what i need to do to get a xml document to parse and insert to a table? I would greatly appreciate any help anybody could offer. thanks.

    You can parse the XML Document with XML Parser and place the data into database using XSU(XML SQL Utility).
    Both of these are included in XDK for Java at:
    http://otn.oracle.com/tech/xml/xdk_java
    The following document could also help:
    Oracle9i XML Developer's Guide--XDK [PDF] at http://otn.oracle.com/tech/xml/doc.html

  • How to use the HTML tags in the reports.

    hi.
    can any one tell me how to use the HTML tags in the reports.
    i m using the forms 10 g rel 2 and reports 10 g rel 2 and application server 10g rel 2.

    Set the Contains HTML Tags property of an object to Yes, then the tags in the object's text (if any) will be used to format the object.

  • Using the HTML SAP GUI inside the Enterprise Portal?

    Hello everyone
    In our company we plan to set up the SAP Enterprise Portal (NetWeaver 7.0). The first application we want to provide inside the portal is the SAP GUI that connects to our SAP ERP 2005 system via single sign on. Therefor two different approaches exist:
    1: Using the standard SAP GUI inside a portal iView. In this case every client pc needs the SAP GUI installed.
    2: Using the HTML SAP GUI. In this case we have to set up the integrated ITS in our SAP ERP system.
    Now I have some questions about the second approach. Is the functionality of the HTML GUI equal to the functionality of the standard GUI? If not, what are the restrictions? How high is the additional load on the network and SAP ERP system caused by the HTML GUI? Would you recommend this approach for a system with more than thousand SAP users?

    Hi Marc,
    At least if you consider using webgui, you should test the transactions properly as there are some issues for example with scandinavian characters and lines visible in lists of search helps.
    Also you might want to consider the limitations of the screen resolutions and space which the portal framwork already takes from the gui. This of course is a topic for both HTML/SAP GUI's.
    Kind regards,
    Ville

  • Using the SAX parser to split up a document to be processed by a DOMParser

    I need to process a potentially large document which could prove too large to be read into memory at once by the DOM parser. The document would look something like..
    (sorry about the formatting - can't use tabs!)
    <Root>
    <Parent>
    <Child>
    <Blah.....................
    </Blah>
    </Child>
    </Parent>
    <Parent>
    <Child.......
    </Child>
    </Parent>
    etc...
    etc...
    </Root>
    The number of Parent elements could potentially be in the thousands. What I would like to do would be to use the SAX parser to read the document and when a Parent element is encountered, write the parent element and all its children to a stream in order that an input source can be created. The input source can then be parsed by a DOM parser. Once complete, the next Parent element encountered by the SAX parser could be passed to the DOM parser and so on until all of the Parent elements have been processed.
    This way I can combine the ease of parsing the document using the DOM parser without having to worry about the overhead on memory.
    Does anyone have any ideas as to the best approach? I could use the SAX parser for the whole thing but the XML is quite complex and lends itself to DOM parsing much more conveniently.

    Can you read the file line by line:
    start the reading at <child>
    pause reading at </child>
    copy the string to a var
    wrap it with respective tags (<?xml<doctype etc...) and parse
    proceed to the next <child>xx</child>
    and repeat till you hit the closing of the file...
    - Ravi

  • How to use the date repository variable in filter expression

    Hi Gurus
    I am getting error in using the date repository variable in Filter expression. I am using the below formula
    filter( Fact.calls USING  "Dim Time"."Fiscal Month End Date" = VALUEOF("month_start") )
    I am getting below error
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 22024] A comparison is being carried out between non-compatible types. (HY000)
    SQL Issued: SELECT filter( fact.Calls using "Dim Time"."Fiscal Month End Date" =VALUEOF("month_start")) FROM "Call Data"
    Then i tryed the below format i am getting still the error
    filter( Fact.calls USING  "Dim Time"."Fiscal Month End Date" = DATE'(VALUEOF("month_start"))' )
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 46047] Datetime value (VALUEOF("month_start")) from (VALUEOF("month_start")) does not match the specified format. (HY000)
    SQL Issued: SELECT filter( Fact.Calls using "Dim Time"."Fiscal Month End Date" =DATE'(VALUEOF("month_start"))') FROM "Call Data"
    Please let me know what i am missing or what is the correct syntax for fitler using the date repository variable.
    Thanks in advance
    Regards
    @li

    Hi @li,
    Syntax-1 is fine it will work,What kind of Variable is it?
    Static or Dynamic
    Thanks,

  • Using the HTML tags in Oracle Alerts

    Hi all,
    Can we use the HTML Tags in Oracle Alerts at Alert Details window in Text(D) Column?
    Please Provide solution to format the data which is sending to Mail from Oracle Alerts.

    What version of ebusiness are you running? You should be able to utilise html tags without an issue in 11i.

  • How to use the kxml parser?

    I am getting problem in using the kxml parser.Actually my application is showing the java.lang.NoClassDefFoundError: org/kxml/parser/XmlParser error.
    Can you tell me how to use the kxml parser with our j2me application or what are the steps for this?
    Whether we have to use the kxml.zip or some other JAR file for this?
    Again whether we have to set any classpath for this?

    I was getting same error using kxml parser. The reason is losing interface in which constants are declared.
    You need to correct code of kxml a bit.
    In every place where constant from XmlPullParser interface is referenced only by its name (without reference to its class XmlPullParser) you need to change for use full name. it means changes like:
    START_DOCUMENT to XmlPullParser.START_DOCUMENT
    Everywhere.
    That's all!

  • Can I use the HTML created in Adobe Edge Reflow?

    Can I use the HTML and CSS code generated to create the webpage preview in Adobe Edge Reflow?

    Hi Joseph,
    After creating and saving your Edge Reflow project, you can use View-> Preview In Chrome. This will create your HTML and CSS in your project folder's "assets" directory.  While our goal with this code is to provide a way for you to preview and share your designs in the browser (not to output production quality code), you can do anything you'd like with the output.
    Joan

  • Using the HTML collection for EP6 SP11

    I am trying to configure a custom interface using the HTML Collection.
    My problem is that the "How to " guide is for EP6 SP6 and I'm using EP6 SP11 which does not seem to have a place to attach the HTML file I have created to the layout set.
    Can anyone tell me how to do this?

    See How do you create a HTML collection rendered in EP6 SP11

  • Using the SAX Parser

    As I reported in this thread: Carriage Returns in XSLT output I am trying to produce a text output file with each line terminating in cr-lf (using the output from ViewObject.writeXML() passed through the XSLProcessor.processXSL() method to apply a XSLT stylesheet transformation to it), but the cr characters in the stylesheet are being converted to nl characters, so I am ending up with two nl characters at the end of each line.
    I found a 2002 query (here: http://www.xslt.com/html/xsl-list/2002-04/msg00193.html) by someone with the same problem, and a reply by Steve Muench explaining it and stating that the Oracle SAX parser does not have the same problem.
    So my question now is - does the SAX parser still retain cr characters (or is it too now converting them to nl) and if it does, how do I make XSLProcessor.processXSL() use it rather than the default XML parser? Can I do it from within my code, or does it need to be set in some sort of environment variable? We are on version 9.0.5.2 of JDeveloper(10g)

    Repost

  • How to use the html:link with a arraylist

    Hi everyone:
    I want to display the data using struts html:link.
    I query the database and place all the data to javabean,later place all the javabean to ArrayList.In Action,I use the "request.setAttribute("lovetable",articlelist) to set request to jsp page.
    I want to pass a parameter "id" use the hyperlink so I can get the parameter when I click the hyperlink.
    But how to use html:link to display it?
    I use <html:link action="viewtopic.do" paramId="id" paramName="lovetable" paramProperty="id"/>,it can't work and Tomcat report error :
    org.apache.jasper.JasperException: No getter method for property id of bean lovetable
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    The lovetable is a ArrayList and it don't have a getter or setter method.
    How to use it pass parameter? :( Thks

    Thank you.
    I use the bean:define successful.And display all the data to jsp.My jsp code is:
    <logic:iterate id="love" name="lovetable">
    <bean:define id="idbean" name="love"/>
    <tr bgcolor="<%=color%>">
    <td><bean:write name="love" property="id"/></td>
    <td><html:link forward="viewtopic" paramId="id" paramName="idbean" paramProperty="id"><bean:write name="love" property="title"/></html:link></td>
    <td><bean:write name="love" property="name"/></td>
    <td><bean:write name="love" property="time"/></td>
    </tr>
    </logic:iterate>
    In Action : request.setAttribute("lovetable",articlelist)
    ResutlSet rs=.............
    List articlelist=new ArrayList();
    while(rs.next()){
    articlebean bean=new articlebean();
    bean.setName(rs.getString("name"));
    bean.setTitle(rs.getString("title"));
    articlelist.add(bean);
    The above code will work property.
    The Tag "html:link" need bean to work other than arraylist so I iterate all the bean out.
    The Tag "logic:iterate" need collection to work so I make Action return a List.
    right?
    Any idea? :)

  • Using the .html extension with CF

    How do I setup CF admin to interpret the .html extension as
    opposed to .cfm?
    Thanks!

    BigRedFan wrote:
    > How do I setup CF admin to interpret the .html extension
    as opposed to .cfm?
    >
    > Thanks!
    >
    As opposed? You want to stop the server from interpreting
    .cfm files?
    Most who use this technique set it up to do both .cfm and
    .html! :-)
    Anyways, this is not a CF admin configuration, it is a web
    server
    configuration. That is what is determining what resource has
    been
    requested and what to pass the request to, if anything. So
    your answer
    is going to depend on what web server you are using, IIS vs
    Apache vs
    something else.
    I don't know off the top of my head, but I have read many
    postings and
    blogs over the years that give a good description of the
    process, should
    be pretty easy to find with a Google search.
    P.S. Now that I think about with MX versions of ColdFusion I
    seem to
    recall there are some cf xml configuration file modifications
    involved
    as well.

  • Problem in tree while using the HTML format in the lable

    Hi all,
    DefaultTreeCellRenderer is not working properly if we pass the string as a html format inside the DefaultMutableTreeNode. Using the below code snipet you can cleraly identify the problem.
    Kindly compile &execute the below code.All the lable's will be painted properly according to the color code that i've mentioned.
    After that please uncomment al the DefaultMutableTreeNode variables corresponding to html tag representation and comment the already existing DefaultMutableTreeNode variables .
    someone please clarify me the things what is happening here?
    import java.awt.BorderLayout;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    public class MultiLineTreeDemo extends JFrame {
         private JTree tree;
          final int[] colorcode={0xFF0000,0x00FFFF,0x0000A0,0x800080};
         public static void main( String[] args ) throws Exception {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new MultiLineTreeDemo(); }
         public MultiLineTreeDemo() {
              super( "MultiLineTreeDemo" );
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( "<html>This is<p>the root node.</html>" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( "<html>This is<p>a child node.<html>" );
              DefaultMutableTreeNode leaf = new DefaultMutableTreeNode( "<html>This is<p>a leaf node.<html>" );
              DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode( "<html>This is<p>a leaf1 node.<html>" );
              /*DefaultMutableTreeNode root = new DefaultMutableTreeNode( " root node" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( " child node" );
              DefaultMutableTreeNode leaf = new DefaultMutableTreeNode( " leaf node" );
              DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode( " leaf1 node" );*/
              node.add(leaf);
              root.add( node );
              root.add( leaf1 );
              tree = new JTree( root );
              tree.setCellRenderer(new DefaultTreeCellRenderer()
                           public Component getTreeCellRendererComponent(JTree pTree,
                               Object pValue, boolean pIsSelected, boolean pIsExpanded,
                               boolean pIsLeaf, int pRow, boolean pHasFocus)
                                JLabel lbl = (JLabel)super.getTreeCellRendererComponent(pTree, pValue, pIsSelected,pIsExpanded, pIsLeaf, pRow, pHasFocus);
                                DefaultMutableTreeNode newNode=(DefaultMutableTreeNode)pValue;
                                if(newNode.isRoot())
                                lbl.setForeground(Color.red);
                                else if(newNode.isLeaf())
                                 lbl.setForeground(Color.green);
                               else
                                lbl.setForeground(Color.blue);
                               JPanel p = new JPanel();
                               p.setBackground(tree.getBackground());
                               Dimension d = lbl.getPreferredSize();
                               p.setPreferredSize(new Dimension(d.width, d.height));
                               p.add(lbl);
                             tree.setRowHeight(80);
                            return (p);
              setLayout( new BorderLayout() );
              JScrollPane scrollPane = new JScrollPane( tree );
              add( scrollPane, BorderLayout.CENTER );
              setSize( 200, 200 );
              setVisible( true );
    }Thanks in Advance.
    Sivabalan

    Then I guess the problems come with setting explicit foreground colours on the one hand and using html on the other, even when not specifying them in the html. Stick to one or the other, I suppose. I'm not a fan of using html in labels so I don't know what problems you might run into.
    I've got rid of setForeground in the renderer and set the font colour in html. Then it is stable:
    import java.awt.BorderLayout;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    public class MultiLineTreeDemo extends JFrame {
         private JTree tree;
          final int[] colorcode={0xFF0000,0x00FFFF,0x0000A0,0x800080};
         public static void main( String[] args ) throws Exception {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new MultiLineTreeDemo(); }
         public MultiLineTreeDemo() {
              super( "MultiLineTreeDemo" );
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( "<html><font color=\"#FF0000\">This is<p>the root node.</font></html>" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( "<html><font color=\"#0000FF\">This is<p>a child node.</font><html>" );
              DefaultMutableTreeNode leaf = new DefaultMutableTreeNode( "<html><font color=\"#00FF00\">This is<p>a leaf node.</font><html>" );
              DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode( "<html><font color=\"#00FF00\">This is<p>a leaf1 node.</font><html>" );
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( " root node" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( " child node" );
              DefaultMutableTreeNode leaf = new DefaultMutableTreeNode( " leaf node" );
              DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode( " leaf1 node" );
              node.add(leaf);
              root.add( node );
              root.add( leaf1 );
              tree = new JTree( root );
              tree.setCellRenderer(new DefaultTreeCellRenderer()
                           public Component getTreeCellRendererComponent(JTree pTree,
                               Object pValue, boolean pIsSelected, boolean pIsExpanded,
                               boolean pIsLeaf, int pRow, boolean pHasFocus)
                                JLabel lbl = (JLabel)super.getTreeCellRendererComponent(pTree, pValue, pIsSelected,pIsExpanded, pIsLeaf, pRow, pHasFocus);
                                DefaultMutableTreeNode newNode=(DefaultMutableTreeNode)pValue;
    //                            if(newNode.isRoot())
    //                            lbl.setForeground(Color.red);
    //                            else if(newNode.isLeaf())
    //                             lbl.setForeground(Color.green);
    //                           else
    //                            lbl.setForeground(Color.blue);
                               //JPanel p = new JPanel();
                               //p.setBackground(tree.getBackground());
                               //Dimension d = lbl.getPreferredSize();
                               //p.setPreferredSize(new Dimension(d.width, d.height));
                               //p.add(lbl);
                             //tree.setRowHeight(80);
                            //return (p);
                            return (lbl);
              setLayout( new BorderLayout() );
              JScrollPane scrollPane = new JScrollPane( tree );
              add( scrollPane, BorderLayout.CENTER );
              setSize( 200, 200 );
              setVisible( true );
    }

Maybe you are looking for

  • My hard drive crashed while backing up!

    How's this for luck: I finally bought an external drive and was in the process of making a bootable backup to a Maxtor One Touch Firewire 800 drive when my G5's internal drive crashed! I was able to insert the OSX startup disc which opens the install

  • Parent is not a valid member error in BPC

    hi all, i use SSIS package that upload members to BPC dimension and it worked successfully. But when i try to process dimension the following error appeared "  - Parent is not a valid member. -  Member ID : [Insurance],  Property Name : [PARENTH1], 

  • Add a file size option for TIF export

    I would like to have an option to set (uncompressed) file size (or alternatively size in MPix) for a TIF file and have lightroom set the pixel dimensions accordingly. The reason is that many libraries specify a file size requirement. If all your imag

  • How do I crop an image with a Clipping Mask using a circle instead of a rectangle?

    I watched Adobe TV Illustrator's tutorial about cropping images with a clipping mask. In the video, the presenter uses the rectangle tool with the clipping mask, and makes a reference that the circle or vector shape could be used, but I cannot figure

  • I deleted duplicates in my library. Can they be restored?

    So I deleted duplicates of the 100+ songs on my iTunes library. Now I can play the existing ones in iTunes, however the ones imported in from a CD from my laptop, which were stored on my laptop are now not working. When I deleted the duplicates, I ch