XML to Array to html text
I am trying to get the content of my xml document into a text
field. I
have the following AS:
var aInfoText:Array = new Array;
this.scroller_all.scroller_slider.infoScroll.infoText.autoSize
= true;
var xmlContent:XML = new XML();
xmlContent.ignoreWhite = true;
xmlContent.onLoad = function(bSuccess:Boolean):Void {
if(bSuccess){
trace("Loaded the xml successfully");
var xnRoot = this.firstChild;
var xnInfo = xnRoot.childNodes[0];
for(var i:Number = 0; i < xnInfo.childNodes.length; i++){
aInfoText.push(xnInfo.childNodes
.firstChild.nodeValue);
if(i == xnInfo.childNodes.length - 1){
this.scroller_all.scroller_slider.infoScroll.infoText.htmlText
= aInfoText;
xmlContent.load("about.xml");
I can't seem to get the content inside my text field. I know
the text
field works fine, and if I do a trace inside the second
ifStatment, I
get what I want to go in the text field.
What am I doing wrong?
Thank you!
Brian
You're welcome Brian. It's not that hard. The problem occurs
with all callback handlers - onLoad, onData, onRelease and anything
else that start with 'on'... :-) and that goes for AS2. Some
developers like to use the Delegate Class in those cases but if you
want to pass parameters using that class you will need a hack like
solution to do that.
Reading up on scope, hmm, I remember there was good
information in the help files - hit F1 and search for scope.
Similar Messages
-
Is there a way to get the cursor position index of html text field
I'm trying to work on a text pad like MC with "insert text at
position X" and "find and replace" can anyone tell me how to find
the cursor index of an html text field. Selection.getBeginIndex() ,
Selection.getEndIndex(), Selection.getCaretIndex() as far as I know
these methods only work with text and not htmltext.
What I'm trying to do is assign different parts of the string
to variables so that I can combine them to reconstitute my html
string.enfantterrible:
If I understand correctly, you want the corresponding
position in the
htmlText propery of the caret index (which as you point out
is only the
position in the plain text version of the textfield content).
Below is how I would do it. Maybe there's an easier or more
efficient
way (using XML objects etc), but I don't know it. You could
conduct all
your string searches in the plain text and then convert the
result to
the html positions. I didn't build this to accept negative
parameters
for the pos parameter (e.g. from end of string backwards) but
the
function could be adapted to do this too if necessary. The
test data is
not proper html from a text field, but it doesn't really
matter what it
is so long as its formatted correctly. It just separates the
tags from
the content to enable apples with apples comparison.
//some test data
var testStringXML = "<format>Hel<b>lo i can't
t<i>ell you h</i>ow hap</b>py I
am.</format>";
var undecoratedString = "Hello i can't tell you how happy I
am.";
//the conversion function
function findDecoratedPosition(pos:Number, xmlString:String,
test:Boolean):Number {
//anything between '<' and '>' should be excluded from
plain text search.
//create an array of array elements (n=2) consisting of tag
then plain text
//requires correctly formatted xml/html
var tempArr:Array = xmlString.split("<");
for (var aa = 0; aa<tempArr.length; aa++) {
tempArr[aa] = tempArr[aa].split(">");
//remove the first and last elements of the new array (these
are empty)
tempArr.pop();
tempArr.shift();
//find the corresponding plaintext location and calculate
the "decorated" position
var retPos:Number = 0;
var posCount:Number = 0;
for (var aa = 0; aa<tempArr.length; aa++) {
retPos += tempArr[aa][0].length+2+tempArr[aa][1].length;
//+2 allows for missing < and >
posCount += tempArr[aa][1].length;
if (posCount>pos) {
return (retPos+(pos-posCount));
//out of range
return -1;
//test code:
for (var aa = 0; aa<undecoratedString.length; aa++) {
var altPos = findDecoratedPosition(aa, testStringXML);
trace(undecoratedString.charAt(aa)+" in position "+aa+"
plainText equates to position "+altPos+" in the decorated version
["+testStringXML.charAt(altPos)+"]");
} -
Open hyperlinks in html text using StageWebView instead of external browser
My iPad app downloads xml data from a server and displays it as html text. The text may contain hyperlinks and currently these are correctly displayed as links in my app. However when I click on the link, it opens the link in an external browser.
Any idea how I could instead open the links using StageWebView - I know how to open a link using StageWebView - the problem is intercepting whatever causes it to open in the external browser and instead use StageWebView.
Thanks in advanceHi, John, welcome to Apple's user-to-user discussion forums.
Does anyone here know of a way to open new windows without using command click in a tab?
If you want links on a web page to open in a new tab, you need to command-click on them. This will work both for links set up to open in the same window and those set up to open in a new window. There is no setting in Preferences to make links on a web page automatically open in a new tab.
There is a preference setting to open links from other programs, such as Mail, in a new tab. In Safari's Preferences, click on the General icon. Towards the bottom where it says "Open links from applications", check "in a new tab in the current window". -
Formatting HTML Text in Text component
Hi all,
I'm trying to render some Html text in a text component, I'm
getting the HTML from within an xml document as such:
<xml><htext><p><b>Testing HTML
Text</b></p><p>Here's another
line.</p></htext></xml>
If I put that into a Text component with the htmlText=htext
property, the line spacing is as expected, but it seems to add in a
blank space character for every character of the html code. (E.g.
"<b>Testing" adds 3 extra spaces before the word "Testing").
Renders like (using - as space character):
Testing HTML Text
-Here's another line.
If I use the condeseWhite=true property on the Text
component, it fixes the extra space characters issue, but then
stuffs the line spacing up, so <p> becomes rendered like a
<br>.
Renders like:
Testing HTML Text
Here's another line.
Any thoughts, or help is much appreciated, thanks in advance.
Oz
P.S I was trying to avoid the obvious "br" tag which will
make it work and render correctly....
<p><b>Testing HTML Text</b></p>
<br/><p>Here's another line.</p>no. use css.
-
Displaying rendered HTML text in spry detail region
Hi,
I have just started to play around with DW CS3 & spry and
love them!
I have a Master/Detail spry going from my database, but am
having a problem displaying the detail the way I need it. The mySQL
field is a BLOB for some HTML formatted text (I get the text
elsewhere using a Xinha textarea edit widget and load the the
formatted HTML text into my db). For example, my string is
"<h2>this test</h2><strong>xyz</strong>"
which is loaded into my db. I am using the dreamweaver ADDT export
XML functionality to generate my spry master/detail region.
My detail region is displaying the correct html associated
with the selected master table entry, but it's with the HTML tags,
not rendered as HTML (I don't want to see
<h2>title</h2>; I'd like to see title with <H2>
formatting).
It's much like what I think a RSS feed would be, but can't
find a way just to get the html to render because I don't have the
files externally to source an iframe or anything. (I tried a XLS
fragment transformation, just putting the detail record field that
I want in an XLS file, but that didn't do anything).
Any kind of guidance, hint, point and laugh but then tell me,
would be greatly appreciated. I also posted at first at ADDT and
then General Dreamweaver because I didn't locate this forum in the
Forum topic list, so when I did find this I thought this is
obviously where I should have first posted - sorry if anyone has
also been surfing around. Thanks so much so any info.Hi Don,
Thanks so much for responding. I actually did do that, but it
seems like I might be doing it in the wrong place. I tried it in
the .js that I have in my header:
var dsList = new Spry.Data.XMLDataSet("./export.php",
"theSpecials/special",{sortOnLoad:"rating",sortOrderOnLoad:"ascending",distinctOnLoad:tru e});
dsList.setColumnType("detail", "html");
which didn't do it. I also tried it right in my detail
display area:
<div style="overflow:hidden; width: 400px;"
spry:detailregion="dsList">
<div> <!-- nested div for spry effect -->
<div id="detailDisplay" style="width:380px; "> <!--
spry:content="{detail}"> -->
<script
type="text/javascript">dsList.setColumnType("detail","html");</script>{dsList::detail}
<!-- echo '{dsList::detail}' ; ?> -->
</div> <!-- detailDisplay -->
</div> <!-- outter div for spry effect -->
<!-- spry detail region -->
</div>
Excuse the inline ugliness, will clean it up when it's
functional. But that doesn't seem to do it either. I am storing
that particular field as a blob in the mysql database, but I
already tried making that a VARCHAR which had no effect either.
Thanks so much for for the suggestion! Any other gems that I
can try?
Liz -
Hi all
Thank you to every one for giving support who are really needs.....
Here i have a small query that goes like this
Iam converting a web page from english version to chinees version
This is a struts application
In one jsp page i have 2 text fileds like name and descrption
Here iam entering chinees charaters into these text boxes(these text boxes are <html:text>)
when both are filled and submit the form it is working fine.if
i missed one field... the validation.xml file will catching this and displaying the error mesage in the corresponding jsp page. At this time the values which are enter in this text fileds are converting to unicode so this is my problem i don't want to happen like this. so please can you help me to come out this problem ....this is some urget for me..
Thanx in advance
SrikanthI solve This problem
here the only sol i found is that
change the html:text to plain html text (i.e <input type="text">)
the code in jsp page like this
<input type="text" name="name" value="<bean:write name="formName which you are using to get the property" property="name(property from FormBean" filter="false"/>
I hope this will solve any one of your problems......
Thanking you
Srikanth -
I am attempting to use a non-standard font in an HTML dynamic textbox using the <font> tag. I have embedded this font using the textbox properties box and the fonts appear in the library. According to previous posts to this form, that should do it. But, my fonts are not appearing correctly. Any advice?
OK,
I have given up messing with stylesheets, trying display:
block, inline, different ways of formatting the XML, messing with
XML.ignoreWhiteSpace, and XML.prettyPrinting etc.
I went down the route of encodeURI, using a RegExp to strip
out all tabs, linefeeds and carriage returns. This now gives
consistent results for all situations, even embedded and none
embedded fonts.
e.g.
_text:String = TEXT FROM XML, HTML TEXT etc
var st:String = encodeURI(_text);
var pattern:RegExp = /(%09)+|(%0A)+|(%0D)+/g;
st = st.replace(pattern, "");
st = decodeURI(st);
YOUTEXTFIELD.htmlText = st;
The <p> tags still behave as a <br/> tag, but you
can add an extra <br/> to simulate a paragraph.
Here is the example again with the updates,
Hope this helps someone -
How to Display Html Text with Image
HI Frens,
I am getting some html text from a source, Later i want to
display that data, but it may happened that it has some images in
it. Currently I am using text area to display it.
Now My question is if there is any image will it show, as we
can see it in our mails? if Not, Which component I should use for
this?
I also want that I need to select some file from, How can i
get open dialog box here?
Thks in Advance for replies frens:
Ashish MishraHi Ashish,
If I have understood your requirement properly, u want to
display html text on a flex application.
I think there its better if you use the html component to
display the text. I have a sample code which will give you a
direction to think on.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="initApp( )">
<mx:Script>
<![CDATA[
public function initApp( ):void
var initHtml:String = "<html><head> \
<title='Page Example'/> \
<body bgcolor='#ccddee'><h1>Page
Example</h1> \
<p>This is a complete <b>HTML</b> \
page as a
<em>string</em>.</p></html></body>";
this.html.htmlText = initHtml;
]]>
</mx:Script>
<mx:HTML id="html" width="100%" height="100%" />
</mx:Application>
Also do you want a file open dialog box?? -
Value not resolved in html:text tag at weblogic
I've a jsp working fine at tomcat, but after i migrate it to weblogic, some of the html:text tags are not working properly.
eg. <html:text property="dispParamValue" styleClass="formFill1line" value="${sysvarList[rowCount].dispParamValue}" />
Instead of displaying the value of ${sysvarList[rowCount].dispParamValue} like "abc", it displays the tag itself "${sysvarList[rowCount].dispParamValue}" at the text field at weblogic.
My Weblogic version details are as follows:-
Server info = WebLogic Server 9.0 Sun Jul 3 21:15:00 PDT 2005 598247
Servlet engine version = 2.4
Java version = 1.5.0_03-b07
Anyone has encountered the same problem before? any difference in the server settings that i need to take note of?Just to clarify, the EL is supported by a J2EE 1.4 server which corresponds to Servlet2.4 / JSP2.0
What version of Weblogic are you using?
You can find out the version of the spec your server supports with the following JSP snippet.
<h2> Server Info </h2>
Server info = <%= application.getServerInfo() %> <br>
Servlet engine version = <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %><br>
Java version = <%= System.getProperty("java.vm.version") %><br>Also note to activate the EL in your webpages in a JSP2.0 container, your web.xml file must declare itself as being version 2.4 (if you leave it at 2.3 it disables EL for backwards compatibility)
Cheers,
evnafets -
JSP - Attribute "style" was already specified for element "html:text".".
I´m using Weblogic 10 and one of my pages is throwing that exception, what´s wrong? I´m migrating from Weblogic 8.2 to Weblogic 10!
updateCustomer.jsp:1:1: The page failed validation from validator: "org.xml.sax.SAXParseException: Attribute "style" was already specified for element "html:text".".
<%@ page contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
^--------------------------------------------------------------------------------^
at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:296)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:200)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:164)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:235)
at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:391)
Truncated. see log file for complete stacktraceCheck your "html:text" elements. One of them has duplicate attribute "style"
-
Hi everybody,
I am new to Struts concept. I am trying to develop astruts application. I am writing one textbox on that I want call one javascript function for onchange event my html:text tag looks like the following:
<% int i=0; %>
<logic:iterate id="ts" name="loginForm" property="timesheet">
<td>
<% i+= ; %>
<html:text property="worked_Hours" name="ts" onchange="findTotal(<%= i %>)"></html:text>
</script>
</td>
</logic:iterate>
</tr>
My intention in this code is I am creating the textbox control array. So I want to send that i variable value to that findTotal() javascript function. But the compiler instead of putting i value in the findTotal() function it is putting the code like this
<input type=text name="worked_hours" value="8" onchange="findTotal(%= i %>).
How can I get the value of i in the resultant jsp page.
Please reply me soon.
Thank you all,
VarmaWhen using custom tags, and specifying a dynamic attribute, always put <%= %> for the entire attribute
Try this:
<html:text property="worked_Hours" name="ts"
onchange="<%= "findTotal(" + i + ")" %>" ></html:text> -
HTML text on top of productBranding image
Hi all,
I'm new to using UIX XML in JDeveloper 10g and was wondering how I could render HTML text on top of an image (i.e. the text is not part of the image.gif). I'm able to display text all around the image but not on top of it. I'm guessing that this can be done since it is one of the BLAF specifications for the Product Branding guides.
Having spent a couple of days looking through various related posts, I've yet to make any head way.
CheersWoohoo! Got it. Could have done it in the stylesheet as well!
<rowLayout>
<contents>
<cellFormat height="70" width="300">
<inlineStyle>
<property name="background-image">url(images/financial_collage.gif)
</property>
</inlineStyle>
<contents>
<styledText text="Product Information">
<inlineStyle>
<property name="font">Garamond
</property>
<property name="font-size">+24
</property>
<property name="color">#336699
</property>
</inlineStyle>
</styledText>
</contents>
</cellFormat>
</contents>
</rowLayout> -
Sorry about first try : how to avoid html-text tag converting & to & amp;
subject
how to avoid html:text tag converting "&" to "& amp;"?
body
hi,
i have some values on DB like "& #351;" and when i use html:text to
show binding's value, html:text converts "&" to "& amp;". in generated
html, it looks like "& amp;#351;".
how to avoid this conversion?
thanks...
Ayhan G�ng�r
note: i use white-space among special characters because browser renders them. ex : (& amp; to &)hi, i use property attribute of html:text.
property is declared in UIModel xml file.
i mean, i don't use something like
<html:text value="data"/>i use just like
<html:text property="bindingName"/>and value is shown in generated html input tag as value.
html:text has no attribute like filter.
i think i should override html:text tag, and create a new tag that checks if value includes "& #351;" this type data. If there is, don't convert "&" to "& amp;"?
any suggestions?
thanks...
Ayhan -
How do I use XSLT & XML is stored in InterMedia Text.....
I use interMedia Text to store XML document. How do I use the XSLT Processor API to transform the data which is searched by XML SQL Utility??
//***Source Code
public Document xmlquery(String tabName,String xslfilename)
Document xmlDocToReturn = null;
String xmlString;
try
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//initiate a JDBC connection
// initialize the OracleXMLQuery
OracleXMLQuery qry = new OracleXMLQuery(conn,"select XML_TEXT from bookstore where contains (xml_text,'John WITHIN authorsec')>0");
// structure the generated XML document
qry.setMaxRows(2);
// set the maximum number of rows to be returned
// get the XML document in string format
xmlString = qry.getXMLString();
// print out the XML document
System.out.println(" OUTPUT IS:\n"+xmlString);
// get the XML document in string format
xmlDocToReturn = qry.getXMLDOM();
conn.close();
catch (SQLException e) {
return xmlDocToReturn;
xml = (XMLDocument)query.xmlquery(args[1],args[0]);
// Instantiate the stylesheet
XSLStylesheet xsl = new XSLStylesheet(xsldoc, xslURL);
XSLProcessor processor = new XSLProcessor();
// Display any warnings that may occur
processor.showWarnings(true);
processor.setErrorStream(System.err);
// Process XSL
DocumentFragment result = processor.processXSL(xsl, xml);
Thank you.
nullYour problem here is that when you store an XML document in a CLOB and search it using intermedia, when you do a query like:
SELECT xml_text
FROM bookstore
WHERE CONTAINS(xml_text,'John WITHIN authorsec')>0
The output from the XML SQL Utility using getXMLDOM() looks like this:<ROWSET>
<ROW>
<XML_TEXT><![CDATA[
<bookstuff>
<authorsec>
<name>Steve</name>
</authorsec>
etc.
</bookstuff>
]]>
</XML_TEXT>
</ROW>
</ROWSET>with the document as a single text value (it's actually just a text node, not a CDATA node) but the above illustrates conceptually that the whole XML document is one big text node.
To transform this you'll need to parse that XML text into an XML document in memory by passing constructing a StringReader() on the text value and parsing that reader.
null -
Reading in an array from a text file
I'm trying to use a text file to load in some configuratin
data (using actionscript 3) I have it working ok for simple stuff
like gamename=Chess&gamescore=100 , etc... but some of the data
needs to be in an array. Can someone please point me in the right
direction to how I can read in an array from a text file?
Thanks!the easiest way is to create a string with the (soon-to-be)
array elements separated by a delimiter (like a double comma). read
in your string, then use the split() method of strings to split
your string into an array.
Maybe you are looking for
-
USB printer not recognized by TC unless plug is removed, reinserted
Just picked up a TC 500GB for my new MBP and everything works great, even network printing to my old Samsung ML-1430 laser (via the USB port). But there's one hitch: the printer is at home, I don't use it that often, and so it's off most of the time.
-
Set title color in TitledBorder
Hi there! i'm new to Java as well as swing. I would like to know how to set the title color of the TitledBorder. By default, the title color is black, I would like to change it to green. i intend to use this constructor: TitledBorder(Border border, S
-
IOS 5.1 Update, Home Button Doesn't Work.
Ever since I installed the iOS 5.1 update on my iPhone 4, the home button does not work at all! I've tried every trouble shooting solution I could find. I've Restarted, I can't hard reset because the home button doesn't work, I've restored from back
-
Cant hear sounds from wine ingame?
I can't hear sounds within wine games but if i open winecfg and click test sounds, i hear a faint sound, so im not sure if my audio is low for wine or what. i don't know how to set the volume for wine if that's what it is because when i open the alsa
-
How many items will overflow in FI-SL Deltaqueue?
Hi,experts: As to SAP note "If the Delta method has been initialized for a source system, a Delta upload must be scheduled regularly so that the Deltaqueue will not overflow. If you want to stop the Delta method, you should also delete initial