Parsing XML Namespace in as2
HI, I am attempting to parse some weather information from the Yahoo weather RSS feed.
This is a typical XML node;
<description>Yahoo! Weather for Palm Springs, CA</description>
I used the typical XML parsing code in as2;
var text1 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
txt1.text = text1;
I was doing pretty good until I reached a node that was formatted thus;
<yweather:forecast day="Mon" date="28 Sep 2009" low="74" high="103" text="Sunny" code="32" />
This text traced a value of undefined.
I have tried to research this and so far all I have been able to find out, is that this is a XML namespace and is very easily handled in as3. Unfortunately I have to use as2.
How do I parse out this information into a dyamic text fields?
Or failing that, where in the literature does adobe expalin how this is done?
Forrest
Hi,
Try this code:
var xmlname:XML = new XML();
xmlname.ignoreWhite = true;
xmlname.load("sample.xml");
xmlname.onLoad = function(sucess:Boolean){
var xNode = xmlname.firstChild;
var tday = xNode.childNodes[0].attributes.day;
var tdate = xNode.childNodes[0].attributes.date;
trace(tdate);
Similar Messages
-
Hi ,
Good Morning to all
in osb replace action am using xquery transformation resource.
source code of xquery is :
====================================================================================
(:: pragma bea:global-element-parameter parameter="$addition1" element="ns0:Addition" location="../wsdl/NewWSDLFile.wsdl" ::)
(:: pragma bea:global-element-return element="ns1:process" location="../bpelprocess1_client_ep.wsdl" ::)
declare namespace ns1 = "http://xmlns.oracle.com/POProcessing/AdditionOSB/BPELProcess1";
declare namespace ns0 = "http://www.example.org/NewWSDLFile/";
declare namespace xf = "http://tempuri.org/ServiceCallout/trans/route/";
declare function xf:route($addition1 as element(ns0:Addition))
as element(ns1:process) {
<ns1:process>
<ns1:value1>{ data($addition1/value1) }</ns1:value1>
<ns1:value2>{ data($addition1/value2) }</ns1:value2>
</ns1:process>
declare variable $addition1 as element(ns0:Addition) external;
xf:route($addition1)
=====================================================
at the time of running "error is Error parsing XML: {err}FORG0005: expected exactly one item, got 0 items " in replace action.
how to resolve this problem...
Thanks & Regards
venkyThe reason for the error is the xquery is not able to find the values in the input... Check the input and namespaces...
Try...
<ns1:value1>{ data($addition1/ns0:value1) }</ns1:value1>
<ns1:value2>{ data($addition1/ns0:value2) }</ns1:value2>Cheers,
Vlad -
Problem parsing xml in J2ME (using kxml2)
Hello.
May someone who knows how to use kxml help me please?
I'll try to be straight forward. (Please excuse my imperfect English)
My xml file look something like this:
<?xml version="1.0" encoding="utf-8"?>
<sample_tag1 xmlns:mysample="http://www.sample001.com/sample01schema">
<feature name=tag1_feature>
<test name=xxxxx id=200 message=Hello.></test>
</feature>
<catalog name="shelf">
<booklist name="book1" label="b1"></booklist>
<booklist name="book2" label="b2"></booklist>
<booklist name="book3" label="b3"></booklist>
</catalog>
</sample_tag1>
And here's my code
//http request
try{
//I can guarantee that the URL is valid
httpConnection = (HttpConnection) Connector.open(URL);
}catch(IOException ioe){
ioe.printStackTrace();
//Create the parser
KXmlParser parser = new KXmlParser();
try{
//I use this code section to test if the xml file is properly placed in the inputStream.
char[] tempChar = new char[500];
isr = new InputStreamReader(httpConnection.openInputStream());
isr.read(tempChar);
for(int i=0; i<tempChar.length;i++){
System.out.print(tempChar);
//set the xml input
parser.setInput(isr);
//skip the "<?xml version="1.0" encoding="utf-8"?>" tag
parser.nextTag();
parser.require(XmlPullParser.START_TAG, null, "sample_tag1");
System.out.println("name : " + parser.getName());
System.out.println("namespace : " + parser.getNamespace());
parser.nextTag(); // ***1
I compiled the app and run, here's the result:
name : sample_tag1
namespace :
org.xmlpull.v1.XmlPullParserException: attr value delimiter missing! (position:START_TAG <feature name='http://www.sample001.com/sample01schema'>@3:15 in java.io.InputStreamReader@e938beb1)
at org.kxml2.io.KXmlParser.exception(+47)
at org.kxml2.io.KXmlParser.error(+45)
at org.kxml2.io.KXmlParser.parseStartTag(+285)
at org.kxml2.io.KXmlParser.nextImpl(+314)
at org.kxml2.io.KXmlParser.next(+23)
at org.kxml2.io.KXmlParser.nextTag(+24)
at MyMidlet$ReadXML.run(MyMidlet.java:235)
But when I comment the last line (parser.nextTag(); // ***1), here's the result:
name : sample_tag1
namespace :
My code is the clone of the one in this tutorial:
http://www.developer.com/ws/article.php/3759471
where he get the weather forecast from Yahoo Weather RSS
What did I do wrong? I tried looking up google for "attr value delimiter missing!" but found no useful information.
Thank you in advance. =)Please read this topic. I posted an answer about parsing xml using kxml2
http://forums.sun.com/thread.jspa?threadID=5291592&start=0&tstart=0
Regards,
David -
Default xml namespace = v hangs app
This is probably due to my relative inexperience with Flex (using FlashBuilder 4.5 and Flex SDK 3.6) but I've got an app that is acting strangely and I'd like to find out what's wrong.
Briefly, I'm trying to parse some XML (returned from a REST service) and, within a private function, am creating a namespace (call it v). I then use the directive default xml namespace = v. However, upon trying to launch and debug the app it hangs at application startup. The default directive is in a private function (actually a function called only when my HTTP service completes) of a component. Regardless, if I comment out the default directive the application works normally.
Again, this function isn't even CALLED unless I essentially click a button to access the service, so I have absolutely no idea why it appears to be affecting the loading of my app.
I have used Google to search for "Flex default xml namespace hangs app" but have found only one reference (in passing, with no solution offered).
Thanks for any pointers.I will try at some point but I can't cut down my current app to do it, it's just too large.
However, I did debug the app and I saw what the problem is. My view component, located in (for example) com.xyz.myapp.view, loads several other components, all located in com.xyz.myapp.components. As a result, the Panel component in the View contains (among other directives) xmlns:components="com.xyz.myapp.components.*". Both the namespace variable v and the default xml namespace directive are in a private function in one of the components the main view loads. When I ran the app under the debugger it terminated almost immediately with "Error 1065: variable com.xyz.mypp.components::v is not defined".
That's all I can tell you for now.
Thanks for the reply. -
OSB download 250 MG file results in error Error parsing XML: {err}FORG0005
Hi,
Using OSB 11.1.1.5. I have service to download files from Oracle ECM. Running into an issue where the file size is over 250 MB service is failing. Giving me an error
OSB Replace action failed updating variable "body": Error parsing XML: {err}FORG0005: expected exactly one item, got 0 items
I have service callout to get the binary content of the file and it's taking over 5 minutes and then this error. I also set Read Timeout and Connection Timeout to 20 seconds at the business service level
but looks like it's not taking that timeout values and still waiting over 5 minutes before it dies. My JTA Timeout is set to 12 minutes. After service callout I have a log to write the output but it's not even getting there and throwing that error above
How can I trap that kind of errors. How can I set timeout at service level i.e. if after 1 minute if the file is still downloading close the connection etc.
I don't want to have some many open threads in the back ground as this service is being called in a loop to download files. Smaller files like 30 MG downloads fine but the larger ones are not.
I have a error hndler at the root level but the error is not trapped there either. Looks like system errors are not getting trapped.
So Just wondering if OSB is suitable to download that huge files.
ThanksThe reason for the error is the xquery is not able to find the values in the input... Check the input and namespaces...
Try...
<ns1:value1>{ data($addition1/ns0:value1) }</ns1:value1>
<ns1:value2>{ data($addition1/ns0:value2) }</ns1:value2>Cheers,
Vlad -
OSB transformation error- BEA-382513- Error parsing XML
Hi Gurus -
I am struggling to fix one OSB Xquery transformation error
<con:errorCode>BEA-382513</con:errorCode>
<con:reason>OSB Replace action failed updating variable "body": Error parsing XML: {err}FORG0005: expected exactly one item, got 0 items
I am passing SIL formatted data to this transformation an expecting a transformation but its keep on failing, I have tested the transformation and thats looking good.
This is my replace operation where I am doing transformation.
Replace [ node contents ] of [ ./* ]
in [ body ] with
XQuery Resource: TestProject/Common/Transformation/XQJMS2DBTransformation
Variable Names And Bindings:
commonInterfaceLayout1 - $body/*:CommonInterfaceLayout
transformation file
(:: pragma bea:global-element-parameter parameter="$commonInterfaceLayout1" element="ns0:CommonInterfaceLayout" location="../../Common/Schema/CommonInterfaceLayout.xsd" ::)
(:: pragma bea:global-element-return element="ns1:EaiAuditCollection" location="../../Common/Schema/XSD_InsertEAIAuditDBTable.xsd" ::)
declare namespace ns1 = "http://xmlns.oracle.com/pcbpel/adapter/db/top/InsertEAIAuditDBTable";
declare namespace ns0 = "http://eai.fpl.com/schema/CommonInterfaceLayout";
declare namespace xf = "http://tempuri.org/ErrorHandlingR1V1/XQJMS2DB/";
declare function xf:XQJMS2DB($commonInterfaceLayout1 as element(ns0:CommonInterfaceLayout))
as element(ns1:EaiAuditCollection) {
<ns1:EaiAuditCollection>
<ns1:EaiAudit>
<ns1:eaiAuditId></ns1:eaiAuditId>
<ns1:messageId>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageId) }</ns1:messageId>
<ns1:messageDate>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageReceivedDate) }</ns1:messageDate>
<ns1:messageType>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageType) }</ns1:messageType>
<ns1:messageSource>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageSource) }</ns1:messageSource>
<ns1:messageTarget>{ data($commonInterfaceLayout1/ns0:Header/ns0:MessageTarget) }</ns1:messageTarget>
<ns1:appUniqId>{ data($commonInterfaceLayout1/ns0:Header/ns0:ApplicationUniqueId) }</ns1:appUniqId>
<ns1:payload>{ data($commonInterfaceLayout1/ns0:Body) }</ns1:payload>
<ns1:componentName>{ data($commonInterfaceLayout1/ns0:Header/ns0:ComponentName) }</ns1:componentName>
<ns1:clientId>{ data($commonInterfaceLayout1/ns0:Header/ns0:ClientId) }</ns1:clientId>
<ns1:createDate>{ fn:current-date() }</ns1:createDate>
<ns1:processFlag></ns1:processFlag>
</ns1:EaiAudit>
</ns1:EaiAuditCollection>
declare variable $commonInterfaceLayout1 as element(ns0:CommonInterfaceLayout) external;
xf:XQJMS2DB($commonInterfaceLayout1)
pls advice whats wrong I am doing here.
Edited by: KumarB on Feb 7, 2013 9:56 PMupdate - I dont see this error any more but transformation is not happening. as a result of transformation, i get same message as output .. no change in it.
-
XML Namespace problem in XMLType
Hi,
I am getting this error, if anyone has any information about it please let me know.
extract() returns the following error when a reserverd xml namespace 'xml:lang' is used in the xml document. if the namespace is removed it dosent give error.
If this is not an error, please let me know how to workaround it.
Thanks,
Divakar.
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00233: namespace prefixes starting with "xml" are reserved
Error at line 71
ORA-06512: at "XDB.DBMS_XMLDOM", line 3508
ORA-06512: at "XDB.DBMS_XMLDOM", line 3551
ORA-06512: at "OPS$DTANJORE.CDR_CDISC_TOPIC3", line 44
ORA-06512: at line 1Hi Vijaykumar,
Thanks for your reply.
But it is standard proxy structure, Is it fine to modify this ?
& it is proxy, so we have to regenerate it in SRM also.
is it fine ?
Study SAP -
BusinessService error in msg parsing: xml was empty, didn't parse!
Hi
I'm trying to consuming a WebService implemented in PHP, the WS its internal
http://192.168.2.15:81/project/service/ws.wsdl
I created a BusinessService from that WSDL, but when i test the businessService through the sbconsole i get this
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultactor xsi:type="xsd:string"/>
<faultstring xsi:type="xsd:string">
error in msg parsing:
xml was empty, didn't parse!
</faultstring>
<detail xsi:type="xsd:string"/>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<con:metadata xmlns:con="http://www.bea.com/wli/sb/test/config">
<tran:headers xsi:type="http:HttpResponseHeaders" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:user-header name="X-Powered-By" value="PHP/5.2.1"/>
<tran:user-header name="X-SOAP-Server" value="NuSOAP/0.9.5 (1.123)"/>
<http:Connection>close</http:Connection>
<http:Content-Length>689</http:Content-Length>
<http:Content-Type>text/xml; charset=ISO-8859-1</http:Content-Type>
<http:Date>Wed, 15 Aug 2012 14:55:28 GMT</http:Date>
<http:Server>Apache/2.2.4 (Win32)</http:Server>
</tran:headers>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">2</tran:response-code>
<tran:response-message xmlns:tran="http://www.bea.com/wli/sb/transports">Internal Server Error</tran:response-message>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">ISO-8859-1</tran:encoding>
<http:http-response-code xmlns:http="http://www.bea.com/wli/sb/transports/http">500</http:http-response-code>
</con:metadata>
-- Added
I forgot to say that the WS works well when i tested with SoapUI
Any help would be apreciated.
Thanks
Edited by: user4159641 on 15-ago-2012 8:00Using the new URL i am able to createBusiness Service, i have pasted the content of the wsdl generated.
wsSitidataEstandar.php.wsdl
<definitions targetNamespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema targetNamespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
<xsd:complexType name="arrayData">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="headerArray">
<xsd:all>
<xsd:element name="key" type="xsd:string"/>
<xsd:element name="addressOrCoordinate" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayOfString">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:headerArray[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="sequence">
<xsd:all>
<xsd:element name="key" type="xsd:string"/>
<xsd:element name="sequence" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayOfSequence">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:sequence[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="itinerary">
<xsd:all>
<xsd:element name="text" type="xsd:string"/>
<xsd:element name="cx" type="xsd:string"/>
<xsd:element name="cy" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayOfItinerary">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:itinerary[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="invalid">
<xsd:all>
<xsd:element name="key" type="xsd:string"/>
<xsd:element name="address" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayOfInvalid">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:invalid[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="arrayresult">
<xsd:all>
<xsd:element name="sequence" type="tns:arrayOfSequence"/>
<xsd:element name="itinerary" type="tns:arrayOfItinerary"/>
<xsd:element name="invalid" type="tns:arrayOfInvalid"/>
<xsd:element name="message" type="xsd:string"/>
<xsd:element name="totalTime" type="xsd:string"/>
<xsd:element name="totalDistanceCalculated" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="arrayresult2">
<xsd:all>
<xsd:element name="geo" type="tns:arrayData"/>
<xsd:element name="message" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:schema>
</types>
<message name="enriquecerRequest">
<part name="direccion" type="xsd:string"/>
<part name="ciudad" type="xsd:string"/>
<part name="barrio" type="xsd:string"/>
<part name="usuario" type="xsd:string"/>
<part name="clave" type="xsd:string"/></message>
<message name="enriquecerResponse">
<part name="return" type="tns:arrayresult2"/></message>
<message name="enriquecerAsistidoRequest">
<part name="direccion" type="xsd:string"/>
<part name="ciudad" type="xsd:string"/>
<part name="barrio" type="xsd:string"/>
<part name="usuario" type="xsd:string"/>
<part name="clave" type="xsd:string"/></message>
<message name="enriquecerAsistidoResponse">
<part name="return" type="tns:arrayresult2"/></message>
<message name="enriquecerXmlLotesRequest">
<part name="xmlEnvio" type="xsd:string"/>
<part name="usuario" type="xsd:string"/>
<part name="clave" type="xsd:string"/></message>
<message name="enriquecerXmlLotesResponse">
<part name="return" type="xsd:string"/></message>
<portType name="wsSitidataEstandarPortType">
<operation name="enriquecer">
<input message="tns:enriquecerRequest"/>
<output message="tns:enriquecerResponse"/>
</operation>
<operation name="enriquecerAsistido">
<input message="tns:enriquecerAsistidoRequest"/>
<output message="tns:enriquecerAsistidoResponse"/>
</operation>
<operation name="enriquecerXmlLotes">
<input message="tns:enriquecerXmlLotesRequest"/>
<output message="tns:enriquecerXmlLotesResponse"/>
</operation>
</portType>
<binding name="wsSitidataEstandarBinding" type="tns:wsSitidataEstandarPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="enriquecer">
<soap:operation soapAction="http://www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php/enriquecer" style="rpc"/>
<input><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="enriquecerAsistido">
<soap:operation soapAction="http://www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php/enriquecerAsistido" style="rpc"/>
<input><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="enriquecerXmlLotes">
<soap:operation soapAction="http://www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php/enriquecerXmlLotes" style="rpc"/>
<input><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="encoded" namespace="www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
</binding>
<service name="wsSitidataEstandar">
<port name="wsSitidataEstandarPort" binding="tns:wsSitidataEstandarBinding">
<soap:address location="http://www.sitimapa.com/webservice/sitidata/wsSitidataEstandar.php"/>
</port>
</service>
</definitions> -
Flash Player 10 removes HTML encoding in CDATA when parsing XML
I have an application that was written with Flash Professional 8/AS2 and it parses XML for rendering dynamic media content. The XML pulls text with HTML markup out of CDATA sections and places them into an html enabled text field. Everything has worked wonderfully until Flash Player 10.
Now, if we use html escape characters for greater than or less than symbols, they are being decoded by the xml parser.
Here's my example CDATA section:
Here <u>we</u> go: This <node> <works>
when I grab its value using nodeValue or toString, the results are different from Flash Player 9 to 10. Here's what I'm getting:
node.nodeValue (Flash Player 9):
Here <u>we</u> go: This <node> <works>
node.nodeValue (Flash Player 10):
Here <u>we</u> go: This <node> <works>
node.toString (Flash Player 9):
Here <u>we</u> go: This <node> <works>
node.toString (Flash Player 10):
Here <u>we</u> go: This <node> <works>
In Flash 10, if I escape the ampersand, it will work, but this doesn't work in 9. for example, the following works in 10:
<![CDATA[Here <u>we</u> go: This &#60;node&#62; &lt;works&gt;]]>
This all happens before I assign it to a text field. How do I keep the parser from destroying my escaped characters in Flash 10? Do I just need to drop support for Flash Player 9 and go for what works in 10, or is there a solution for both?
Message was edited by: XygarI'm not an action script programmer. I'm just trying to fix some code written like 3 years ago. So I think I am wrong about where this problem is coming from.
The original developer actually set up a class to load a remote xml file via sendAndLoad on a LoadVars object. It passes an object with an onData delegate set that passes the event object to an xml parsing method.
the parsing method looks like this:
private function parseXml(eventObj:Object){
if(eventObj != undefined)
try
//ExternalInterface.call("logMessage", eventObj.toString());
_xmlDoc.parseXML(eventObj.toString());
_xmlDoc.loaded = true;
_xmlDoc.onLoad(true);
catch(ex)
_xmlDoc.onLoad(false);
else
_xmlDoc.onLoad(false);
I added the ExternalInterface call so that I could log the stuff out in javascript (since I'm not sure how to debug this app).
_xmlDoc is defined as: private var _xmlDoc:XML;
The eventObj receives the xml string and then passes it to the parseXML thing. Here's the odd part. In Flash Player 10, if I comment out my ExternalInterface call, the xml string has the escaped character decoded before it gets to the parser.
However, if I uncomment my ExternalInterface call, it logs the escaped strings as i would expect, but the parser gets the correct formatting this time! Suddenly it all works.
I really wish I had an AS2 programmer on campus still.... -
PO 7.4 RESTAdapter issue : Unable to parse XML message payload
Dear experts,
We are implementing the scenario Exposing a function module as Restful service with the PO RESTAdapter that's avaiable in PO 7.4 SP09 as described in the blog written by Ivo:
PI REST Adapter – Exposing a function module as RESTful service
When we test the scenario to processing messages the adapter reports the error message:
Error while sending message to module processor: senderChannel '589b39c9b91c3ae99040d9addc6a818b': Catching exception calling messaging system: Unable to parse XML message payload to extract operation for receiver determinationorg.xml.sax.SAXParseException: Premature end of file.
Anyone an idea or solution direction?
Thanks in advance.
Cheers, LucHi YRV isa,
Issue solved by Ivo Kulms
"Either you use a Dummy Interface in the IFlow for the adapter or you have to specify on the Operation Determination Tab which XI Operation / Interface should be used. The table on the tab allows to specify different interface name depending on the internal variables. In the variable columns add for example the REST operation, by entering "operation", in the expression column "GET" or "POST" or "*" and in the operation/namespace columns the XI operation / interface you want to reference.
The variable "operation" has to be in curly brackets, so that it gets evaluated. So the entry should look like "{operation}" ( or like "{service}" if you want to map the XI operation by REST service name)"
Kind regards, Luc -
AS3 - FLASH 10
Hello,
I'm having some trouble understanding how can I access a tag in a xml RSS Feed 2 format. Some tags have, what I think to be, namespaces that just ignore my request when accessing such tag. Here is an example:
// XML LOADED
<rss>
<channel>
<item>
<title>POST TITLE</title>
<link>http://domain.org/blog/2009/08/post-name/</link>
<comments>http://domain.org/blog/2009/08/post-name/#comments</comments>
<pubDate>Mon, 31 Aug 2009 21:39:40 +0000</pubDate>
<dc:creator>admin</dc:creator>
<category><![CDATA[CATEGORY]]></category>
<category><![CDATA[CATEGORY]]></category>
<guid isPermaLink="false">http://domain.org/blog/?p=3</guid>
<description><![CDATA[DATA[...]]]></description>
<content:encoded><![CDATA[DATA]]></content:encoded>
<wfw:commentRss>http://domain.org/blog/2009/08/post-name/feed/</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>
</channel>
</rss>
// FLASH CODE
trace ( xml.channel.item.title ) // Output POST TITLE
trace ( xml.channel.item.content ) // Output undefined or “”
… same for wfw and slash tags.
Any help?
RegardsOne of the ways is to use regular expressions and replace all the unwanted namespaces with pure tags:
1. Get the xml data as string:
var xmlString:String = [write the data here]
2. Pattern for the tags with namespaces is something like this:
var exp:RegExp = /<\\|(\w+):(\w+)>/gi;
3. This is just to demostrate what it outputs: - is not needed in the final code
var tagsArray:Array = xmlString.match(exp);
var currentOccurance:Array;
for (var i:int = 0; i < tagsArray.length; i++) {
currentOccurance = tagsArray[i].split(":");
trace("left = " + currentOccurance[0] + "; right = " + currentOccurance[1]);
It outputs something like this:
left = content; right = encoded>
left = content; right = encoded>
left = wfw; right = commentRss>
left = wfw; right = commentRss>
left = slash; right = comments>
left = slash; right = comments>
4. Depending on what side you want to use in the final tag:
a. If left:
xmlString = xmlString.replace(exp, "$1");
It will make the following changes:
From:
<content:encoded>....</content:encoded>
<wfw:commentRss>...</wfw:commentRss>
To:
<content>....</content>
<wfw>...</wfw>
b. if right:
xmlString = xmlString.replace(exp, "$2>");
It will make the following changes:
To
<encoded>....</encoded>
<commentRss>...</commentRss>
The final code is actually 4 lines only (assuming you use complete event):
var xmlString:String = e.target.data;
var exp:RegExp = /<\\|(\w+):(\w+)>/gi;
xmlString = xmlString.replace(exp, "$1");
var myXML:XML = new XML(xmlString);
Viola! You can parse xml regular way. -
Hi All,
I have some troubles trying to load and parse a simple xml file like this:
<?xml version="1.0" encoding="UTF-8"?>
<entry>
<id>1</id>
</entry>
<entry>
<id>2</id>
</entry>
With this few lines of code:
var url:URLRequest = new URLRequest("myXML.xml");
var xml:XML;
var rss:URLLoader = new URLLoader();
rss.load(url);
rss.addEventListener(Event.COMPLETE, readRss);
function readRss(e:Event):void{
xml = XML(rss.data);
var ns:Namespace=xml.namespace();
txt_field.text=xml..ns::entry[0].ns::id;
I get this error: A conflict exists with inherited definition spark.components:Application.url in namespace public.
in: var url:URLRequest = new URLRequest("myXML.xml");
Please help me ... thank you in advance.
MicheleHi Michele,
Try to use different name for your URLRequest object...It seems that there is conflict existing with the inherited url property of the Application and the one you declared so do the following..
var _url:URLRequest = new URLRequest("myXML.xml");
var xml:XML;
var rss:URLLoader = new URLLoader();
rss.load(_url);
Thanks,
Bhasker -
Hello -
I have an interesting situation...
I have a webservice and I want my client to be able to send a org.w3c.dom.Document object as the body of the SOAP request.
This is easily done w/ the SAAJ API for web services.
I also want to validate the Document before I send it over the wire.
Code:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(xmlFileToUpload);
I have verified that WebLogic 8.1 is using the Apache Xerces parser.
The XML file that the client will be uploading looks something like this:
<uploadJobData xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://C:\ComputingJobsUpload.xsd">
<computingJobs>
<job> .... </job>
</computingJobs>
</uploadJobData>
My schema looks like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="uploadJobData">
<xs:complexType>
<xs:all>
<xs:element name="computingJobs" type="ArrayOfComputingJobs"/>
<xs:element name="name" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:complexType name="ArrayOfComputingJobs">
<xs:sequence>
<xs:element name="job" type="ComputingJob" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ComputingJob">
<xs:all>
<xs:element name="queuedTime" type="xs:dateTime"/>
<xs:element name="beginTime" type="xs:dateTime"/>
<xs:element name="endTime" type="xs:dateTime"/>
<xs:element name="numCpusUsed" type="xs:short"/>
<xs:element name="numNodesUsed" type="xs:short"/>
<xs:element name="chargeFactor" type="xs:decimal"/>
</xs:all>
</xs:complexType>
</xs:schema>
The problem is, when the code turns on validation, I get an error that states:
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'uploadJobData'.
Why is this?
Also - and an even bigger issue -
When I turn off validation, everything works fine. I can handle this, except that the newly added Document in my SOAPBody now has an XML namespace attribute (xmlns) for every element! My namespace is fairly large, so its making the content length of my SOAP request almost twice as big!
After parsing the XML file in the DocumentBuilder, the XML looks something like this:
<ns1:uploadJobData xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://C:\ComputingJobsUpload.xsd" xmlns:ns1="http://server.jobupload.services.mics.apps.mis.jlab.org">
<computingJobs xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org">
<job xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org">...</job>
</computingJobs>
<name xmlns="http://server.jobupload.services.mics.apps.mis.jlab.org">JLab</name>
</ns1:uploadJobData>
As you can see, the parser places the namespace attribute for every element.
Is there any way to turn this off?
Thanx in advance.
--BobbyNext release is planed to be out next week. We will annouced here when they are ready for download.
-
Dear all,
First of all sorry, if this is not the right place for my question.
I am facing some problem with the XFire Webservices. When i am trying to access the WSDL through the url. server is throwing the following exception :
javax.servlet.ServletException: The name "" is not legal for JDOM/XML namespaces: Namespace URIs must be non-null and non-empty Strings.
org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:143)
org.codehaus.xfire.transport.http.XFireServlet.doGet(XFireServlet.java:107)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
org.jdom.IllegalNameException: The name "" is not legal for JDOM/XML namespaces: Namespace URIs must be non-null and non-empty Strings.
org.jdom.Namespace.getNamespace(Namespace.java:164)
org.codehaus.xfire.util.NamespaceHelper.getUniquePrefix(NamespaceHelper.java:58)
org.codehaus.xfire.aegis.type.basic.BeanType.writeSchema(BeanType.java:560)
org.codehaus.xfire.wsdl.AbstractWSDL.addDependency(AbstractWSDL.java:224)
org.codehaus.xfire.wsdl.AbstractWSDL.addDependency(AbstractWSDL.java:233)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createDocLitPart(WSDLBuilder.java:403)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createPart(WSDLBuilder.java:355)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.writeParameters(WSDLBuilder.java:509)
cont.......
I am not able to figure out the root cause for this. The service.xml file looks like below:
<?xml version="1.0" encoding="UTF-8"?>
<!-- START Service.xml -->
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<!-- Construct the castor service factory by Spring -->
<bean id="castorTypeRegistry" class="org.codehaus.xfire.castor.CastorTypeMappingRegistry"/>
<bean id="bindingProvider" class="org.codehaus.xfire.aegis.AegisBindingProvider">
<constructor-arg ref="castorTypeRegistry"/>
</bean>
<bean id="castorServiceFactory" class="org.codehaus.xfire.service.binding.ObjectServiceFactory">
<constructor-arg index="0" ref="xfire.transportManager"/>
<constructor-arg index="1" ref="bindingProvider"/>
</bean>
<service>
<name>ReleaseManager</name>
<namespace>ReleaseManager</namespace>
<serviceClass>com.pinkroccade.jfoundation.calculation.releases.ReleaseManager</serviceClass>
<implementationClass>com.pinkroccade.jfoundation.calculation.releases.ReleaseManagerImpl</implementationClass>
<schemas>
<schema>META-INF/schema/release-impact-worksheet-3.2.0.xsd</schema>
</schemas>
<style>document</style>
<serviceFactory>#castorServiceFactory</serviceFactory>
</service>
</beans>
<!-- END Service.xml-->
The issue which i am facing is it due to the problem with the service.xml (Which i dont think so..), Or is it any thing to do with the XSD file which i am using.
Can any body give me some guide lines for this ????
Thanks in advance.
Thanks and Regards,
Manjunath.Any one any thoughts..
I need to find out the solution for this as soon as possible; Not able to proceed further...
Thanks and Regards,
Manjunath. -
Script for parsing xml data and inserting in DB
Thank you for reading.
I have the following example XML in an XML file. I need to write a script that can insert this data into an Oracle table. The table does not have primary keys. The data just needs to be inserted.
I do not have xsd file in this scenario. Please suggest how to modify Method 1 https://community.oracle.com/thread/1115266?tstart=0 mentioned so that I can call the XML mentioned below and insert into a table
Method 1
Create or replace procedure parse_xml is
l_bfile BFILE;
l_clob CLOB;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
l_nl dbms_xmldom.DOMNodeList;
l_n dbms_xmldom.DOMNode;
l_file dbms_xmldom.DOMNodeList;
l_filen dbms_xmldom.DOMNode;
lv_value VARCHAR2(1000);
l_ch dbms_xmldom.DOMNode;
l_partname varchar2(100);
l_filename varchar2(1000);
l_temp VARCHAR2(1000);
TYPE tab_type IS TABLE OF tab_software_parts%ROWTYPE;
t_tab tab_type := tab_type();
BEGIN
l_bfile := BFileName('DIR1', 'SoftwareParts.xml');
dbms_lob.createtemporary(l_clob, cache=>FALSE);
dbms_lob.open(l_bfile, dbms_lob.lob_readonly);
dbms_lob.loadFromFile(dest_lob => l_clob, src_lob => l_bfile, amount => dbms_lob.getLength(l_bfile));
dbms_lob.close(l_bfile);
dbms_session.set_nls('NLS_DATE_FORMAT','''DD-MON-YYYY''');
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
l_nl := dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(l_doc),'/PartDetails/Part');
FOR cur_emp IN 0 .. dbms_xmldom.getLength(l_nl) - 1 LOOP
l_n := dbms_xmldom.item(l_nl, cur_emp);
t_tab.extend;
dbms_xslprocessor.valueOf(l_n,'Name/text()',l_partname);
t_tab(t_tab.last).partname := l_partname;
l_file := dbms_xslprocessor.selectNodes(l_n,'Files/FileName');
FOR cur_ch IN 0 .. dbms_xmldom.getLength(l_file) - 1 LOOP
l_ch := dbms_xmldom.item(l_file, cur_ch);
lv_value := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_ch));
if t_tab(t_tab.last).partname is null then t_tab(t_tab.last).partname := l_partname; end if;
t_tab(t_tab.last).filename := lv_value;
t_tab.extend;
END LOOP;
END LOOP;
t_tab.delete(t_tab.last);
FOR cur_emp IN t_tab.first .. t_tab.last LOOP
if t_tab(cur_emp).partname is not null and t_tab(cur_emp).filename is not null then
INSERT INTO tab_software_parts
VALUES
(t_tab(cur_emp).partname, t_tab(cur_emp).filename);
end if;
END LOOP;
COMMIT;
dbms_xmldom.freeDocument(l_doc);
EXCEPTION
WHEN OTHERS THEN
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
END;
<TWObject className="TWObject">
<array size="240">
<item>
<variable type="QuestionDetail">
<questionId type="String"><![CDATA[30]]></questionId>
<questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
<country type="String"><![CDATA[GB]]></country>
<questionText type="String"><![CDATA[Please indicate]]></questionText>
<optionType type="String"><![CDATA[RadioButton]]></optionType>
<answerOptions type="String[]">
<item><![CDATA[Yes]]></item>
<item><![CDATA[No]]></item>
</answerOptions>
<ruleId type="String"><![CDATA[CRP_GB001]]></ruleId>
<parentQuestionId type="String"></parentQuestionId>
<parentQuestionResp type="String"></parentQuestionResp>
</variable>
</item>
<item>
<variable type="QuestionDetail">
<questionId type="String"><![CDATA[40]]></questionId>
<questionType type="questionType"><![CDATA[COUNTRY]]></questionType>
<country type="String"><![CDATA[DE]]></country>
<questionText type="String"><![CDATA[Please indicate]]></questionText>
<optionType type="String"><![CDATA[RadioButton]]></optionType>
<answerOptions type="String[]">
<item><![CDATA[Yes]]></item>
<item><![CDATA[No]]></item>
</answerOptions>
<ruleId type="String"><![CDATA[CRP_Q0001]]></ruleId>
<parentQuestionId type="String"></parentQuestionId>
<parentQuestionResp type="String"></parentQuestionResp>
</variable>
</item>
</array>
</TWObject>Reposted as
Script to parse XML data into Oracle DB
Maybe you are looking for
-
App-v 5.0 SP2 Client UI Virtual Application not launching
Hi there, Currently we're upgrading to APP-V 5.0 SP2 (HF5). I downloaded the official APP-V Client UI from the Microsoft site. The Hotfix and App-V 5.0 SP2 installed succesfully, I even got Office 2013 to work with the new App-V Client. The problem
-
Opportunity Report driven by account ownership
I am trying to create a new homepage report so that a sales person can see all opportunities in their territory where either they own the opportunity or someone else does. The report is written off of the opportunities area, so the only value I have
-
ACS 4.2 replication issue
We recently upgraded to ACS 4.2. All works perfectly except for replication. I now receive an error ACS Internal Database Replication Errors 1.To disable receiving of EAP-FAST replication component, "EAP-FAST master server" must be enabled on "Global
-
Hello, Great to hear from anyone who has created a non-ABAP process type and included in the process chain. The interface methods and how they get called and/or check status etc. are not documented or at least I cannot find them. Thanks Mathew
-
OSB DB-Adapter and a date column: JCA exception ISO 8601 date format?
Hello I work with Oracle Service Bus (eclipse oepe and jdev) On database side I've a view with a date column (datatype=date!) With JDev I create a DB Adapter with a select operation on that view. This db adapter can be successfully generated. Now I i