HTML strings stored within XML

Hey, I'm trying to populate my entire flash site from an XML
spreadsheet. No problems, except that I'd like to store body copy
as HTML strings. Is there a way to insert HTML text into an XML
document without it being parsed as XML by Flash? Thanks!

In a CDATA section.

Similar Messages

  • Converting SQL Server text field containing XML string to XI XML via JDBC

    Hello
    My client has a SQL Server database containing a field of type Text which contains an XML string e.g.
    <DispatchJob> <DispatchDateTime>2003-09-29T13:29:15</DispatchDateTime> <AssignedFSE>F118</AssignedFSE> <DispatchJobPurchase> <DealerID>14C5</DealerID> <DateOfPurchase>1997-10-01T00:00:00</DateOfPurchase> </DispatchJob>
    I am using JDBC to access this but could someone please recommend the best and easiest solution for converting this string to XI XML for subsequent mapping to BAPI or IDOC or ABAP Proxy and transmission to SAP. There are other fields as well in the database table so thoughts at the moment are to use a normal graphical message mapping followed by an XSL mapping. Will an XSL mapping be able to do this and if so is that the best solution?
    Also I need to do the reverse of this and take fields coming from SAP via BAPI,IDOC etc. and convert them to a single database table field as an XML string also via the JDBC adapter. What is the best way to do this. Could it be done simply with functions in the graphical mapping e.g. concatenate?
    Thank you in advance.
    Trevor

    Hi Michal
    Thanks for the prompt reply.
    I was anticipating XSLT for reading from the SQL Server database and converting the XML string.
    But how would you convert the individual fields from SAP into a single field as an XML string for storing in the SQL Server database? What approach would you use?
    Regards
    Trevor

  • How to parse select lines in an html string?

    I've been writing a program to deal with demographic data and the first server it calls returns an xml string. However, the backup server returns an html string instead of an xml string, so the formatting is a bit different. I was going to use a regex as I did with the xml server, but regex's don't work that well with html. i was wondering if you could offer some advice on how to effectively parse the html string? It is in this format <html>
    <head>
    <meta name="Description" content="ZIP Code Demographics"/>
    <meta name="Keywords" content="zip, zip code, zipcode, demographics, 2000, county, lookup, city, state"/>
    <title>ZIP Code Demographics Lookup</title>
    <link rel="stylesheet" type="text/css" href="http://www.MelissaData.com/style.css" />
    </head>
    <body topmargin="0" onload="document.getElementById('text1').focus()">
    <div align="center">
    <!--Start of top.asp 9/2/08 Ray-->
    <script type='text/javaScript' src='http://www.melissadata.com/cgi-bin/lib.js'></script>
        <table align="center" border="0" cellpadding="0" cellspacing="0" width="744" style="font-size:8pt; font-family:Arial; color: #666666">
            <tr valign='middle'  height='24'>
                 <td align="left" rowspan=2><a href="/index.htm">
                    <img border="0" src="http://www.melissadata.com/home/new1207/MelissaData-logo.gif" alt="Melissa Data Home Page" /></a><img border="0" src="http://www.melissadata.com/home/new1207/1-800-number.gif" width="112" height="22" alt="Call 1-800-MELISSA for Data Quality Solutions" /></td>
                <td colspan='2' align="right">
                    <font size="1" face="Verdana">
                <script type="text/javaScript">var r=uCookie("r"); var s=uCookie("s"); var n=uCookie("n");
                    //document.write (document.cookie);
                    if (r == "YES" && s == "IN" && n != "" ) document.write ("Hello <b>" + n.replace(/\+/g," ") + "<\/b>   [<font size=1><a href=/user/signout.aspx>Sign out<\/a>, <a href=/user/user_account.aspx>My Account<\/a></font>]");else document.write (" <a href=/user/signin.aspx>Sign In<\/a> ");
                </script></font></td></tr>
            <tr height='24'>
                <form method="get" action="http://w2.melissadata.com/cgi-bin/search.asp">          
                <td align="right" height=30>               
                    <a href="/netcart/order1.aspx"><img border="0" src="http://www.melissadata.com/home/new1207/Hompage-shoppincart.gif" alt="Shopping Cart" /></a>
                    <a style="color: #666666" href="/netcart/order1.aspx">Buy</a>
                    | <a style="color: #666666" href="/cgi-bin/newsletters.asp">Newsletters</a> | Search
                    <input name="indata" style="font-size:7pt; font-family:Arial" size="10" /><input type="image" src="http://www.melissadata.com/home/new1207/hompage-arrow.gif" style="vertical-align: middle"  value="Search" name="submit1" />
        </td></form></tr>
        </table>
        <style="font-size:10pt; font-family:Arial; color: #0066cc" type="text/css">
        <table align="center" border="0" cellpadding="4" cellspacing="0" width="744">
            <tr>
                <td align="center" width="106">
                    <b><a style="text-decoration: none" href="/products/index.htm">Products</a></b></td>
                <td align="center" width="106">
                    <b><a style="text-decoration: none" href="/solutions/index.htm">Solutions</a></b></td>
                <td align="center" width="106">
                    <b><a style="text-decoration: none" href="/download.htm">Downloads</a> </b></td>
                <td align="center" width="106">
                    <b><a style="text-decoration: none" href="/tech/tech.html">Support</a> </font></td>
                <td align="center" width="106">
                    <b><a style="text-decoration: none" href="/resources/index.htm">Resources</a></b></td>
                <td align="center" width="106">
                    <b><a style="text-decoration: none" href="/lookups/index.htm">Lookups</a></b></td>
                <td align="center" width="106">
                    <b><a style="text-decoration: none" href="/cgi-bin/contact.asp">Contact Us</a></b></td></tr>   
        </table></style>
    <!-- Start Image BanAd.asp-->
    <div align=center><a href='/cgi-bin/BanAd.asp?id=135'><img alt='Click here' src='/cgi-bin/BanImage.asp?id=135'></a></div><!-- End Image BanAd.asp-->
    <!--TitleBorder in Shared.asp -->
    <table width="744" cellspacing=0 border=1 bgcolor="#F7F7F7"><tr><td align=left><font color="#ce0000" size="5">ZIP Code Demographics Lookup</font></td><form><td width=120 align=center><input title='Help for ZIP Code Demographics Lookup' type=button onClick=openHelpWindow('/lookups/help/zipdemo2000.asp') value=Help>  <a title='Lookups home page' href=/lookups/index.htm>Index</a></td></form></tr></table>
    <!--TitleBorder End-->
    <form action="ZipDemo2000.asp" name="Demo2000">
    <table width="400" class="Disp">
    <tr><td align="center"><b>Enter a 5-Digit ZIP Code</b>
        <input class="Disp" title="Enter a ZIP Code" id="text1" size="5" name="ZipCode" maxlength="5"/> <input type="submit" value="Submit"/>
    </td></tr>
    </table>
    </form>
    <table cellspacing="0" cellpadding="1" width="750" border="2" bgcolor="#ffffcc">
    <tr bgcolor="lightblue"><td colspan="4" align="center">Year 2000 Demographics of <br><b>ZIP Code 90041</b><br><b>LOS ANGELES, California</b><br><a href=mapzipv.asp?zip=90041>Map of ZIP Code</a></td></tr>
    <tr bgcolor="#bbffff"><td>TOTAL POPULATION [1]</td><td >P001</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Total population</td><td >P001</td></tr>
    <tr><td>   Total</td><td align=right ><b> 27,864</b></td></tr>
    <tr bgcolor="#bbffff"><td>URBAN AND RURAL [6]</td><td >P002</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Total population</td><td >P002</td></tr>
    <tr><td>   Total:</td><td align=right ><b> 27,864</b></td></tr>
    <tr><td>         Urban:</td><td align=right ><b> 27,864</b></td></tr>
    <tr><td>           Inside urbanized areas</td><td align=right ><b> 27,864</b></td></tr>
    <tr><td>           Inside urban clusters</td><td align=right ><b> 0</b></td></tr>
    <tr><td>         Rural</td><td align=right ><b> 0</b></td></tr>
    <tr><td>         Not defined for this file</td><td align=right ><b> 0</b></td></tr>
    <tr bgcolor="#bbffff"><td>RACE [8]</td><td >P007</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Total population</td><td >P007</td></tr>
    <tr><td>   Total:</td><td align=right ><b> 27,864</b></td></tr>
    <tr><td>         White alone</td><td align=right ><b> 13,429</b></td></tr>
    <tr><td>         Black or African American alone</td><td align=right ><b> 630</b></td></tr>
    <tr><td>         American Indian and Alaska Native alone</td><td align=right ><b> 242</b></td></tr>
    <tr><td>         Asian alone</td><td align=right ><b> 7,123</b></td></tr>
    <tr><td>         Native Hawaiian and Other Pacific Islander alone</td><td align=right ><b> 42</b></td></tr>
    <tr><td>         Some other race alone</td><td align=right ><b> 4,738</b></td></tr>
    <tr><td>         Two or more races</td><td align=right ><b> 1,660</b></td></tr>
    <tr bgcolor="#bbffff"><td>HISPANIC OR LATINO BY RACE [17]</td><td >P008</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Total population</td><td >P008</td></tr>
    <tr><td>   Total:</td><td align=right ><b> 27,864</b></td></tr>
    <tr><td>         Not Hispanic or Latino:</td><td align=right ><b> 17,109</b></td></tr>
    <tr><td>           White alone</td><td align=right ><b> 8,468</b></td></tr>
    <tr><td>           Black or African American alone</td><td align=right ><b> 555</b></td></tr>
    <tr><td>           American Indian and Alaska Native alone</td><td align=right ><b> 105</b></td></tr>
    <tr><td>           Asian alone</td><td align=right ><b> 7,053</b></td></tr>
    <tr><td>           Native Hawaiian and Other Pacific Islander alone</td><td align=right ><b> 30</b></td></tr>
    <tr><td>           Some other race alone</td><td align=right ><b> 73</b></td></tr>
    <tr><td>           Two or more races</td><td align=right ><b> 825</b></td></tr>
    <tr><td>         Hispanic or Latino:</td><td align=right ><b> 10,755</b></td></tr>
    <tr><td>           White alone</td><td align=right ><b> 4,961</b></td></tr>
    <tr><td>           Black or African American alone</td><td align=right ><b> 75</b></td></tr>
    <tr><td>           American Indian and Alaska Native alone</td><td align=right ><b> 137</b></td></tr>
    <tr><td>           Asian alone</td><td align=right ><b> 70</b></td></tr>
    <tr><td>           Native Hawaiian and Other Pacific Islander alone</td><td align=right ><b> 12</b></td></tr>
    <tr><td>           Some other race alone</td><td align=right ><b> 4,665</b></td></tr>
    <tr><td>           Two or more races</td><td align=right ><b> 835</b></td></tr>
    <tr bgcolor="#bbffff"><td>SEX BY AGE [49]</td><td >P012</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Total population</td><td >P012</td></tr>
    <tr><td>   Total:</td><td align=right ><b> 27,864</b></td></tr>
    <tr><td>         Male:</td><td align=right ><b> 13,324</b></td></tr>
    <tr><td>           Under 5 years</td><td align=right ><b> 862</b></td></tr>
    <tr><td>           5 to 9 years</td><td align=right ><b> 974</b></td></tr>
    <tr><td>           10 to 14 years</td><td align=right ><b> 872</b></td></tr>
    <tr><td>           15 to 17 years</td><td align=right ><b> 525</b></td></tr>
    <tr><td>           18 and 19 years</td><td align=right ><b> 511</b></td></tr>
    <tr><td>           20 years</td><td align=right ><b> 257</b></td></tr>
    <tr><td>           21 years</td><td align=right ><b> 287</b></td></tr>
    <tr><td>           22 to 24 years</td><td align=right ><b> 569</b></td></tr>
    <tr><td>           25 to 29 years</td><td align=right ><b> 969</b></td></tr>
    <tr><td>           30 to 34 years</td><td align=right ><b> 1,024</b></td></tr>
    <tr><td>           35 to 39 years</td><td align=right ><b> 1,140</b></td></tr>
    <tr><td>           40 to 44 years</td><td align=right ><b> 1,077</b></td></tr>
    <tr><td>           45 to 49 years</td><td align=right ><b> 987</b></td></tr>
    <tr><td>           50 to 54 years</td><td align=right ><b> 822</b></td></tr>
    <tr><td>           55 to 59 years</td><td align=right ><b> 647</b></td></tr>
    <tr><td>           60 and 61 years</td><td align=right ><b> 215</b></td></tr>
    <tr><td>           62 to 64 years</td><td align=right ><b> 270</b></td></tr>
    <tr><td>           65 and 66 years</td><td align=right ><b> 155</b></td></tr>
    <tr><td>           67 to 69 years</td><td align=right ><b> 258</b></td></tr>
    <tr><td>           70 to 74 years</td><td align=right ><b> 320</b></td></tr>
    <tr><td>           75 to 79 years</td><td align=right ><b> 252</b></td></tr>
    <tr><td>           80 to 84 years</td><td align=right ><b> 183</b></td></tr>
    <tr><td>           85 years and over</td><td align=right ><b> 148</b></td></tr>
    <tr><td>         Female:</td><td align=right ><b> 14,540</b></td></tr>
    <tr><td>           Under 5 years</td><td align=right ><b> 864</b></td></tr>
    <tr><td>           5 to 9 years</td><td align=right ><b> 949</b></td></tr>
    <tr><td>           10 to 14 years</td><td align=right ><b> 875</b></td></tr>
    <tr><td>           15 to 17 years</td><td align=right ><b> 534</b></td></tr>
    <tr><td>           18 and 19 years</td><td align=right ><b> 592</b></td></tr>
    <tr><td>           20 years</td><td align=right ><b> 285</b></td></tr>
    <tr><td>           21 years</td><td align=right ><b> 264</b></td></tr>
    <tr><td>           22 to 24 years</td><td align=right ><b> 600</b></td></tr>
    <tr><td>           25 to 29 years</td><td align=right ><b> 932</b></td></tr>
    <tr><td>           30 to 34 years</td><td align=right ><b> 1,035</b></td></tr>
    <tr><td>           35 to 39 years</td><td align=right ><b> 1,026</b></td></tr>
    <tr><td>           40 to 44 years</td><td align=right ><b> 1,131</b></td></tr>
    <tr><td>           45 to 49 years</td><td align=right ><b> 1,038</b></td></tr>
    <tr><td>           50 to 54 years</td><td align=right ><b> 970</b></td></tr>
    <tr><td>           55 to 59 years</td><td align=right ><b> 689</b></td></tr>
    <tr><td>           60 and 61 years</td><td align=right ><b> 261</b></td></tr>
    <tr><td>           62 to 64 years</td><td align=right ><b> 327</b></td></tr>
    <tr><td>           65 and 66 years</td><td align=right ><b> 208</b></td></tr>
    <tr><td>           67 to 69 years</td><td align=right ><b> 307</b></td></tr>
    <tr><td>           70 to 74 years</td><td align=right ><b> 482</b></td></tr>
    <tr><td>           75 to 79 years</td><td align=right ><b> 450</b></td></tr>
    <tr><td>           80 to 84 years</td><td align=right ><b> 331</b></td></tr>
    <tr><td>           85 years and over</td><td align=right ><b> 390</b></td></tr>
    <tr bgcolor="#bbffff"><td>MEDIAN AGE BY SEX [3]</td><td >P013</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Total population</td><td >P013</td></tr>
    <tr bgcolor="#bbffff"><td>Median age--</td><td >P013</td></tr>
    <tr><td>         Both sexes</td><td align=right ><b> 35.3</b></td></tr>
    <tr><td>         Male</td><td align=right ><b> 34.0</b></td></tr>
    <tr><td>         Female</td><td align=right ><b> 36.6</b></td></tr>
    <tr bgcolor="#bbffff"><td>HOUSEHOLDS [1]</td><td >P015</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Households</td><td >P015</td></tr>
    <tr><td>   Total</td><td align=right ><b> 9,375</b></td></tr>
    <tr bgcolor="#bbffff"><td>POPULATION IN HOUSEHOLDS [1]</td><td >P016</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Population in households</td><td >P016</td></tr>
    <tr><td>   Total</td><td align=right ><b> 26,409</b></td></tr>
    <tr bgcolor="#bbffff"><td>AVERAGE HOUSEHOLD SIZE [1]</td><td >P017</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Households</td><td >P017</td></tr>
    <tr><td>   Average household size</td><td align=right ><b> 2.82</b></td></tr>
    <tr bgcolor="#bbffff"><td>FAMILIES [1]</td><td >P031</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Families</td><td >P031</td></tr>
    <tr><td>   Total</td><td align=right ><b> 6,326</b></td></tr>
    <tr bgcolor="#bbffff"><td>POPULATION IN FAMILIES [1]</td><td >P032</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Population in families</td><td >P032</td></tr>
    <tr><td>   Total</td><td align=right ><b> 21,653</b></td></tr>
    <tr bgcolor="#bbffff"><td>AVERAGE FAMILY SIZE [1]</td><td >P033</td></tr>
    <tr bgcolor="#bbffff"><td>Universe: Families</td><td >P033</td></tr>
    <tr><td>   Average family size</td><td align=right ><b> 3.42</b></td></tr>
    </table>
    <!-- Start of bottom.asp-->
        <hr width="730" />
        <span style='font-size:8pt'>
        <a href="http://www.melissadata.com/enews/advisorarticles/index.htm">Articles</a> | 
        <a href="javascript:window.external.AddFavorite('http://www.melissadata.com/lookups/zipdemo2000.asp', 'ZIP Code Demographics Lookup')" target="_self">Bookmark</a> | 
        <a href="http://www.melissadata.com/cgi-bin/improve.asp?web">How Can We Improve?</a> | 
        <a href="http://www.melissadata.com/cgi-bin/batchprocessing.asp">Batch Processing</a> | 
        <a href="http://www.melissadata.com/cgi-bin/send.asp?Send2Friend">Email to Friend</a> | 
        <a href="http://www.melissadata.com/cgi-bin/catalogres.asp">Free Catalog</a> | 
        <a href="http://forum.melissadata.com/default.aspx">Forums</a> | 
        <a href="http://www.melissadata.com/terms-of-use.htm">Terms of Use</a>
        <font color="#ddddff"><br />  
        <script type="text/javascript"> var r=uCookie("r"); var f=uCookie("f"); var c=uCookie("c"); var l=uCookie("l");
            //document.write (r + ":" + f + ":" + c + ":" + l);</script></font></span>
    <!-- End of bottom.asp-->
    </div>
    </body>
    </html>.
    The numbers I wanted to extract are the age groups of "Under 5 years," "5 to 9 years," "10 to 14 years," and "15 to 17 years," from both male and female groups, which should add up to 8 numbers total. Here is the backup server portion of my program as well, so you can see what i'm doing.
    import java.net.*;
    import java.net.URL;
    import java.net.URLConnection;
    import java.net.HttpURLConnection;
    import java.io.*;
    import java.io.DataOutputStream;
    import java.io.BufferedReader;
    import java.io.StringReader;
    import java.io.InputStreamReader;
    import java.io.PrintStream;
    import java.util.Scanner;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import java.util.Arrays;
    public class TriParser
         static Scanner sc = new Scanner(System.in);
         public static int[] findValues(String text, String gender, String[] labels)
                Matcher m = Pattern.compile("<td>(.*?)</td>",
               Pattern.MULTILINE | Pattern.DOTALL).matcher(text);
                String allValues = m.find() ? m.group(1) : null; // TODO: handle if 'null' is returned!
                int[] values = new int[labels.length];
                for(int i = 0; i < labels.length; i++)
                  m = Pattern.compile(labels[i]+"[^>]+>(\\d+)").matcher(allValues);
                  if(m.find()) values[i] = Integer.parseInt(m.group(1));
                return values;
         public static void main(String[] args) throws Exception
            int zip;
            boolean validInteger;//indicates if zipcode is valid (has to be 5 digits)
            do
                    System.out.print("Enter a five-digit zipcode: ");
                    zip = sc.nextInt();
                    validInteger = true;
                    if((zip < 10000) || (zip > 99999))
                            validInteger = false;
                            System.out.println("Invalid Entry.  Please re-enter zipcode.");
            while(!validInteger);
            System.out.println(zip);     
            //String requestPart1 ="query=PREFIX+dc%3A++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+%0D%0APREFIX+census%3A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fschema%2Fcensus%2F%3E+%0D%0APREFIX+census1%3A+%3Ctag%3Agovshare.info%2C2005%3Ardf%2Fcensus%2Fdetails%2F100pct%2F%3E+%0D%0A%0D%0ADESCRIBE+%3Ftable+WHERE+%7B+%0D%0A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fusgov%2Fgeo%2Fcensus%2Fzcta%2F";
            //String requestPart2 = "" + zip; // zipcode goes here
            //String requestPart3 ="%3E+census%3Adetails+%3Fdetails+.+%0D%0A+%3Fdetails+census1%3AtotalPopulation+%3Ftable+.+%0D%0A+%3Ftable+dc%3Atitle+%22SEX+BY+AGE+%28P012001%29%22+.+%0D%0A%7D%0D%0A&outputMimeType=text%2Fxml";
              String requestPart1 = "" + zip;
            String response = "";
            URL url = new URL("http://www.melissadata.com/lookups/zipdemo2000.asp?ZipCode="+requestPart1);
            URLConnection conn = url.openConnection();
            // Set connection parameters.
            conn.setDoInput (true);
            conn.setDoOutput (true);
            conn.setUseCaches (false);
            // Make server believe we are form data…
            conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
            DataOutputStream out = new DataOutputStream (conn.getOutputStream ());
            // Write out the bytes of the content string to the stream.
            out.writeBytes(requestPart1);
            out.flush ();
            out.close ();
            // Read response from the input stream.
            BufferedReader in = new BufferedReader (new
            InputStreamReader(conn.getInputStream ()));
            String temp;
            while ((temp = in.readLine()) != null)
                 response += temp + "\n"; // needs to be parsed to calculate the 4 numbers
            temp = null;
            in.close ();
              //System.out.println("Server response:\n" + response);
              // how to call the method:
              String[] ages = {"Under 5 years", "5 to 9 years", "10 to 14 years", "15 to 17 years"};
              String[] ages1 = {"Under 5 years"};
              String[] ages2 = {"5 to 9 years"};
              String[] ages3 = {"10 to 14 years"};
              String[] ages4 = {"15 to 17 years"};
              String female1 = Arrays.toString(findValues(response, "female", ages1));
              String female2 = Arrays.toString(findValues(response, "female", ages2));
              String female3 = Arrays.toString(findValues(response, "female", ages3));
              String female4 = Arrays.toString(findValues(response, "female", ages4));
              String female = female1 + "+" + female2 + "<" + female3 + ">" + female4 + "&";
              String male1 = Arrays.toString(findValues(response, "male", ages1));
              String male2 = Arrays.toString(findValues(response, "male", ages2));
              String male3 = Arrays.toString(findValues(response, "male", ages3));
              String male4 = Arrays.toString(findValues(response, "male", ages4));
              String male = male1 + "+" + male2 + "<" + male3 + ">" + male4 + "&";
              System.out.println(female);
              System.out.println(male);
            //Simplified string response, makes use of regular expressions
            //Start manipulation of numbers inside string
            int left = female.indexOf("[");
              int right = female.indexOf("]");
              // pull out the text inside the parens
              String parsed = female.substring(left+1, right);
              double parseddub = Double.parseDouble(parsed);
              //divide the group Under5Years into Under12Mo and 1to4Yr
              double Group1Adub = parseddub*.25;//25% for Under12Mo
              Group1Adub = Math.ceil(Group1Adub);
              int Group1A =(int)Group1Adub;
              double Group1Bdub = parseddub*.75;//75% for 1to4Yr
              Group1Bdub = Math.ceil(Group1Bdub);
              int Group1B =(int)Group1Bdub;
              int left2 = female.indexOf("+");
              int right2 = female.indexOf("<");
              // pull out the text inside the parens
              String parsed2 = female.substring(left2+2, right2-1);
              double parsed2dub = Double.parseDouble(parsed2);
              //divide the group 5to9Yr into 5Yr, 6to7Yr, and 8to9Yr
              double Group2Adub = parsed2dub*.2;//20% for 5Yr
              Group2Adub = Math.ceil(Group2Adub);
              int Group2A =(int)Group2Adub;
              double Group2Bdub = parsed2dub*.4;//40% for 6to7Yr
              Group2Bdub = Math.ceil(Group2Bdub);
              int Group2B =(int)Group2Bdub;
              double Group2Cdub = parsed2dub*.2;//20% for 8Yr
              Group2Cdub = Math.ceil(Group2Cdub);
              int Group2C =(int)Group2Cdub;
              double Group2Ddub = parsed2dub*.2;//20% for 9Yr
              Group2Ddub = Math.ceil(Group2Ddub);
              int Group2D =(int)Group2Ddub;
              int left3 = female.indexOf("<");
              int right3 = female.indexOf(">");
              // pull out the text inside the brackets
              String parsed3 = female.substring(left3+2, right3-1);
              int Group3A = Integer.valueOf(parsed3).intValue();
              int left4 = female.indexOf(">");
              int right4 = female.indexOf("&");
              // pull out the text inside the brackets
              String parsed4 = female.substring(left4+2, right4-1);
              int Group4A = Integer.valueOf(parsed4).intValue();
              int left5 = male.indexOf("[");
              int right5 = male.indexOf("]");
              String parsed5 = male.substring(left5+1, right5);
              double parsed5dub = Double.parseDouble(parsed5);
              //divide the group Under5Years into Under12Mo and 1to4Yr
              double Group5Adub = parsed5dub*.25;//25% for Under12Mo
              Group5Adub = Math.ceil(Group5Adub);
              int Group5A =(int)Group5Adub;
              double Group5Bdub = parsed5dub*.75;//75% for 1to4Yr
              Group5Bdub = Math.ceil(Group5Bdub);
              int Group5B =(int)Group5Bdub;     
              int left6 = male.indexOf("+");
              int right6 = male.indexOf("<");
              // pull out the text inside the parens
              String parsed6 = male.substring(left6+2, right6-1);
              double parsed6dub = Double.parseDouble(parsed6);
              //divide the group 5to9Yr into 5Yr, 6to7Yr, and 8to9Yr
              double Group6Adub = parsed6dub*.2;//20% for 5Yr
              Group6Adub = Math.ceil(Group6Adub);
              int Group6A =(int)Group6Adub;
              double Group6Bdub = parsed6dub*.4;//40% for 6to7Yr
              Group6Bdub = Math.ceil(Group6Bdub);
              int Group6B =(int)Group6Bdub;
              double Group6Cdub = parsed6dub*.2;//20% for 8Yr
              Group6Cdub = Math.ceil(Group6Cdub);
              int Group6C =(int)Group6Cdub;
              double Group6Ddub = parsed6dub*.2;//20% for 9Yr
              Group6Ddub = Math.ceil(Group6Ddub);
              int Group6D =(int)Group6Ddub;
              int left7 = male.indexOf("<");
              int right7 = male.indexOf(">");
              // pull out the text inside the brackets
              String parsed7 = male.substring(left7+2, right7-1);
              int Group7A = Integer.valueOf(parsed7).intValue();
              int left8 = male.indexOf(">");
              int right8 = male.indexOf("&");
              // pull out the text inside the brackets
              String parsed8 = male.substring(left8+2, right8-1);
              int Group8A = Integer.valueOf(parsed8).intValue();
              //female
              int Group1 = Group1A;
              int Group2 = Group1B + Group2A;
              int Group3 = Group2A + Group2B + Group2C;
              int Group4 = Group2C + Group2D + Group3A + Group4A;     
              //male
              int Group5 = Group5A;
              int Group6 = Group5B + Group6A;
              int Group7 = Group6A + Group6B + Group6C;
              int Group8 = Group6C + Group6D + Group7A + Group8A;
              System.out.println("Server response:\n" + "\n" + "Female");
              System.out.println("Under 12 Months:    " + Group1);
              System.out.println("1 to 4 Years Old:   " + Group2);
              System.out.println("5 to 8 Years Old:   " + Group3);
              System.out.println("8 to 17 Years Old:  " + Group4);
              System.out.println("\n" + "Male");
              System.out.println("Under 12 Months:    " + Group5);
              System.out.println("1 to 4 Years Old:   " + Group6);
              System.out.println("5 to 8 Years Old:   " + Group7);
              System.out.println("8 to 17 Years Old:  " + Group8);
    }Currently it functions using a regex, and executes, but doesn't return any numbers, only returns zeros...If you could help me out with this, that would be amazing! Thanks so much.

    hmm, is there a way to do it without an external API? Of course there is.
    looks like i have to download the API and the idea behind the program is to make it so multiple people running only java can run the program, without having to download APIs, ect, to make it run. Not sure if that is what JTidy entails, but is that what you were suggesting?Personally, I don't understand the resistance to using well-tested tools already in existence as opposed to trying to rewrite a shallow facsimile of said tools. You can distribute the JTidy library along with your application and save yourself a great deal of development and debugging effort.
    ~

  • Calling class via an Applet, Java stored within database

    I don't know if this is the right place to post, but. I'm trying to create an Applet that references a JAVA class stored in the database. My code looks something like this:
    <applet code="Hello.class" codebase="http://www.somesite.com/pls/dad/" width="150" height="30"></applet>
    Hello.class is stored within a 10g database. The codebase is a vitural url that connects to a schema within the database. Can this be done?? and How??

    Look at HttpCallout.java in the following code sample
    http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/jwcache/Readme.html
    Kuassi

  • Including HTML tags in Spry XML data sets

    How does one add HTML tags to Spry XML data sets so that the displayed items include that markup?
    For example, I might want to bold-face words within XML data items. I have tried adding the markup, but instead of seeing, for example:
    This is bold face
    in the Spry table, I see:
    This is <b>bold</b> face
    I have tried using CDATA elements in the XML to no avail.

    Set the data type for the column as per
    var ds1 = new Spry.Data.XMLDataSet("myData.xml", "rows/row");
    ds1.setColumnType("myColumn", "html");
    Gramps

  • Downloading the string as an XML file

    I tried to download a string stored in session to be downloaded as a XML file. I am able to download the file. But the problum I am getting space at the top of the file
    The code I used is like
    <%
    String xmlContent = xmlContent.trim();
         SAXBuilder builder = new SAXBuilder();
         Document doc = builder.build(new ByteArrayInputStream(xmlContent.getBytes()));
         XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
         //response.setContentType("APPLICATION/XML");
         response.setContentType( "application/xml" );
         response.setHeader("Content-Disposition","attachment; filename=\""+ fileName+"" + "\""+"");
         try{
              //outputter.output(doc,System.out);
              outputter.output(doc,out);
              //outputter.o
         catch(Exception e){
              System.out.println("Exception while displaying config request data "+ e);
    %>
    the output has spaces above the xml prolog. Can anybody help me in solving this issue.
    Thank you.

    I have designed an application that uses XML
    as the storage instead of database.Ok.
    I think searching for a particular element in an XML
    file is complex, and other than that I am not seeing
    any problem.You could abstract that complexity away behind an Adapter.
    So I need u guys view points on this
    "usage of data in an XML file".It depends on the nature and format of that to determine if it's a good idea. You need to consider a number of factors when deciding how to persist data. How much data is there, how often does the format and/or semantics of that data change, how is the data presented or processed. What is the lifetime of that data, what is the ratio of writes to reads. what is the access scope of the data, how secure does the data need to be.
    Finding the most appropriate format for data is oten more important than finding the most appropriate algorithm for a program, since data often has a longer life time that the programs that access it.

  • Getting HTML string out of DOM tree

    after i apply XSL transformation to an XML document, i get a
    DOM tree as a result.
    how do i extract the HTML from that tree as a string? lotus xsl
    lets you pass a PrintWriter to XSLProcessor -- how can I use the
    DocumentFragment for that same thing?
    thank you very much,
    zak.
    null

    zak may (guest) wrote:
    : : At this point we do not support xsl:output so you the only
    way
    : : to get printed output at this point is to use the DOM print
    : : method. xsl:output will be supported in a future release.
    : that's great -- but which "DOM print method" are you reffering
    : to?
    : neither DocumentFragment, nor Document, nor Node have a print
    : method.
    : my question remains -- how do I get at the HTML result of an
    XSL
    : transformation? XSLProcessor.processXSL returns a
    : DocumentFragment -- how do I print that DocumentFragment,
    markup
    : tags and all?
    : thank you very much,
    : zak.
    Both XMLDocument and XMLNode have a variety of print methods.
    None of them will transform XML into HTML however.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

  • How to write a string into an XML

    I wrote a web service to receive a string and write to Oracle Application Server as XML Document. But It is not writing anything. Below is writer program. What do I need to add to make it work
    public class Writer
    public Writer()
    } public void WriteHabFile(String out, String fileName)
    XMLDocument doc = new XMLDocument();
    try
    XMLPrintDriver output=new XMLPrintDriver(new FileOutputStream(new File(fileName)));
    output.setEncoding("utf-8");
    output.printDocument(doc);
    output.close();
    catch (Exception e)
    System.out.println(e.toString());
    public void WriteLanFile(String out2, String fileName2)
    XMLDocument doc = new XMLDocument();
    try
    XMLPrintDriver output=new XMLPrintDriver(new FileOutputStream(new File(fileName2)));
    output.setEncoding("utf-8");
    output.printDocument(doc);
    output.close();
    catch (Exception e)
    System.out.println(e.toString());
    Any help would be greatly appreciated.

    Why don't you try something like:
    public class Writer {
    public Writer(){}
    public void WriteHabFile(String out, String fileName) {
         oracle.xml.parser.v2.DOMParser parser = new oracle.xml.parser.v2.DOMParser();
         try {
              parser.parse(new BufferedReader(new StringReader(out)));
         catch(XMLParseException xe) {
              // Do Something
         catch(SAXException se) {
              // Do Something
         catch(IOException ie) {
              // Do Something
         XMLDocument doc = parser.getDocument();
    try {
    XMLPrintDriver output=new XMLPrintDriver(new FileOutputStream(new File(fileName)));
    output.setEncoding("utf-8");
    output.printDocument(doc);
    output.close();
    catch (Exception e)
    System.out.println(e.toString());
    public void WriteLanFile(String out2, String fileName2) {
         oracle.xml.parser.v2.DOMParser parser = new oracle.xml.parser.v2.DOMParser();
         try {
              parser.parse(new BufferedReader(new StringReader(out)));
         catch(XMLParseException xe) {
              // Do Something
         catch(SAXException se) {
              // Do Something
         catch(IOException ie) {
              // Do Something
         XMLDocument doc = parser.getDocument();
    try {
    XMLPrintDriver output=new XMLPrintDriver(new FileOutputStream(new File(fileName2)));
    output.setEncoding("utf-8");
    output.printDocument(doc);
    output.close();
    catch (Exception e)
    System.out.println(e.toString());
    Hope this helps,
    Mark Brown

  • How to Parse a string into an XML DOM ?

    Hi,
    I want to parse a String into an XML DOM. Not able to locate any parser which supports that. Any pointers to this?

    Download Xerces from xml.apache.org. Place the relevant JAR's on your classpath. Here is sample code to get a DOM document reference.
    - Saish
    public final class DomParser extends Object {
         // Class Variables //
         private static final DocumentBuilder builder;
         private static final String JAXP_SCHEMA_LANGUAGE =
             "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
         /** W3C schema definitions */
         private static final String W3C_XML_SCHEMA =
             "http://www.w3.org/2001/XMLSchema";
         // Constructors //
         static {
              try {
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   factory.setNamespaceAware(true);
                   factory.setValidating(true);
                   factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                   builder = factory.newDocumentBuilder();
                   builder.setErrorHandler(new ErrorHandler() {
                       public void warning(SAXParseException e) throws SAXException {
                           System.err.println("[warning] "+e.getMessage());
                       public void error(SAXParseException e) throws SAXException {
                           System.err.println("[error] "+e.getMessage());
                       public void fatalError(SAXParseException e) throws SAXException {
                           System.err.println("[fatal error] "+e.getMessage());
                           throw new XmlParsingError("Fatal validation error", e);
              catch (ParserConfigurationException fatal) {
                   throw new ConfigurationError("Unable to create XML DOM document parser", fatal);
              catch (FactoryConfigurationError fatal) {
                   throw new ConfigurationError("Unable to create XML DOM document factory", fatal);
         private DomParser() {
              super();
         // Public Methods //
         public static final Document newDocument() {
              return builder.newDocument();
         public static final Document parseDocument(final InputStream in) {
              try {
                   return builder.parse(in);
              catch (SAXException e) {
                   throw new XmlParsingError("SAX exception during parsing.  Document is not well-formed or contains " +
                        "illegal characters", e);
              catch (IOException e) {
                   throw new XmlParsingError("Encountered I/O exception during parsing", e);
    }- Saish

  • How can I parse an XML string, (not an XML file)?

    Hi,
    I am using Xerces2 Java Parser 2.4.0,
    I wanta parse an XML string, not an XML file, but
    in the Parser class there is only following methods:
    parse(InputSource source)
    parse(java.lang.String systemId)
    thanks

    hi
      InputSource is = new InputSource(new ByteArrayInputStream(xmlSrc.getBytes()));
      HTH
    vasanth-ct

  • Cannot get questionnaire HTML string SAP CRM 7.0  EHP3

    Hello,
    We are trying to use questionnaires in Activities and it doesn't work.
    This error : Cannot get questionnaire HTML string is shown.
    I checked  Note 1600561 - Changes done in values template XSLT not taken into account, but it isn't valid for our release ( EHP3 )
    Thanks in advance for your help.
    Belén

    Hi,
    We used the questionnaires (questionnaires was displayed and worked) but we faced issues with the display in web UI (only when the questionnaires are linked to an activity/opportunity). The Admin screen for questionnaire works well).
    We have implemented the following notes in order to correct this displaying issues :
    - 1858059 : Upload the CRM_SVY_GENERATE_BSP_TEMPLATE.ZIP, refresh cash and generate all surveys
    And then notes mentioned above
    - 1914885 & 1944288 in the relevant order.
    But we cannot display anymore the existing surveys (They are active, all scenarios are flagged).
    Error message : Cannot get questionnaire HTML string
    Any Ideas how to proceed to solve ? (we work on EHP2)

  • A class to format an XML string into indented xml code

    I am looking for a class or a piece of code to format an XML string into indented xml code
    for example: an XML string as follows
    <servlet><servlet-name>Login</servlet-name>servlet-class>ucs.merch.client.system.LoginServlet</servlet-class></servlet><servlet-mapping><servlet-name>Login</servlet-name>
    to format into :
    <servlet>
    <servlet-name>Login</servlet-name>
    <servlet-class>ucs.merch.client.system.LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Login</servlet-name>
    <url-pattern>/Login</url-pattern>
    </servlet-mapping>
    e-mail : [email protected]

    Xerces has a class called OutputFormat
    If you have your XML document in memory, you can format it using the method setIndenting(true) on the OutputFormat class. The following is an example:
    assuming xmlDoc is our document and fileName is the name of the file we wish to write to:
    OutputFormat format = new OutputFormat(xmlDoc);
    // setup output file name
    PrintWriter printwriter = new PrintWriter(new FileWriter(fileName, false));
    // construct an XMLSerializer for writing the document
    XMLSerializer serializer = new XMLSerializer( printwriter, format );
    // Ensure output is indented correctly...
    format.setIndenting(true);
    // set serializer as a DOM Serializer
    serializer.asDOMSerializer();
    // serialize the document
    serializer.serialize(xmlDoc);
    hope this helps!
    Rob.

  • Need help displaying HTML files stored in content repository

    I have a very simple HTML file stored in a binary attribute (so the file could
    be uploaded through the Admin Portal) named "html" in the BEA Repository (8.1sp2)
    and would like to display it in a JSP. Here's a snippet from that JSP:
    <cm:getNode path="<%=myNodePath%>" id="myNode"/>
    <cm:getProperty node="<%=myNode%>" name="html" conversionType="html"/>
    I expected the getProperty tag to fetch the HTML file and render it inline, but
    I guess that's wishful thinking. Am I missing something?
    Thanks for any help!

    I added transactionTimeout="30" to the tag shown below. That did the trick, as
    long as I avoided certain combinations of tag attributes. Guess this one's a little
    moody.
    Thanks, Greg.
    Gregory Smith <[email protected]> wrote:
    Try setting the transactionTimeout to something greater than 0 on the
    <cm:getProperty> tag.
    Greg
    Marc N wrote:
    I have a very simple HTML file stored in a binary attribute (so thefile could
    be uploaded through the Admin Portal) named "html" in the BEA Repository(8.1sp2)
    and would like to display it in a JSP. Here's a snippet from that JSP:
    <cm:getNode path="<%=myNodePath%>" id="myNode"/>
    <cm:getProperty node="<%=myNode%>" name="html" conversionType="html"/>
    I expected the getProperty tag to fetch the HTML file and render itinline, but
    I guess that's wishful thinking. Am I missing something?
    Thanks for any help!

  • How to display a HTML String in a ActiveX WebBrowser ?

    How to direct display a HTML String in a ActiveX WebBrowser without use a URL ?

    I am sure that it would depend on the browser, but with Internet Explorer from Microsoft, I don't think you can. (I may be wrong on this.) What you could do would be to save your string to file and read the file as a url in the browser. I know that this is a step you are trying to avoid, but it will work.
    Hope that this helps,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

Maybe you are looking for