Results 1 to 2 of 2
- 12-28-2009, 06:50 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 1
- Rep Power
- 0
Parsing & handling of <object> and <param> tags
Hi all,
I'm working on allowing people to paste certain embedded video code into a wysiwyg / html editor we've built with the help of (amongst others) javax.swing.text.html.HTMLWriter.
I'm facing the following problem here:
When i try to parse the <object><param></param></object> piece, it removes the <param> tags, and incorporates these in the <object> tag. For example:
becomes:XML Code:<object width="300" height="250"><param name="allowscriptaccess" value="always"></param></object>
All param tags get converted into the object tag as String attributes. Problem with this is that the allowScriptAccess attribute is not a valid attribute of the object tag.XML Code:<object width="300" height="250" allowScriptAccess="always"></object>
Is there any way to prevent this conversion so it will retain the <param> tags?
Thank you in advance.
- 12-29-2009, 03:32 PM #2
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 282
- Rep Power
- 4
Everything you need is at least implicit in javax/swing/text/html/HTMLDocument.java
Curiously, its documentation says the PARAM tags are handled by HiddenAction,
but the code actually has them handled by ObjectAction:
and ObjectAction does indeed stuff the PARAM values as attributes of the surrounding OBJECT.Java Code:tagMap.put(HTML.Tag.PARAM, new ObjectAction());
The HTMLDocument code suggests subclassing HTMLReader:
Unfortunately I haven't time today to try this, but it should be straight forward.To change the structure one
can subclass <code>HTMLReader</code>, and reimplement the method
getReader(int) to return the new reader implementation.
I think the subclass just needs to have a constructor like:
or maybe some newly devised TagAction instead of HiddenAction.Java Code:public MyHTMLReader (int offset) { super(offset, 0, 0, null); tagMap.put(HTML.Tag.PARAM, new HiddenAction()); }
Similar Threads
-
parsing Object to XML
By kievari in forum New To JavaReplies: 12Last Post: 11-25-2009, 11:34 AM -
Javadoc - cannot compile @param tags
By jon80 in forum New To JavaReplies: 9Last Post: 05-14-2009, 08:57 AM -
Parsing a superclass object to subclass object dynamicly
By Andrefs in forum Advanced JavaReplies: 1Last Post: 07-22-2008, 04:27 PM -
jsp:param action
By Java Tip in forum Java TipReplies: 0Last Post: 12-24-2007, 10:03 AM -
Creating Document object for XML parsing
By Java Tip in forum Java TipReplies: 0Last Post: 11-19-2007, 04:12 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks