Registreer FAQ Berichten van vandaag


Ga terug   Scholieren.com forum / Technologie / Software & Hardware
Reageren
 
Topictools Zoek in deze topic
Oud 12-08-2004, 12:10
NoSfErAtU
NoSfErAtU is offline
Heeft iemand een idee hoe ik een xmlbestand geparsed krijg in macromedia director.
Heb het al met lingo én javascript geprobeerd maar beide hopeloos.
_____
Lingo : handler definition expected alsk wil me parser initialiseren.

global gParserObject
>> gParserObject = new(xtra "xmlparser")
errCode = gParserObject.parseURL(" XMLURL.. ")
...

_____
Javascript : ';' expected als ik iets op het scherm wil laten verschijnen met put en er staat er één

var objXml = new xtra("xmlparser");
objXml.parseURL("zuidafrika.xml");
var theList = objXml.makeList();
>> put theList.getElementByName("*");
__________________
j'ai été condamné pour autrache, putain procureur m'a allumé
Met citaat reageren
Advertentie
Oud 12-08-2004, 12:20
Manuzhai
Avatar van Manuzhai
Manuzhai is offline
Denk niet dat getElementByName("*") mag, lijkt me dat je daar een geldige elementnaam moet meegeven.
__________________
Slechts beschikbaar via naamzoek/privebericht.
Met citaat reageren
Oud 12-08-2004, 13:01
NoSfErAtU
NoSfErAtU is offline
Citaat:
Manuzhai schreef op 12-08-2004 @ 13:20 :
Denk niet dat getElementByName("*") mag, lijkt me dat je daar een geldige elementnaam moet meegeven.
hij geeft exact dezelfde fout als ik enkel put theList vraag. Hij wil een ';' zien staan net voor put.
Moet ik een of andere parser installeren eerst ofzo? Zit toch standaard in director install zeker. Heb een XMLParser.x20 ofzo staan in me xtras dus denk dat het al geïnstalleerd staat.
__________________
j'ai été condamné pour autrache, putain procureur m'a allumé
Met citaat reageren
Oud 12-08-2004, 17:19
Chilli Dude
Avatar van Chilli Dude
Chilli Dude is offline
hmm die lingo lijkt me te werken...
wat zegt help file erover?
Met citaat reageren
Oud 12-08-2004, 17:22
Chilli Dude
Avatar van Chilli Dude
Chilli Dude is offline
director help file:

------
About XML

XML is similar to HTML in that it uses markup tags to define content. However, HTML has predefined tags that you can use to format any data. Any application that reads HTML must understand the meaning of tags such as TITLE, P, and BODY. HTML tags also describe how information appears on the screen. XML, on the other hand, consists of a set of rules that let you define custom tags and the type of data they can contain, and it has no visual component. With XML, there is no predefined way to display any given type of data such as molecular structures or grocery lists. An XML document is merely a container for the data.The Director developer, by knowing what kind of data the XML document contains, can make intelligent decisions about what the Director movie should do with the information.

One key advantage of XML over a regular text document is that XML is not order-dependent. If an application refers to the third item in a line of data, inserting new data or making subsequent changes to the way the data is produced could cause the application to fail. With XML, you can refer to the individual data components by name. If you insert a new chunk of data before the one in use, the name is still valid. Existing code continues to work, and the newly inserted data is ignored.

There are many sources of information for understanding, creating, and editing XML on the Internet. The following websites offer useful information about XML:

www.xml.com

www.ucc.ie/xml/

www.w3.org/TR/REC-xml

www.w3.org/DOM/
-----



--------------------------------------------------------------------------------


parseURL()

Syntax


parserObject.parseURL(URLstring {,#handlerToCallOnCompletion} {, objectContainingHandler})Description


Function; parses an XML document that resides at an external Internet location. The first parameter is the parser object containing an instance of the XML Parser Xtra, and the second is the actual URL at which the XML data resides.

This function returns immediately, so the entire URL may not yet be parsed. It is important to use the doneParsing() function in conjunction with parseURL() to determine when the parsing operation is complete.

Since this operation is asynchronous, meaning it may take some time, you can use optional parameters to call a specific handler when the operation completes. The optional third parameter is the name of a handler that is to be executed once the URL is fully parsed; the optional fourth parameter is the name of the script object containing that handler. If the fourth parameter is not passed in, the handler name in parameter three is assumed to be a movie handler.

The return value is void if the operation succeeds, or an error code number string if it fails.

To parse XML locally, use parseString().

Examples


This statement parses the file sample.xml at MyCompany.com. Use doneParsing() to determine when the parsing operation has completed.

errorCode = gParserObject.parseURL("http://www.MyCompany.com/sample.xml")This Lingo parses the file sample.xml and calls the on parseDone handler. Because no script object is given with the doneParsing() function, the on parseDone handler is assumed to be in a movie script.

errorCode = gParserObject.parseURL("http://www.MyCompany.com/sample.xml", #parseDone)The movie script contains the on parseDone handler:

on parseDone
global gParserObject
if voidP(gParserObject.getError()) then
put "Successful parse"
else
put "Parse error:"
put " " & gParserObject.getError()
end if
endThis Lingo parses the document sample.xml at MyCompany.com and calls the on parseDone handler in the script object testObject, which is a child of the parent script TestScript:

parserObject = new(xtra "XMLParser")
testObject = new(script "TestScript", parserObject)
errorCode = gParserObject.parseURL("http://www.MyCompany.com/sample.xml", #parseDone, testObject)Here is the parent script TestScript:

property myParserObject

on new me, parserObject
myParserObject = parserObject
end

on parseDone me
if voidP(myParserObject.getError()) then
put "Successfull parse"
else
put "Parse error:"
put " " & myParserObject.getError()
end if
endSee also


getError() (XML), parseString()


--------------------------------------------------------------------------------



--------------------------------------------------------------------------------


makeList()

Syntax


parserObject.makeList()Description


Function; returns a property list based on the XML document parsed using parseString() or parseURL().

Example


This handler parses of an XML document and returns the resulting list:

on ConvertToList xmlString
parserObject = new(xtra "xmlparser")
errorCode = parserObj.parseString(xmlString)
errorString = parserObj.getError()
if voidP(errorString) then
parsedList = parserObj.makeList()
else
alert "Sorry, there was an error" && errorString
exit
end if
return parsedList
endSee also


makeSubList()


--------------------------------------------------------------------------------

heb t niet allemaal gelezen, misschien had je de help file al bekeken hmmaargoed...ik werk niet met xml
Met citaat reageren
Advertentie
Reageren


Regels voor berichten
Je mag geen nieuwe topics starten
Je mag niet reageren op berichten
Je mag geen bijlagen versturen
Je mag niet je berichten bewerken

BB code is Aan
Smileys zijn Aan
[IMG]-code is Aan
HTML-code is Uit

Spring naar


Alle tijden zijn GMT +1. Het is nu 13:02.