Create an XML with AS3 object
I want to create an XML object based in AS3, but don't know how to do this.I first tried to create a string that represents my XML elements and their values, but then I don't know how to convert this string into an XML object.
Secondly, in my view, there are other ways to create XML objects in AS without doing anything with strings.
Can someone please recommend a way to do this?
An example XML to create with AS3 is:
I got the solution to my problem. For anyone interested, see me the code below (the names of xml elements are different, but the concept is the same).
Tags: Adobe Animate
Similar Questions
-
Cannot create User.xml with weblogicExportMetadata.sh in IOM 11 GR 2
I want to export the user.xml file using the shell of $OIM_ORACLE_HOME/server/bin/weblogicImportMetadata.sh file.
I put all the necessary attributes for the file weblogic.properties:
When executing the shell I get UNIX path below:
but the file is not created is in the specified location, no help please...
WebLogic Scripting Tool (WLST) initializing...
Welcome to WebLogic Server Administration scripts Shell
Help() type help on the available commands
From script to export metadata...
Please enter your username: *.
Please enter your password:
+ Please enter the URL of your server [t3: / / localhost:7001]: t3: / / localhost:7001.
T3 connection: / / localhost:7001 with username weblogic...
Connected to the Server Admin "AdminServer" which belongs to the domain "oimdomain".
WARNING: A non-secure protocol was used to connect to the
Server. To ensure the safety of on-the-wire, the SSL port or
Admin port should be used instead.
Now to the tree of domainRuntime. It is a tree read-only with DomainMBean as the root.
For further assistance, use the help (domainRuntime)
Disconnected from the weblogic server: AdminServer
End of metadata export script...
Leaving WebLogic Scripting Tool.
Published by: 955130 on August 29, 2012 04:58What is the location specified in the properties file? Try using /file/User.xml
-
How to update day/change the value stored in a file XML with AS3
I have the following xml file...
<Customers>
<Email address="[email protected]">
<FName>joe</FName>
<Surname>bloggs</Surname>
<DayBirth>02</DayBirth>
<MonthBirth>01</MonthBirth>
<YearBirth>1981</YearBirth>
<House>2</House>
<Address1>Johns Street</Address1>
<Address2>Trekville</Address2>
<City>Timbuktoo</City>
<PostCode>CF67TH</PostCode>
<Gender>Male</Gender>
</Email><Email address="[email protected]">
<FName>fred</FName>
<Surname>bloggs</Surname>
<DayBirth>03</DayBirth>
<MonthBirth>02</MonthBirth>
<YearBirth>1982</YearBirth>
<House>22</House>
<Address1>Johns Street</Address1>
<Address2>Fredville</Address2>
<City>Cardiff</City>
<PostCode>CF71TH</PostCode>
<Gender>Male</Gender>
</Email>
</Customers>I loaded the XMLfile in my flash site and I am able to filter by the email address and display the corresponding data. Code below...
var custXML:XMLList;
var xmlCustLoader:URLLoader = new URLLoader();
xmlCustLoader.load (new URLRequest ("Customers.xml"));
xmlCustLoader.addEventListener (Event.COMPLETE, custXMLLoaded);
function custXMLLoaded(e:Event):void {}
xmlCustLoader.removeEventListener (Event.COMPLETE, custXMLLoaded);
load xml in object custXML data
custXML = new XMLList (e.target.data);
run the analysis function
ParseCustomer (custXML);
}
function ParseCustomer(customerInput:XMLList):void {}
trace ("Output XML");
trace("------------------------");
var custAtts:XMLList = customerInput.Email. (@address is entEmail;)
for each {(var custEmail:XML in custAtts)
trace (custEmail);
}
set variables for the filtered result
entFName = customerInput.Email. (@address is entEmail). FName;
entSurname = customerInput.Email. (@address is entEmail). Family name;
entDay = customerInput.Email. (@address is entEmail). DayBirth;
entMonth = customerInput.Email. (@address is entEmail). MonthBirth;
entYear = customerInput.Email. (@address is entEmail). YearBirth;
entHouse = customerInput.Email. (@address is entEmail). House;
entAdd1 = customerInput.Email. (@address is entEmail). Address1;
entAdd2 = customerInput.Email. (@address is entEmail). Address2;
entCity = customerInput.Email. (@address is entEmail). City;
entPCode = customerInput.Email. (@address is entEmail). Postal code;
entGender = customerInput.Email. (@address is entEmail). Gender;
}
Now, I want to edit a record in this file (for example, change the < FName > Fred to say Paul and save the changes to the Customers.xml.) How can I do this?
It's because you're not assign the name of the film, time, etc. and I only showed how to solve the problem you asked originally.
now, ask yourself a different (but related) question. Here is the solution:
seat of the var: int;
var chosenSeat:String;
b.addEventListener (MouseEvent.CLICK, seat1Click);
function seat1Click(event:MouseEvent):void {}
seat = 1;
set the chosenSeat to the name of the XML tag Seat1 - this will be used to record
chosenSeat = "Seat1;
instead of hard-coding these channels, they should be attributed using comboboxes or something else.
UpdateBooking (bookXML, chosenSeat, seat, "St Davids", "300: Empire builders", "Tuesday", "18:00");
}
function UpdateBooking(xml:XML,chosenSeat:String,seat:int,room_name:String,movie_title:String,day__name:String,showing_time:String):void {}
XML. room. (@name is room_name). Film. (@title is movie_title). Day. (@name is day_name). Display. (@t ime is showing_time) [chosenSeat] = seat;
}
-
It is possible to write a directilly in a file xml with as3?
Hello
any an anser my question does
Thank you
Unable to write directly in a Flash using AS3 swf file. A script on the server side is required to manage the file written the end of things.
-
Unable to read part of the XML with AS3
Hello
I can read all my xml file except a part that I can always get the first items in each category (it will make more sence in a sec)
So here is my xml
[HTML] <? XML version = "1.0" encoding = "UTF-8"? >
< flashxml >
< second_page >
< text sp = "ss ptextj" / >
< text ss = "sptext" / >
< text clas = "clas" / >
< / second_page >
< third_page >
< ss >
< name of category 'Category' = >
< element > 3333 < / item >
< element > H4444 < / item >
etc. etc. etc. < item > < / item >
< / category >
< category name = "security" > ""
< element > SSL < / item >
< element > hacked < / item >
etc. etc. etc. < item > < / item >
< / category >
< securescoping >
< sp >
< category name = "security one" >
aniss < element > SSL < / item >
Hacker < item > < / item >
etc. etc. etc. < item > < / item >
< / category >
< category name = "onlin" >
< point > Hussle free < / item >
< element > Diafore < / item >
< element > etc etc 2 < / item >
< / category >
< SP >
< advertisements >
< category name = 'Best' >
< element > Additem1 < / item >
< element > Additem2 < / item >
< element > Additem3 < / item >
< / category >
< / Classifieds >
< / third_page >
< / flashxml > / [html]I try for each category in the XML to retrieve relevant items...
The problem is that if I try to read, for example, the second series of pieces for the second category of < sp > using a counter, he raises a type error
TypeError: Error #1010: a term is undefined and has no properties.
to MethodInfo - 1)
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()so the following work
var itemslist:XMLList = xml.third_page.ss.category [0] .item; (it will always show the first elements of the first category for all categoriesThus, for example for MS will always return even to the second category
aniss < element > SSL < / item >
Hacker < item > < / item >
etc. etc. etc. < item > < / item >but when I am using
var itemslist:XMLList = xml.third_page.ss.category [i] .item;
I get the error above TypeError: Error #1010... (no idea why)
Any help will be much appreciated
full code:
pp.buttonMode = true;pp.addEventListener (MouseEvent.ROLL_OVER, onButtonOver);
pp.addEventListener (MouseEvent.CLICK, onButtonOut);function onButtonOver(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay ("a");
var xmlString:URLRequest = new URLRequest ("ev.xml");
var xmlLoader:URLLoader = new URLLoader (xmlString);
xmlLoader.addEventListener ("complete", init);
function init(event:Event):void {}
var xDoc:XMLDocument = new XMLDocument();
xDoc.ignoreWhite = true;
var animalsXML:XML = XML (xmlLoader.data);
var list: XML = XML (xml Loader.data);
trace (animalsXML); prints the xml file
edooooooooooooooooooooooooooooooooooo
var xml = XML (xmlLoader.data);
trace ("XML file");
trace ("===================");
trace (xml.second_page.sp.attribute ("text"));
trace (xml.second_page.ss.attribute ("text"));
trace (xml.second_page.clas.attribute ("text"));
edoooooooooooooooooooooooooooooooooooooooooooooooooooo
Third ss page
var i = 0;
var categorylist:XMLList = xml.third_page.ss.category;
for each (var captionElement:XML in categorylist)
{
i ++ ;
trace (captionElement.attribute ("name"));
trace (captionElement.item);
var itemslist:XMLList = xml.third_page.ss.category [0] .item;
for each (var captionElement:XML in the list)
{
trace (captionElement);
trace (valueOf (captionElement.item));
}
}
Third page sp
var i = 0;
var categorylist:XMLList = xml.third_page.sp.category;
for each (var captionElement:XML in categorylist)
{
i ++ ;
trace (captionElement.attribute ("name"));
trace (captionElement.item);
var itemslist:XMLList = xml.third_page.sp.category [0] .item;
for each (var captionElement:XML in the list)
{
trace (captionElement);
trace (valueOf (captionElement.item));
}
}
Third page clas
var i = 0;
var categorylist:XMLList = xml.third_page.classifieds.category;
for each (var captionElement:XML in categorylist)
{
i ++ ;
trace (i);
trace (captionElement.attribute ("name"));
trace (captionElement.item);
trace (valueOf (captionElement.item));
var hi = captionElement.attribute("name");
var itemslist:XMLList = xml.third_page.classifieds.category [0] .item;
for each (var captionElement:XML in the list)
{
trace (captionElement);
trace (valueOf (captionElement.item));
}
}
for each (var in {animalsXML.elements () itemData:XML)}
trace (ItemData.Elements (). Attribute ("Text")); DOULEUI
page 3
.@Patty itemData.thirdpage.elements () [0]
}
xDoc.parseXML (animalsXML.toXMLString ());
trace(xDoc.firstChild.childNodes[0]); Riverside
trace(xDoc.firstChild.childNodes[0].nodeValue);
trace (xDoc.valueOf (.)) GetElementsByTagName("Item") [0] Sublst.ChildNodes(1).ChildNodes(0) [0] .nodeValue);
}
}
function onButtonOut(e:MouseEvent):void
{
e.currentTarget.gotoAndPlay ("b");
pb.gotoAndPlay ("a");
}use
var itemslist:XMLList = captionElement.item;
Instead of
var itemslist:XMLList = xml.third_page.sp.category [0] .item;
It should work. You already had the category in your captionElement variable node, why not just use it instead of looking again in the document tree?
-
Problem in creating several attributes XML with the same name of the attribute
I am trying without success trying to create several attributes XML with the same name, as shown here in a Microsoft example configuration file:
I'm calling the NewDocument GetRootElement functions and then "newelement" (appSetting), "newelement" (add)
Then I call AddAttribute with add, key & Key0, then with add, value & 0. This seems to work fine but when I try to add the second pair of key & Key1 and value attributes & 1 for item "Add" replaces "
"and I find myself with" " only. I do something wrong or CVI is not able to create an XML of this type?
Thank you
Here's how you do it. I show not to keep things simple error checking.
#include
public static void CreateAddElement (mother of CVIXMLElement, const char * key, const char * value)
{
Add the CVIXMLElement;
CVIXMLNewElement (parent, -1, 'Add', &add);)
CVIXMLAddAttribute (add, "touch", key);
CVIXMLAddAttribute (add, "value", value);
CVIXMLDiscardElement (add);
}void main (void)
{
CVIXMLElement root, and appSetting;
Doc CVIXMLDocument.
CVIXMLNewDocument ("configuration", &doc);)
CVIXMLGetRootElement(doc, &root);)
CVIXMLNewElement (root,-1, "appSetting", and appSetting);
CreateAddElement (appSetting, "Key0", "0");
CreateAddElement (appSetting, "Key1", "1");
CreateAddElement (appSetting, "Key2", "2");
CVIXMLDiscardElement (appSetting);
CVIXMLDiscardElement (root);
CVIXMLSaveDocument (doc, 1, "c:\\temp\\temp.xml");
CVIXMLDiscardDocument (doc);
} -
create a form with Adobe Acrobat Standard XI: problem - interactive objects
try to create a form with Adobe Acrobat Standard XI: problem - interactive objects-> activate: hide the form text field-> work-> first it s didn t hide but if you continue to fulfill other things it shows the field hide; What wrong? answer also in German as possible Thx Sascha
In the boxes use the "Mouse Up" with the action "run a JavaScript.
Example for the "Ergebnisvergleich", you can use JavaScript the suite:
field var = this.getField ("Verdeckung Ergebnisvergleich");
If (event.target.isBoxChecked (0)) {}
Field.Display = display.hidden;
} else {}
Field.Display = display.visible;
}
-
dbms_xmlgen->; create oracle XML attribute with value type
I use the dbms_xmlgen to create my xml message and I use the oracle TYPEs to create xml message elements.
I need to create something like this:
< type Emp 'name' = > xyz < / Emp >
I tried to create the type as below
create type emp_t as an object ("type" "@type")...
But do not know how I need to set the value of this attribute.
Help, please. Thanks in advance for your help.Can be
SQL> select * from v$version where rownum=1; BANNER ---------------------------------------------------------------- Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod SQL> SQL> select dbms_xmlgen.getxml('select ename, ''name'' as "@type" from emp') from dual; DBMS_XMLGEN.GETXML('SELECTENAM --------------------------------------------------------------------------------
SMITH ALLEN WARD SQL>
-
Parental and child control with AS3
Hello
I am new to AS3 and although I can see some good practices and functionality, I'm constantly stuck and can still do the things I would do if easily with AS2 - I almost it relearn from scratch!. I would still appreciate little help and advice on this...
I did a class that creates a "sort" menu with data from an XML file, and basically is what he does when he is called to create an emptyMC (a container), add a childMC (a square) and add another child (a text label). When I create the container, I am trying to add a MouseEvent that can act on each instance of container, but all I can get is a MouseEvent on the object that contains all the MCs added. The code follows.
Can someone enlight me with that issue or explain what I am doing wrong.
I do not understand the parental dynamics with AS3 and the absence of the use of instance names and parenting dot does not help.
Thanks in advance.
Note to Adobe: previous versions of Flash and as a reference Help files were far more useful than in CS4!
In the timeline:
Import assets.myDynMenu;
var theMenu:myDynMenu = new myDynMenu ("menu.xml");
stage.addChild (theMenu)Stop();
In the class:
package assets
{
import flash.display. *;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
flash.net import. *;public class myDynMenu extends Sprite {}
LOADING EXTERNAL INIT DATA
public void myDynMenu (theData) {}
LOADS MENU DATA FROM PREFORMATTED XML
var loader: URLLoader = new URLLoader();
var url: URLRequest = new URLRequest (theData);
loader.addEventListener (Event.COMPLETE, buildTheMenu);
Loader.Load (URL);
}FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN
public void buildTheMenu(event:Event):void {}
var xml = new XML (event.target.data);
for (var i = 0; I < xml.menuData.menuItem.length (); i ++) {}
ADDS A CONTAINER
var itemContainer:MovieClip = new MovieClip();
itemContainer.name = "menu" + i;
//THE NEXT LINE IS NOT DO WHAT I WANTED?
IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDRENitemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);
//
itemContainer.x = 100 * i;
itemContainer.y = 0;
itemContainer.mouseEnabled = true;
itemContainer.mouseChildren = false;
addChild (itemContainer);ADDS A CHILD OF CONTAINER (a square)
var itemBase:MovieClip = new MovieClip();
itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mConfig.mainIt emH);
itemBase.graphics.endFill ();
itemBase.name = "basic" + i;
itemBase.mouseEnabled = false;
itemBase.mouseChildren = false;
itemContainer.addChild (itemBase);ADDS a CHILD OTHER to CONTAINER (a text label)
var theLabel:TextField = new TextField();
theLabel.x = 5;
theLabel.y = 5;
theLabel.selectable = false;
theLabel.mouseEnabled = false;
theLabel.border = true;
theLabel.text = xml.menuData.menuItem [i] .mName;
itemContainer.addChild (theLabel);}
}It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
private void onMouseOver(event:MouseEvent):void {}event.stopPropagation ();
trace ("you're on" + myIdName);
}
}}
use:
package assets
{
import flash.display. *;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
flash.net import. *;public class myDynMenu extends Sprite {}
LOADING EXTERNAL INIT DATA
public void myDynMenu (theData) {}
LOADS MENU DATA FROM PREFORMATTED XML
var loader: URLLoader = new URLLoader();
var url: URLRequest = new URLRequest (theData);
loader.addEventListener (Event.COMPLETE, buildTheMenu);
Loader.Load (URL);
}FULL CHECK LOAD XML MENU DATA - OBJECT BUILDING AND CHILDREN
public void buildTheMenu(event:Event):void {}
var xml = new XML (event.target.data);
for (var i = 0; i)
ADDS A CONTAINER
var itemContainer:MovieClip = new MovieClip();
itemContainer.name = "menu" + i;
//THE NEXT LINE IS NOT DO WHAT I WANTED?
IN THE FUNCTION BEING CALLED, I NEED TO CONTROL THIS ELEMENT AND ITS CHILDRENitemContainer.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);
//
itemContainer.x = 100 * i;
itemContainer.y = 0;
itemContainer.mouseEnabled = true;
itemContainer.mouseChildren = false;
addChild (itemContainer);ADDS A CHILD OF CONTAINER (a square)
var itemBase:MovieClip = new MovieClip();
itemBase.graphics.beginFill (xml.menuData.mConfig.mainItemColor);
itemBase.graphics.drawRect (0,0,xml.menuData.mConfig.mainItemW,xml.menuData.mCon fig.mainItemH);
itemBase.graphics.endFill ();
itemBase.name = "basic" + i;
itemBase.mouseEnabled = false;
itemBase.mouseChildren = false;
itemContainer.addChild (itemBase);ADDS a CHILD OTHER to CONTAINER (a text label)
var theLabel:TextField = new TextField();
theLabel.x = 5;
theLabel.y = 5;
theLabel.selectable = false;
theLabel.mouseEnabled = false;
theLabel.border = true;
theLabel.text = xml.menuData.menuItem [i] .mName;
itemContainer.addChild (theLabel);}
}It IS THE MOUSE ON WHICH I NEED law to EACH itemContainer (AND CHILDREN)
private void onMouseOver(event:MouseEvent):void {}event.stopPropagation ();
trace ("you're on" + event.currentTarget.name);
}}
}
-
How to convert XMl to JSON object in jsx?
Is anyone know how can I convert an xml file to the json object. any help or any jsx library that can help please let me know if possible?
Thank you
Upendra
I was able to create this script with your help, which is a generic XML to JSON converter xml obj passes just in the service.
Thanks for your suggestion Silly-Vfunction xmlToJson(xml) { // Create the return object var obj = {}; if (xml.nodeKind() == "element") { if (xml.attributes().length() > 0) { for (var j = 0; j < xml.attributes().length(); j++) { var attributeName = xml.attributes()[j].name(); obj[attributeName] = String(xml.attributes()[j]); } } } else if (xml.nodeKind() == "text") { obj['text'] = xml.text(); } if (xml.children()) { for (var i = 0; i < xml.children().length(); i++) { var item = xml.child(i); if (xml.children()[i].nodeKind() == "text") { obj['text'] = xml.children()[i].toString(); } else { var nodeName = item.name(); if (typeof(obj[nodeName]) == "undefined") { obj[nodeName] = xmlToJson(item); } else { if (typeof(obj[nodeName].push) == "undefined") { var old = obj[nodeName]; obj[nodeName] = []; obj[nodeName].push(old); } obj[nodeName].push(xmlToJson(item)); } } } } return obj; };
Thank you
Upendra Stifler
-
create a mask using AS3 only?
Hello
I did a search for how to create a simple mask to aid only AS3, but I'm not having any luck. Would you be willing to give me a small example of how to make a mask with AS3?
Thank you if you can!
You can dynamically create a shape, draw on it using the graphics object and use it as a mask:
var masker: Shape = new Shape();
masker.graphics.beginFill (0);
masker.graphics.drawRect (0,0,100,100);
masker.graphics.endFill ();
addChild (masker);
mySprite.mask = masker;
or you can use the scrollRect property, using a rectangle
mySprite.scrollRect = new Rectangle (0,0,100,100);
-
XML with multi-sequence UTF8 byte characters
Anyone know how to recover a document XML with the UTF8 sequence several bytes of the characters to a database ORADB11g (ORADB10g works very well)? If I use the method below UTF8 sequence several bytes of characters are treated as characters separated instead of a single character. I use binary XML and the following pots (of an ORADB11g installation):
-ojdbc6.jar (11.1.0.7.0 - Production)
-orai18n.jar (11.1.0.7.0 - Production)
-xdb.jar (xdk_version_11.1.0.6.0_production)
-xmlmesg.jar (xdk_version_11.1.0.6.0_production)
-xmlparserv2.jar (. xdk_version_11.1.0.6.0_production)
I tried several options still OPAQUE and so on, but I'm now off clues...
Thank you
Chris
public static Document loadDocument (connection dbConnection, String, collection, String documentId) throws Exception {}
If (collection == null | documentId == null) {}
throw new IllegalArgumentException ("collection or documentId is null");
}
Statement statement = null;
ResultSet resultSet = null;
try {}
Create a Statement object for sending SQL statements to the database
Statement = dbConnection.createStatement ();
Executes the given query which should return a ResultSet object
resultSet = statement.executeQuery ("SELECT OBJECT_VALUE FROM" + collection
+ "WHERE the existsNode (OBJECT_VALUE,'/ * [@docid = \" "+ documentId +" \ "]') = 1"); "
Browse the game to find the result of results
While (resultSet.next ()) {}
Object object = resultSet.getObject (1);
If (item! = null) {}
Return the first one found
Return (object) .getDocument () (XMLType);
}
}
} {Finally
If (resultSet! = null) {}
resultSet.close ();
}
If (declaration! = null) {}
Statement.Close ();
}
}
Returns a null value.
}
Published by: user10218259 on August 24, 2009 01:46Have you tried to ask the question on the XDK forum...?
http://forums.Oracle.com/Forums/Forum.jspa?forumid=154
-
The attached VI works when I run it initially to create the XML file, but when I change the data and run once the XML file is created, it is not updated with new data. What I am doing wrong?
Thank you.
It sounds like the logic that has been written in VI
Internal decision of true / false:
(file exists: false) write in the file XML, unflatten for display
(file exists: true) read the XML file, unflatten for display
At no time when the file exists (true case) is the XML file updated...
-
FlexUnit with AS3 AIR does not work?
Recently, I tried to take a shot at TDD (Test Driven Development), as I'm sure many of you know. To do this I tried to use FlexUnit 4 of in Flash Builder 4.
If I create a project as follows:
- New--> Flex project
- Next, Next
- (The main Application file) Replace .mxml, .as
- Finishing
Then when I try to use FlexUnit in the ordinary way, it fails to generates an adequate FlexUnitApplication.mxml. The content of this file is:
package_declaration { class_declaration { class_body } }
Therefore, there is a compile error that I can not move:
Content is not allowed in prolog.
However:
If I followed the same process as above, without changing the .mxml to .as tests run correctly.
Things, I tried to work around the error:
- FlexUnit to 4.1 update
- Pressing refresh in the FlexUnitsResults window
- Creating a project with .mxml and thereafter remove this mxml and its replacement with an actionscript class
- Bump on my desk.
None of them have worked.
Did anyone here successfully FlexUnit FlashBuilder 4 for an AS3 AIR project all? If not, can anyone suggest another Test package?
Thank you
~ Nick.
I found a solution at least provisional. I restarted FlashBuilder and despite the error marked under issues here and it worked.
I think that restart Flashbuilder maybe erases a previously stored properly compiled build. (Maybe Clean could also do this?). in any case, at the time of compilation, the mxml file was generated correctly and all is well.
-
Hello
I am now able to post data to a web server by using Blackberry JDE (medical use).
Now, instead of display the plain text, I would like to send an XML file.
I am able to do it using this code on a 'normal ': Java application
import java. IO;
Org.w3c.dom import. *;
Import javax.xml.parsers. *;
Javax.xml.transform import. *;
Javax.xml.transform.dom import. *;
Javax.xml.transform.stream import. *;public class {XML
Public Shared Sub main (String [] args) {}
try {}
DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
DocumentBuilder builder = factory.newDocumentBuilder ();
Doc document = builder.newDocument ();
Root element = doc.createElement ("root");
doc.appendChild (root);
Child element = doc.createElement ("child");
child.setAttribute ("name", "value");
root.appendChild (child);Add a text element to the child
Text = doc.createTextNode ("text");
child.appendChild (text);implement a transformer
TRANSFAC TransformerFactory = TransformerFactory.newInstance ();
Transformer trans = transfac.newTransformer ();
trans.setOutputProperty (OutputKeys.OMIT_XML_DECLARATION, 'yes');
trans.setOutputProperty (OutputKeys.INDENT, 'yes');create the string of the xml tree
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult (sw);
DOMSource source = new DOMSource (doc);
TRANS. Transform (source, result);
String xmlString = sw.toString ();
System.out.println (xmlString);
} catch (Exception e) {}
make error management
}
}
}However, on the Blackberry JDE, many functions is not recognized.
I saw the class DocumentBuilderFactory (net.rim.device.api.xml.parsers.DocumentBuilderFactory), the DocumentBuilder (net.rim.device.api.xml.parsers.DocumentBuilder) class and the interface of Document in the docs of Blackberry Java (4.2.1).
So, I'm able to create an XML Document... but I don't know how to convert to a string?
How can I do this? The TransformerFactory class doesn't seem to exist... and I did not find an alternative yet.
At the present time, here is the code I use to publish data:
String coord = lat + ";" + LNG; post data
con = (HttpConnection) Connector.open (url); Open the connection URL
con.setRequestMethod (HttpConnection.POST); POST method
con.setRequestProperty ("Content-Type", "application/x-www-formulaires-urlencoded");
out = con.openOutputStream (); display the results in a stream
out. Write (Coord.GetBytes ());responseCode = con.getResponseCode (); Send data and receive the response code
If (responseCode! = HttpConnection.HTTP_OK) {}
System.out.println ("HTTP STATUS CODE: 404"); error
} else {}
System.out.println ("HTTP STATUS CODE: 200"); successful
}
If (con! = null) con. Close; close the connection to the URLAs mentioned, rather than display a string with a delimiter between each value (there will be a lot more than two values finally), I would like to publish an XML. It will be more "elegant" and easier to parse by my code on the web server.
Maybe I don't have to convert it to a string?
In other words, how can I convert my XML Document to send it via the wireless network?
Thanks for your help!
TransformerFactory does not exist in the BlackBerry API. As far as I can tell, you need to implement yourself. You can do this by walking the DOM and the output of channels. They have an example of the market of the DOM in the XMLDemo, but they view as fields, you just need to write strings.
Maybe you are looking for
-
Can you connect mini displayport monitors with 2 crush
Recently, I started thinking of owning a good monitor k 4 for my MBP and I were just interested, if you have cable thunderbolt 2, are you able to use it to the monitors that accept mini Displayport? The port looks like it will work and will work. Tha
-
When Dragonborn will be released on PS3 in any EU?
I'm Croatian and I can't find it on PS Store. So I was wondering, it's never going to be released and if so, when?
-
dial the SPA3102 how an RTC to my cell?
Hi all I found another thread on this topic but the link was broken to a former page sepura. In any case, as the title says I need to transfer my PSTN calls to my cell phone after a few rings im guessing im using the PSTN-to-VoIP gateway Setup? is an
-
How can I transfer files from the laptop with a broken screen of a new netbook under windows Vista 7
I tried to use an old cable and even if the netbook can see old computer I can't access my files on your old computer, it is said that it wants a username and password, I put these in but they are not accepted, im stuck and don't know what to do. som
-
How to print double-sided on my HP 3520
No there's nothing wrong I. Just need to know how to print double-sided on my printer HP Deskjet 3520 All In One