XML Object - status returned varies between calls

Sometimes I get "success", sometimes I get "no success, no
error"
What gives? Same results across the wire as far as I can
see...
//=========================
var baseXML = new XML();
var baseURL = "
http://pbG42.local/cgi-bin/fRealWidget_PG.cgi";
baseXML.ignoreWhite = true;
baseXML.onLoad = loadXML;
// also, button to trigger it
function loadXML(success:Boolean):Void {
if (success) {
//process XML content
trace("laodXML - success" );
trace (" loaded = " + this.loaded);
trace( this);
} else if (this.status == 0) {
trace( "no success, no error" );
} else {
//display error message
trace("loadXML - error " + this.status);

y, and this.loaded comes back as FALSE, success is FALSE,
but the XML response string is there ?!
weird

Similar Messages

  • Lifetime of JNI objects between calls.

    Is it possible to store/cache non-class JNI objects between calls?
    I know I can 'lock' jclass object to *env however I need to be able to do more than this.
    Implementation :
    C++ code for which I am not responsible for NOR will I ever get access to the source code needs to be built into a Java Application.
    Everything that I need to do works fine except when I need to have jobject's and, in particular, the JNIEnv reference to be cached in the dll between JNI calls.
    Raison d'etre : I want to implement a Callback using a Java object (Observer/Observable) so that the status of the C legacy app can be monitored via a callback implemented as part of the dll.
    Java object is called via the C callback, sets status via a status method called via JNI, Java App is notifoed of the change.
    Problem, as long as the first call the the jobject occurs within the actual JNI call that creates the Java object all is well, as soon as I try and store the jobject and JNIEnv references so that the C callback can call it as well then things break.
    Is it possible to have JNI objects whose lifetime spans JNI calls at all?

    In the meantime I have found out exactly how to achieve callbacks via native/Java. Having studied Sheng Liang's book (an absolute must buy and read) things became a lot clearer.
    This is what I discovered...
    The main issues with implementing callbacks within a JNI framework are the following..
    Lifetime of the JNIEnv and other classes/objects involved on the native side of the process.
    Threading issues on the native side, especially when interacting with Objects created in a different thread.
    The first issue is dealt with, in part, by being able to obtain a valid JNIEnv at arbitrary points in the native code. If you obtain a valid JNIEnv in an arbitrary native thread that JNIEnv is valid in it so this also helps problems with the second issue.
    The key to obtaining a valid JNIEnv is in having a reference to the calling VM.
    The function..
    JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
    allows you to cache a reference to the calling JVM. It is called when the dll is loaded before any other functions in the native code are called. The JavaVM reference is valid throughout the lifetime of the dll's instance.
    you can then do this to obtain a valid JNIEnv anytime you like..
    JNIEnv *env;
    vm->GetEnv((void **)&env, JNI_VERSION_1_2);
    Ok, thats dealt with problem of obtaining valid JNIEnv's when we need them.
    In order to extend the lifetime of objects and, in particular, classes from which those objects are instantiated you need to create global ref's to them. I did mine this way..
    In the calling Java code, I instantiate a callback object and pass that to a native method whose native code does the following..
    gets the object's class as a local reference, creates a NewGlobalRef of the passed object and its class. These jobject and jclass global references are stored as global vars in the DLL. You can also, at this point, create jmethodID's for all the methods you may need to call as part of the callback process however callbacks should finish as quickly as possible so restrict your calls to the minimum. Caching the method ID does not require a global ref, nor is is thread 'sensitive'. GetMethodID can be used to store a local jmethodID reference in a global jmethodID var, this saves you some time and performance hits in the native callback functions.
    The above description deals with the lifetime of objects between JNI calls. What about the threading issues?
    We have seen how to get a valid JNIEnv when we want one. This JNIEnv is valid for the NATIVE thread in which we call vm->GetEnv((void **)&env, JNI_VERSION_1_2);
    There is another way of getting valid JNIEnv's when we want them but this seems only to work when we are using the invocation interface (having the native side create an embedded JVM). This is the jvm->AttachCurrentThread function. I have tried both, only GetEnv seems to work as expected in the native DLL code, AttachCurrentThread when the JVM is invoked from inside a native application.
    To successfully perform the native/Java callback, assuming you have cached a JavaVM reference and the callback object/class correctly, is to get a valid JNIEnv as shown above, use this JNIEnv for the method calls you need to perform on the callback object, cleanup if needed.
    Note, you MUST DeleteGlobalRef's before the DLL is unloaded. If you don't you may find your Java VM crashing on exit (a horrible bug to have to track down).
    Either explicitly create a cleanup native method that you have to call and/or use the JNI_OnUnload function that is called just before the DLL is unloaded (usually when the JVM is being stopped).
    Things you can do to make your callback efficient :
    Make the calls return as soon as possible. I use the Observable/Observer pattern so that further Java objects (the observers) can handle the changes made to the callback object. If, like me, you are reflecting state changes in the native system component via callbacks and displaying them in a GUI environment then your Observer can wake up a thread to do the GUI updates, the observable callback need only notifyObservers in order to start things off and return.
    Hope this clears things up for you, if you have further questions please mail me, I believe my email address is available, if not post here and I will get to you.

  • Calling Bpel Process From a Jsp(Need a string output instead of XML object)

    Hi
    I am calling a BPEL process(Synchrononus) from a JSP page, Where Bpel process calls a java web service.The output from Bpel process is returned as an XML object. I need the output in a string format.Please let me know the steps to get the string output.
    I also executed invokeCreditRatingService.jsp(from samples shipped with SOA Suite) that calls CreditRatingService bpel, but i was getting the following output where the rating value is printed as an XML object.
    Output:-
    BPELProcess CreditRatingService executed!
    Credit Rating is oracle.xml.parser.v2.XMLElement@9511c8
    Please let me know, what changes i need to make to get the string output.I followed all the steps given in "orabpel-Tutorial7-InvokingBPELProcesses.PDF" to execute credit rating jsp.
    We are using SOA Suite 10.1.3.1.0 version.Do I need to make any changes to the code, to make it work with this version.
    Thanks
    Vandana.

    The call payload.get("payload") returns, as you have observed, an XMLElement. You can simply convert the XMLElement into an XML string by using a DOMSerializer implementation. The following code is very useful for this purpose:
    http://javafaq.nu/java-example-code-432.html
    Best,
    Manfred

  • XML object returns attributes but not elements

    Hi,
    I'm very new to this so my problem is probably down to bad practices but anyhow... I have code as follows:
    var s:String = load.data; //This turns up as fully-formed correct XML every time.
    var docx:XML = new XML(s);
    trace(new String(docx..@src));
    trace(new String(docx..entry));
    In the above the first trace works fine and returns the value of all 'src' attributes found in the document.
    However, the second statement does nothing at all. It should return a list of 'entry' nodes I think.
    The XML document I'm using is found here: http://picasaweb.google.com/data/feed/api/all
    Is the XML object malfunctioning or is my code wrong?
    Thanks
    Jack

    Turns out it was a namespace issue. Here's an explanation for others who get stuck with a similar issue.
    I added these lines to the script in my mxml file:
    private namespace webNameSpace = "http://www.w3.org/2005/Atom";
    use namespace webNameSpace;
    The string "http://www.w3.org/2005/Atom" is taken from the root node of my xml document. In this case it was from the tag:
    <feed
         xmlns='http://www.w3.org/2005/Atom'
         xmlns:exif='http://schemas.google.com/photos/exif/2007'
         xmlns:gphoto='http://schemas.google.com/photos/2007'
         xmlns:media='http://search.yahoo.com/mrss/'
         xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
         xmlns:gml='http://www.opengis.net/gml'
         xmlns:georss='http://www.georss.org/georss'
    >
    Presumably, if I want to use tags that have NS prefixes (eg <gphoto:url>) then I'll need to add the other namespaces for use.
    Still, if anyone has any comments on whether there is a cleaner way to do this, or even just to let me know I'm doing it right, then please post back as I'm very knew to this and would like my code to be corrected/affirmed if possible.
    Thanks all,
    Jack
    EDIT: can I mark my own posts as answered?

  • Converting Xml object strait to AS3 ....

    Hi there,
    I would like to find out a strait convertion from this Xml object to AS3 which would have to be
    the same (outcome / use / readout) as code below including a Http call !!!
    NO, Combobox or a List !!! Strait forward to be used in a function() or in a text="",  title="" or label="".
    <mx:XML id="urlsOceania" source="com/assets/Xml/ENOceania.xml"/>
    <mx:Script>
         <![CDATA[          private function name():void {
                   nameType.source = urlsOceania.urlOceania.(@urlID==1).nameCountry;
              }     ]]>
    </mx:Script>
    And used in Mxml as well:
    <mx:Panel title="{urlsOceania.urlOceania.(@urlID==1).prefix}">
    Thanks in advance aktell2007

    is your xml in an external file?
    if yes, (eg, resources.xml), you would use:
    var xml:XML
    var urlLoader:URLLoader=new URLLoader();
    urlLoader.addEventListener(Event.COMPLETE,completeF);
    urlLoader.load(new URLRequest("resources.xml"));
    function completeF(e:Event):void{
    xml=e.target.data;
    public static function getLanguage(tag:String):String{
    if(xml[tag]){
    return xml[tag];
    } else {
    return "Error";

  • Using HttpServletRequest object to share variables between static methods.

    Does anyone know of the overhead/performance implications of using the HttpServletRequest object to share variables between a static method and the calling code?
    First, let me explain why I am doing it.
    I have some pagination code that I would like to share across multiple servlets. So I pulled the pagination code out, and created a static method that these servlets could all use for their pagination.
    public class Pagination {
         public static void setPagination (HttpServletRequest request, Config conf, int totalRows) {
              int page = 0;
              if (request.getParameter("page") != null) {
                   page = new Integer(request.getParameter("page")).intValue();
              int articlesPerPage = conf.getArticlesPerPage();
              int pageBoundary = conf.getPageBoundary();
                int numOfPages = totalRows / articlesPerPage;  
                // Checks if the page variable is empty (not set)
                if (page == 0 || (page > numOfPages && (totalRows % articlesPerPage) == 0 && page < numOfPages + 1)) {    
                 page = 1;  // If it is empty, we're on page 1
              // Ex: (2 * 25) - 25 = 25 <- data starts at 25
             int startRow = page * articlesPerPage - (articlesPerPage);
             int endRow = startRow + (articlesPerPage);           
             // Set array of page numbers.
             int minDisplayPage = page - pageBoundary;
             if (minDisplayPage < 1) {
                  minDisplayPage = 1;     
             int maxDisplayPage = page + pageBoundary;
             if (maxDisplayPage > numOfPages) {
                  maxDisplayPage = numOfPages;     
             int arraySize = (maxDisplayPage - minDisplayPage) + 1;
             // Check if there is a remainder page (partially filled page).
             if ((totalRows % articlesPerPage) != 0) arraySize++;
             // Set array to correct size.
             int[] pages = new int[arraySize];
             // Fill the array.
             for (int i = 1; i <= pages.length; i++) {
                  pages[i - 1] = i;
             // Set pageNext and pagePrev variables.
             if (page != 1) {
                  int pagePrev = page - 1;
                  request.setAttribute("pagePrev", pagePrev);
             if ((totalRows - (articlesPerPage * page)) > 0) {
                 int pageNext = page + 1;
                 request.setAttribute("pageNext", pageNext);
             // These will be used by calling code for SQL query.
             request.setAttribute("startRow", startRow);
             request.setAttribute("endRow", endRow);
             // These will be used in JSP page.
             request.setAttribute("totalRows", totalRows);
             request.setAttribute("numOfPages", numOfPages);
             request.setAttribute("page", page);
             request.setAttribute("pages", pages);          
    }I need two parameters from this method (startrow and endrow) so I can perform my SQL queries. Since this is a multithreaded app, I do not want to use class variables that I will later retrieve through methods.
    So my solution was to just set the two parameters in the request and grab them later with the calling code like this:
    // Set pagination
    Pagination.setPagination(request, conf, tl.getTotalRows());
    // Grab variables set into request by static method
    int startRow = new Integer(request.getAttribute("startRow").toString());
    int endRow = new Integer(request.getAttribute("endRow").toString());
    // Use startRow and endRow for SQL query below...Does anyone see any problem with this from a resource/performance standpoint? Any idea on what the overhead is in using the HttpServletRequest object like this to pass variables around?
    Thanks for any thoughts.

    You could either
    - create instance vars in both controllers and set them accordingly to point to the same object (from the App Delegate) OR
    - create an instance variable on the App Delegate and access it from within the view controllers
    Hope this helps!

  • Passing data from an XML object to an itemRenderer

    I'm trying to color the background of a column in a datagrid and have found a sample file that illustrate the concept. However, the sample has data stored in an arrayCollection whereas mine is in an XML object. The problem is that the data in the sample file is apparently automatically passed to the itemRenderer (shown below: note the trace statement). My XML object does not appear to automatically pass data to the itemRenderer. So my questions are:
    1. Is there a simple way to pass data stored in an XML object to an itemRenderer
    or
    2. Should I convert my XML to an arrayCollection? If so, what's the best way to do this-- I've tried the following, but without success:
    <mx:Model id="xmldata" source="example3.xml"/>
      <mx:ArrayCollection id="myAC" source="{ArrayUtil.toArray(xmldata.Example1)}" />
    Here's what the xml looks like:
    <TABLE>
       <EXAMPLE1>
          <difficulty> 0.5 </difficulty>
          <discrimination> 0.7 </discrimination>
          <item> 3 </item>
       </EXAMPLE1>
    </TABLE>  
    Here's the itemRenderer:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml">
        <!--
            This item renderer simply extends Label and overrides the updateDisplayList function to
            draw a gradient-filled rectangle. The colors in the gradient are determined from the
            data.
        -->
        <mx:Script>
        <![CDATA[
            import flash.geom.Matrix;
            import flash.display.GradientType;
            import flash.display.Graphics;
            override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                super.updateDisplayList(unscaledWidth,unscaledHeight);
                var m:Matrix = new Matrix();
                m.createGradientBox(unscaledWidth,unscaledHeight);
                var g:Graphics = graphics;
                            trace("data.col3="+data.col3)
                var colors:Array = (data.col3 < 2000 ? [0x0000CC,0x0000FF] : [0x00CC00,0x00FF00]);
                g.clear();
                g.beginGradientFill(GradientType.LINEAR, colors, [0.2,0.6], [0,255], m);
                // the rectangle is drawn a little high and a little tall to compensate for the gap
                // the DataGrid introduces between rows.
                g.drawRect(0, -2, unscaledWidth, unscaledHeight+4 );
                g.endFill();
        ]]>
        </mx:Script>
    </mx:Label>

    This sample code should answer your question of how to bring data into the renderer automatically. It comes in via the DataGrid dataProvider and then you refer to it in the renderer as data.XYZ, where XYZ is the field in the XML with the data. See FB 3 help sys on e4x syntax.
    ------------------ mainapp.mxml --------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      creationComplete="srvc.send();">
      <mx:Script>
        <![CDATA[
          import mx.rpc.events.ResultEvent;
          import mx.collections.XMLListCollection;
          [Bindable] private var xlc:XMLListCollection;
          private function dataHandler(evt:ResultEvent):void{
            xlc = new XMLListCollection(evt.result..EXAMPLE1 as XMLList);
        ]]>
      </mx:Script>
      <mx:HTTPService id="srvc" url="data2.xml" result="dataHandler(event)"
        resultFormat="e4x"/>
      <mx:DataGrid dataProvider="{xlc}">
        <mx:columns>
          <mx:DataGridColumn headerText="Difficulty" dataField="difficulty"/>
          <mx:DataGridColumn headerText="Discrimination" dataField="discrimination"/>
          <mx:DataGridColumn headerText="Item" itemRenderer="MyLabel"/>
        </mx:columns>
      </mx:DataGrid>
    </mx:Application>
    ----------- MyLabel.mxml --------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import flash.geom.Matrix;
          import flash.display.GradientType;
          import flash.display.Graphics;
          override protected function updateDisplayList(unscaledWidth:Number,
            unscaledHeight:Number):void{
            super.updateDisplayList(unscaledWidth,unscaledHeight);
            this.text = data.col3;
            var m:Matrix = new Matrix();
            m.createGradientBox(unscaledWidth,unscaledHeight);
            var g:Graphics = graphics;
            var colors:Array = (data.col3 < 2000 ? [0x0000CC,0x0000FF] : [0x00CC00,0x00FF00]);
            g.clear();
            g.beginGradientFill(GradientType.LINEAR, colors, [0.2,0.6], [0,255], m);
            g.drawRect(0, -2, unscaledWidth, unscaledHeight+4 );
            g.endFill();
        ]]>
      </mx:Script>
    </mx:Label>
    ------------ data2.xml ----------------
    <?xml version="1.0" encoding="utf8"?>
    <TABLE>
       <EXAMPLE1>
          <difficulty> 0.5 </difficulty>
          <discrimination> 0.7 </discrimination>
          <col3> 3 </col3>
       </EXAMPLE1>
    </TABLE>

  • Placing a variable value into an XML Object

    I am trying to figure out how I would get the value of a variable into an XML Object.
    I have the variable
    var dragonName:String = "Samuel";
    var listing:XML = new XML();
    listing = <thedragon>
                            <dragon>
                                  <myname> dragonName.valueOf()</myname>
                             </dragon>
                   </thedragon>
    However, the dragon name does not show up when I go trace(listing);
    How do I do it and should I have imported something as well or what?

    yeah - in fact you can do all sort of things. This is extremely useful when you creating an XML dynamically e.g.
    var names:Array = ["Sammy", "Samuel", "Sancho"];
    var xml:XML =     <dragon>
                         <myname>{Math.floor(Math.random()*names.length) < 2 ? names[1] : names[Math.round(Math.PI) - 1]}</myname>
                      </dragon>;
    or you can even run a function:
    var xml:XML =     <dragon>
                         <myname>{dragonName()}</myname>
                      </dragon>;
    private function dragonName():String {
       return "Samuel";

  • How can i filter an xml object on an attribute?

    I want address an xml object with .(@ attributeNameHere == "textToSearchForHere") and have it return the node it’s associated with. 
    This is the text from the adobe help site and it’s similar to my actual code.  I’m querying this xml object: staticVar.employee.(@id=="347").  FlashBuilder 4.7 is returning an error “No such variable: @id”. when I look in debugger.
    This example is found in Adobe's help site: Adobe Flash Platform * Traversing XML structures
    The help site says
    The following expressions are all valid:
    x.employee.(lastName == "McGee")—This is the secondemployeenode.
    x.employee.(lastName == "McGee").firstName—This is thefirstNameproperty of the secondemployeenode.
    x.employee.(lastName == "McGee").@id—This is the value of theidattribute of the secondemployeenode.
    x.employee.(@id == 347)—The firstemployeenode.
    public var staticVar:XML = 
    <employeeList>
          <employee id="347">
               <lastName>Zmed</lastName>
               <firstName>Sue</firstName>
               <position>Data analyst</position>
          </employee>
          <employee id="348">
               <lastName>McGee</lastName>
               <firstName>Chuck</firstName>
               <position>Jr. data analyst</position>
          </employee>
    </employeeList>;
    I’m expecting this: staticVar.employee.(@id=="347") will return the following node:
    <employee nu="347">
    <lastName>Zmed</lastName>
    <firstName>Sue</firstName>
    <position>Data analyst</position>
    </employee>
    If this is the wrong, then what is the correct way to access the xml node based on an attribute?  How can i get that node 347 in this example to be found and returned?  I've opened a ticket with the adobe help team and we're on the 8th day and they have not been helpful at all.

    If you are using e4x as the result format for your service
    you can do the following
    //a XMLList of all day information
    var result:Object = event.result.day;
    //consits all information for month zero
    var month0:XMLList = result.(@month == 0);
    //consists of booking info for day 28 of month 0
    var day28Month0:XMLList = month0.(@day == 28);
    //this also can be done
    //contains booking info for all months for day 28
    var day28AllMonths:XMLList = result.(@day == 28);
    Using this technique you should be able to gather info about
    all user selected dates and build the smaller (filtered) list.
    HTH

  • How to access a nested child tag values in  XML Object(getting error:No Such variable)

    Hi,
    I could see the XML object data and while accessing a perticular attribute let say "SlotA"  it is showing "No such variable Error".
    I appreciate any of your  inputs or suggestions to solve this error.
    You can find the screen snapshot of the problem as part of the attachment here.
    Thanks in advance
    CSNPrasad.

    Dear Natasha,
    Thanks for your mails & cooperation as well.
    This time i  have added the trace() and can see the value.Now the problem is "can't access a property or method of a null object reference"
    Noe: This code mxml file is called at Runtime based on the data defined in the XMLSocket data.
    I need to display Remote devices like davice1,device2 device3 etc. these are added/delete at any time ,so we need to show same changes in UI at Runtime.
    I implemented Polymorphism concept to construct the device object at runtime like follows
    var device:Object;
    for each (var deviceData:XML indeviceListXML..Device)
                        device = getBatteryBay(deviceData.deviceId)
                        // If device already exists with the deviceId, update the details
                        // Else create a newdevice and add it to the container for displaying it.
                                                                                    if (device == null)
                            if (device.Type == "DEVICE1")
                                device = new Device1();
                            else if (device.Type == "DEVICE2")
                            device = new Device2();
                            else
                                device = new DefaultDevice();
                            device.id = deviceData.deviceId;
                          device.name = deviceData.devicename;
                         device.setData(deviceData);
    Here new Device1(); and new Device2() are the UIComponents and created at Runtime, upto here no problem to display, when i try to setData to the devices it is throwing error
    "can't access a property or method of a null object reference". because Device1 and Device2 has Child components like "DataIndicator" and need to set properties to these components which are not created yet.
    I appreciate any of your Input or suggestions at the earliest
    Thanks in Advance
    Regards

  • XML object help

    I'm having major problems with what seems to be a straight
    forward thing. I have an XML object that looks like this:
    <SearchResponse xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soap="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns="
    http://tempuri.org/" xmlns:xsd="
    http://www.w3.org/2001/XMLSchema">
    <SearchResult>
    <node>
    <cluster FullName=", copyright, rights reserved"
    Name="copyrightrights reserved">
    <doc teaser="Teaser" url="APPLICAT.PPT" rank="1887"
    size="361472" thumbs="true" title="Doc Title"/>
    <doc teaser="Teaser" url="APPLICAT.PPT" rank="1887"
    size="361472" thumbs="true" title="Doc Title"/>
    <doc teaser="Teaser" url="APPLICAT.PPT" rank="1887"
    size="361472" thumbs="true" title="Doc Title"/>
    </cluster>
    <cluster FullName="app server, application server, bea
    weblogic" Name="app serverapplication serverbea weblogic">
    <doc teaser="Teaser" url="APPLICAT.PPT" rank="1887"
    size="361472" thumbs="true" title="Doc Title"/>
    <doc teaser="Teaser" url="APPLICAT.PPT" rank="1887"
    size="361472" thumbs="true" title="Doc Title"/>
    <doc teaser="Teaser" url="APPLICAT.PPT" rank="1887"
    size="361472" thumbs="true" title="Doc Title"/>
    </cluster>
    </node>
    </SearchResult>
    <SearchResponse>
    I'm basically just trying to loop through it using something
    like this:
    for(var i:Number=0;
    i<clusters_xml.node[0].cluster.length(); i++)
    var clusterNode_xml:XML = clusters_xml.node[0].cluster
    for(var j:Number=0; j<clusterNode_xml.doc.length(); j++)
    var docNode:XML = clusterNode_xml.doc[j];
    all_xml.appendChild(docNode);
    The thing is, it works with an XML file with the SAME data
    using HTTPService, but when it's a WebService - it just doesnt
    work. I set the resultFormat to e4x on both

    how do i handle the namespaces?
    something like this ?
    clusters_xml.removeNamespace(clusters_xml.namespace("xsi"));
    clusters_xml.removeNamespace(clusters_xml.namespace("xsd"));
    clusters_xml.removeNamespace(clusters_xml.namespace("soap"));
    there's still the one called
    http://tempuri.org/
    which I cant get rid of even by using something like
    clusters_xml.removeNamespace(clusters_xml.namespaceDeclarations()[0]);

  • XML for Forced Return

    I use XSLT to create XML documents to be opened in FrameMaker and converted to structured documents. I have one element (called SyntaxPara) in which I'd like multiple lines separated by forced returns, as indicated by "{" symbol in the document (or \r in the Find/Change dialog). Anybody know what the XML coding would be to specify a forced return? I cannot seem to nail it down. I need to do this because my structured template is supporting styles used with unstructured FrameMaker, and that happens to be how they're doing it. Thanks,

    John,
    I do not know what the Kosher XML method is, but you can define an element in your EDD, say Break, which has no content or attributes. The EDD defines its formatting as character formatting and a prefix or suffix that is the return character, namely \r. Note that this requires an update to your EDD. Your XSLT would then translate the XML object that indicates a break into the element Break.
    Van

  • Replace text in XML object using a sequence of tags as input

    Hi, I need to write an apparently very simple function that replaces a text between tags in an XML object receving as input the sequence of tags to identify the element, but I miss one point.
    I travel through the XML tree using a element variable like
    Code:
    element = element.child(n)
    using at each step the tags provided as input to decide the value of "n". Now, when I reach the tags that contain the text to be replaced, what to do? If I use
    Code:
    element.replace(0, newValue)
    I replace the text just in element  not in the original object...
    For example having
    <publishing_date>
           <year>2002</year>
           <month>Jan</month>
    <success_date>
           <year>2004</year>
           <month>Feb</month>
    </success_date>
    I want to call a function like
    replace(["success_date", "month"], "Mar")
    and have an XML object where the second occurence of Feb is replaced with "Mar"
    Any suggestion on this easy task?
    Thanks a lot
    Giuse

    Hi Michael, thanks but my question was difference.
    I need to make a function to operate with input tags, not with known tags. So I am writing a loop that scans the XML object using the tags provided in input until it reaches the desired tag with the text to be replaced.
    That's why I wrote
    element = element.child(n)
    that I was thinking to use at each step of the loop looking for desired tag.
    There I have the problem: if I use
    element.replace.... I am changing the text between the tags in the element variable, not in the original XMLObject, and since there are no pointers in JavaScript, how to do that?
    I hope to have been more clear now..... did I ?
    Thanks and best reagrds
    Giuseppe

  • Conversion of string into XML object

    Hi
    I am having some problems with conversion of string (containing XML data) into Flex XML object and binding it later to UI elements to output/maintain this data.
    Binding of XML structure to UI elements works perfectly fine if I will do following:
    1)      Hardcode XML object within Flex file
    2)      Read xml file from repository (xml file inside the Flex project)
    3)      Use HTTP request to retrieve XML data
    Unfortunately none of the above scenarios suits my solution.
    I am developing a prototype application for processing Flex forms inside SAP system. I have decided to make data bindings using XML structure stored in Data Base. When rendering form inside web browser based application I am retrieving corresponding XML schema (empty for new forms and populated for saved forms) and pass it to Flex form as a string type import parameter. Data is being passed correctly (I can display it on TextArea control for instance) but after conversion to XML and binding to DataGrid I am not getting any results.
    I am converting string (containing XML) to XML object in following way:
    Private var xml_obj:XML = new XML(string_xml );
    I am catching any potential errors but conversion is going well. After conversion I am not getting any results after binding it to DataGrid control and I am not able to access any of the nodes using AS code either. At the same time variable xml_obj is not empty (not null).
    Any help would be much appreciated.
    Regards
    Michael

    David
    First of all sorry for not stating it clearly but I am using Flex 3 for this development (at the moment it is the only choice when embedding Flex objects inside SAP applications).
    You must have missed the bit where I am describing how this XML data finds its way inside Flex. I am passing it to Flex as String type parameter during rendering (directly from DB where it is stored).
    Now, following code works perfect (XML is embedded inside Flex project):
                    <mx:XML id="form_data" source="../assets/example_xml_data.xml"/>
                    <mx:Script>
                                    <![CDATA[
                                                    import mx.collections.XMLListCollection;
                                                    import mx.controls.Alert;
                                                    [Bindable]
                                                    public var XML_list:XMLListCollection;
                                                    private function setParameters():void
                                                                   XML_list = new XMLListCollection(form_data.*);             
                                    ]]>
                    </mx:Script>
                    <mx:DataGrid id="myDataGrid" dataProvider="{XML_list}">
                                    <mx:columns>
                                                    <mx:DataGridColumn dataField="COMMON" headerText="Popular name"/>
                                                    <mx:DataGridColumn dataField="BOTANICAL" headerText="Botanical name"/>
                                                    <mx:DataGridColumn dataField="ZONE" headerText="Zone"/>
                                                    <mx:DataGridColumn dataField="LIGHT" headerText="Light"/>                                                                                                                                               
                                                    <mx:DataGridColumn dataField="PRICE" headerText="Price"/>                                               
                                                    <mx:DataGridColumn dataField="AVAILABILITY" headerText="Availability"/>                                    
                                    </mx:columns>               
                    </mx:DataGrid>
    But following code does not work (XML passed to Flex form as String input parameter):
    import sap.FlashIsland;
    import mx.controls.Alert;
    import mx.collections.XMLListCollection;
    [Bindable]
    public var xml_data:String;
    private var form_data:XML;
    [Bindable]
    private var XML_list:XMLListCollection;
    private function initApp():void
                    FlashIsland.register(this);
    private function setParameters():void
                    try
                                    form_data=new XML(xml_data);
                    catch (error:Error)
                                    Alert.show(error.toString());
                      XML_list = new XMLListCollection(form_data.*);           
    XML string does find its way inside Flex form. I can display content of variable xml_data in TextArea and all looks fine. Conversion to XML (variable form_data) goes well (no error)
    Please helpJ
    Regards
    Michael

  • How to create a xml object dynamically

    Hi all,
    In my current project the database is returning the query result in xml string format(using oracle's DBMS-XML package).
    Now I need to use this xml string and build a xml object and transform it into XSLT and then in a servlet and then pass it to the browser and display it using xsl stylesheets.
    Can some one help me in building an xml object using a string( the xml string is in the xml format i.e in <..> format) and then transform it into xslt in the servlet and send across to the browser.
    Any hands on code or references to the code will be most favourable.
    any help regarding this issue will be most appreciated. Pls do reply as early as possible as I do not have much time to implement this.
    Thanking in advance for your kind help.
    Srinivas.

    What's an "xml object"?
    If you want to transform it using XSLT (transforming it "into" XSLT doesn't make much sense), you can transform direct from the string. Like this:try {
      TransformerFactory xformFactory  = TransformerFactory.newInstance();
      Source xsl = new StreamSource("your.xsl");
      Transformer stylesheet = xformFactory.newTransformer(xsl);
      Source request  = new StreamSource(new StringReader(yourXMLString));
      Result response = new StreamResult(out);
      stylesheet.transform(request, response);
    catch (TransformerException e) {
      System.err.println(e);
    }By the way, if you haven't seen this code before then I suggest you go and read ERH's book about XML with Java:
    http://www.cafeconleche.org/books/xmljava/chapters/index.html

Maybe you are looking for

  • Use of end-date as part of Primary key in SAP Tables

    All, Any ideas on the rationale behind SAPs use of end-date as part of Primary key in general, specifically on condition Tables(A9xx for example) instead of Start-date? appreciate any help!! Best Regards TRP

  • Calling procedures multiple times passing rum time parameters

    hii, i ve this small prob with my procedure..my proc is CREATE or replace PROCEDURE sad(star_val number,dept_id number) IS BEGIN update dept set star=star_val where department_id=dept_id; END; and i call this proc using a loop and give the values at

  • Due to a hacking incident my account has been disabled. How long does it take Apple to reinstate that account?

    My iTunes account as hacked and credits drained through in app purchases. I changed my password and changed my credit card to NONE and was told by Customer Service at Apple that they would disable my account, refund the stolen funds and reactivate me

  • Cycle through list and build compound array...

    I have a database that I'm pulling data from that is already existing. There is a designs table and a details table. The designs table stores the id's of the details items that are associated with the design. Since I'm using Flash remoting I would li

  • Removing Apps From iPhone App Store

    Hello, I have been searching all over but I can't find a post on how to remove apps from the iPhone App Store purchased list. I have been able to do it in the past by swiping the app in the purchase list and selecting hide but it appears this functio