AS3 returns a string of XML nodes as null....

I am working on a project that calls and searches an XML sheet that looks like this:
    <Searchtext Wordlookup="john smith">
        <location>$1</location>
        <Name>john smith</Name>
    </Searchtext>
and it continues like this for about 100+ people.
Now, my flash takes this data and allows the user to either click on a textbox prefilled with a name (whose e.target.data.text is matched up to the xml using @Wordlookup) or type in the name of the person (again matching the textbox's content to @Wordlookup) which results in the location of that person lighting up (MC's are named the same as the location node for each). This end works perfectly fine using this code:
  var result:String = xmldata.Searchtext.(@Wordlookup == inputTxt.text.toLowerCase()).location.toString(); 
Now I want to do the opposite; click on a location, and the code will match up that movieclip's name to a location node in my xm - light up that location, and output the person's name in the textbox. Only problem in that Flash apparently thinks a node in my xml is now a variable that is undefined (it should return as the name that is related to the location in my xml). I have looked high and low for a solution, but I just can't seem to solve it (it is probably simple, and I'll facepalm myself) The error inducing code is this:
  var resultz:String = xmldata.Searchtext.(location.text() == e.target.name).Name.toString();
And the error produced is this: ReferenceError: Error #1065: Variable location is not defined.
Not sure exactly why this is happening, thank you in advance for any help!

So my as3: (I gave you this chunk in case I've just completely missed something here)
                              loader = new URLLoader();
                              loadXML();
                    private function loadXML():void
                              loader.load(new URLRequest("data.xml"));
                              loader.addEventListener(Event.COMPLETE, onXMLLoaded)
                              trace("loaded");
                    private function onXMLLoaded(e:Event):void
                              xmldata = new XML(loader.data);
                              var itemXMLList:XMLList = XMLList(xmldata.Searchtext..location);
            var count:int = itemXMLList.length();
            trace(count);
                              trace(xmldata.Searchtext.location[25].text().toString(),xmldata.Searchtext.location[25].text.length().toString());
                       trace(xmldata.Searchtext.location[0].text().toString(),          xmldata.Searchtext.location[0].text.length().toString());
        private function LocationClick(e:Event):void
//         var resultz:String = xmldata.Searchtext.(location.text().toString() == e.target.name).Name.toString();
//         inputTxt.text=resultz;
           trace(e.target.name, e.target.name.length);
           inputTxt.text=e.target.name;          
My output using this:
loaded
78
$1 0
$2 0
$1 2
$2 2

Similar Messages

  • Convertion of String to XML node using Xquery transformation in OSB

    How to convert string to XML node elementusing a built in function using Xquery transformation in OSB?

    check this out - http://www.javamonamour.org/2011/06/fn-beainlinedxml.html
    if in SOA (BPEL & Mediator) you can use oraext:parseXML.
    you should thoroughly analyse where to implement your requirement as some good practices advise to implement more complex logic in SOA and leave OSB to only connect to the services' endpoints.
    Hope this helps,
    A.

  • Can't convert string element to XML node using XSL

    We have a source XML with a node that contains another XML as string. Like this:
    "<imp1:payload>&lt;?xml version = '1.0' encoding = 'ISO-8859-15' standalone = 'no'?>
    &lt;!-- Oracle eXtensible Markup Language Gateway Server -->&lt;!DOCTYPE PROCESS_PO_007 SYSTEM "003_process_po_007.dtd">&lt;PROCESS_PO_007>&lt;CNTROLAREA>" etc
    And we have a target XML that has the schema inside the string in the source file, like this:
    "<PROCESS_PO_007>
    <CNTROLAREA>"....etc.
    How can we "parse" the string to a node using an XSL transformation file?

    Hi,
    Can you tell me which code are you using currently for transferrring the data? It might help me to figure out what your problem is.

  • XML - ORA-19025: EXTRACTVALUE returns value of only one node

    Hi,
    I am new to XML DB. Can somebody help me with the below XML
    I use the following XML ... (I have pasted only a part of it coz i require data only till this section )
    XML
    <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
    instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body>
    <ns:PicklistWS_GetPicklistValues_Output xmlns:ns="urn:crmondemand/ws/picklist/">
    <ListOfParentPicklistValue xmlns="urn:/crmondemand/xml/picklist">
    <ParentPicklistValue>
    <Language>ENU</Language>
    <ParentFieldName>plProduct_Team</ParentFieldName>
    <ParentDisplayValue>Marketing On Demand</ParentDisplayValue>
    <ParentCode>Marketing On Demand</ParentCode>
    <Disabled>N</Disabled>
    <ListOfPicklistValue>
    <PicklistValue>
    <Code>OCP/SME Escalation</Code>
    <DisplayValue>OCP/SME Escalation</DisplayValue>
    <Disabled>N</Disabled>
    </PicklistValue>
    <PicklistValue>
    <Code>Fusion Request</Code>
    <DisplayValue>Fusion Request</DisplayValue>
    <Disabled>N</Disabled>
    </PicklistValue>
    Code
    SELECT distinct
    EXTRACTVALUE(VALUE(SR), '/ParentPicklistValue/ListOfPicklistValue/PicklistValue/Code','xmlns="urn:/crmondemand/xml/picklist"') AS Display,
    EXTRACTVALUE(VALUE(SR),'/ParentPicklistValue/ListOfPicklistValue/PicklistValue/DisplayValue','xmlns="urn:/crmondemand/xml/picklist"') AS Return,
    EXTRACTVALUE(VALUE(SR),'/ParentPicklistValue/ParentDisplayValue','xmlns="urn:/crmondemand/xml/picklist"') AS parent_display,
    EXTRACTVALUE(VALUE(SR),'/ParentPicklistValue/ParentCode','xmlns="urn:/crmondemand/xml/picklist"') AS parent_return
    FROM TABLE(XMLSEQUENCE(EXTRACT(
    WEB_SERVICE('<?xml version="1.0" encoding="UTF-8" standalone="no"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <PicklistWS_GetPicklistValues_Input xmlns="urn:crmondemand/ws/picklist/">
    <FieldName>Type</FieldName>
    <RecordType>Service Request</RecordType>
    </PicklistWS_GetPicklistValues_Input>
    </soap:Body>
    </soap:Envelope>'
    ,'document/urn:crmondemand/ws/picklist/:GetPicklistValues', Sessionid),
    '/soap:Envelope/soap:Body/*/*/*','xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/'))) SR
    ERROR
    ORA-19025: EXTRACTVALUE returns value of only one node
    UNDERSTANDING
    As my Xpath points only until the node - ParentPicklistValue and not the child nodes under it. Hence when i try to query the child nodes - /ParentPicklistValue/ListOfPicklistValue/PicklistValue/Code, I recieve the above mentioned error.
    REQUIREMENT
    Can somebody help me to recieve the Parent values and also its child values based on the above query and xml.

    Hi,
    That's a classic ;)
    You need a second XMLSequence that will shred the collection of PicklistValue into relational rows :
    select extractvalue(value(sr2), '/PicklistValue/Code', 'xmlns="urn:/crmondemand/xml/picklist"') AS Display
         , extractvalue(value(sr2), '/PicklistValue/DisplayValue', 'xmlns="urn:/crmondemand/xml/picklist"') AS Return
         , extractvalue(value(sr1), '/ParentPicklistValue/ParentDisplayValue', 'xmlns="urn:/crmondemand/xml/picklist"') AS parent_display
         , extractvalue(value(sr1), '/ParentPicklistValue/ParentCode', 'xmlns="urn:/crmondemand/xml/picklist"') AS parent_return
    from table(
           xmlsequence(
             extract( WEB_SERVICE( ... )
                    , '/soap:Envelope/soap:Body/ns:PicklistWS_GetPicklistValues_Output/ListOfParentPicklistValue/ParentPicklistValue'
                    , 'xmlns="urn:/crmondemand/xml/picklist"
                       xmlns:ns="urn:crmondemand/ws/picklist/"
                       xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"' )
         ) sr1
       , table(
           xmlsequence(
             extract( value(sr1)
                    , '/ParentPicklistValue/ListOfPicklistValue/PicklistValue'
                    , 'xmlns="urn:/crmondemand/xml/picklist"' )
         ) sr2
    ;What's your database version BTW?
    On 10.2 and up, you may use XMLTable instead.

  • Convertion of XML node to string using Xquery transformation in OSB

    How to convert XML node to string using a built in function using Xquery transformation in OSB? In BPEL we have the Xpath extension function ora:getContentAsString() to do the same.

    fn:bea-serialize() function converts xml node to string. but it assigns namespace prefix in every xml node during the conversion. So is there any function to remove the namespace prefix from XML node using Xquery built in function?

  • XML Comparison without DTD & XSD and able to return XPath of the Diff Node

    Dear All,
    I am new xml concept in java.
    First xml can have n of nodes and second xml can have n of the node.
    The node is new to second xml when compare to first xml.It has to go change list.
    1. My job is to compare 2 xml document and return the XPath of the Nodes.
    2. Both xml do not have any association like XSD,DTD and XSLT.
    3. I am looking for java api to find/return xpath of the node.
    Please help me.
    Saravanan.P

    Don't know if there's a method for this in the default XML parsing interface of Java (JAXP). I never came across a method which would return an XPath expression based on a Node and a Document. Only the other way around: return the Node(s) based on a Document and an XPath expression. Maybe some Java XML framework like XStream or an Apache XML framework have this functionality. It would be possible (not really nice though) to create such a method yourself. Based on a Document and a Node as input you could iterate through the parent elements until you reach the root Node and return the path. You would need to take into account that a Node can be part of a NodeList, so you have to retrieve the index of the Node in the list too.
    Ronald

  • Converting string to XML

    Dear All,
    I am using PI 7.1
    I am trying to invoke a third party SOAP API which accepts request in the form of a string which has embedded xml and also return a string which has xml embedded in it.
    To send the xml as string, I used the feature "Retun as XML" in mapping and it worked fine.
    But the response which has xml embedded, needs to be converted back to XML message.
    I understand that we can write parsers in java, ABAP and also do XSLT mapping.
    Just wanted to know that is there any "out of the box" feature to do the same.
    Please refrain from providing links to java mappings or xslt as I have gone through them already.
    regards,
    Piyush

    Hi Piyush,
                      All parsers will fail to parse the XML message you are getting. Since you are getting the following tag twice within the XMl
    "<?xml version="1.0"?>"
    This tag can be present in an document only once in begining of the document. First you need to remove this tag from appearing in source.
    Suppose you are able to do that then your XML structure will become something like this
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <ns1:AuthenticateResponse xmlns:ns1="urn:Login" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
    <return xsi:type="xsd:string"><MessageResponse sessionid=";jsessionid=FxZLTxtJnXJttpW6gMhJ06kyn00tfSgjt9ZwbzJ55CXGn92S8L6f!-444760742!1311845684753" status="SUCCESS" topicprefix="ND-DSK-117.CXL_HMEL_DB"><Entity name="REF_PERSON"><Property name="last_access_dt" value="20110728145937" type="DATE"/><Property name="modify_person_num" value="21" type="INTEGER"/><Property name="persontopic" value="350523952" type="STRING"/><Property name="login_result_ind" value="0" type="INTEGER"/><Property name="login_result_reason" value="" type="STRING"/><Property name="bypass_drafts" value="0" type="STRING"/><Property name="stl_check_swap_option_pricing_end" value="1" type="BOOLEAN"/><Property name="stl_update_provisional_cashflows" value="0" type="BOOLEAN"/><Property name="stl_autoinvoice_costs" value="1" type="BOOLEAN"/><Property name="stl_allow_payments_from_agents" value="0" type="BOOLEAN"/><Property name="stl_payment_allocation_at_invoice_detail_level" value="1" type="BOOLEAN"/><Property name="last_db_reloaded_on" value="" type="DATE"/><Property name="xl_mode_ind" value="0" type="INTEGER"/><Property name="Xchange_enabled" value="1" type="INTEGER"/><Property name="Xchange_server" value="XCHANGE" type="STRING"/><Property name="ipaddress" value="10.60.4.80" type="STRING"/><Property name="appname" value="CommodityXL" type="STRING"/><Property name="version" value="7.XL7.08.17E" type="STRING"/><Property name="econfirm.server.enabled" value="0" type="BOOLEAN"/></Entity></MessageResponse></return>
    </ns1:AuthenticateResponse>
    Then you can use the following java mapping code to remove the SOAP envelop.
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class RemoveSoapEnvelopSDN implements StreamTransformation{
    public void execute(InputStream in, OutputStream out)
    throws StreamTransformationException {
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         Element root;
         Node p;
         NodeList l;
         int mm,n1;
         //if you need to include namespace use next two lines
         //root=docOut.createElement("ns0:MessageResponse");
         //root.setAttribute("xmlns:ns0","http://connectsystems.be/MAINFR/AccDocument");
         root=docOut.createElement("MessageResponse");
         p=docIn.getElementsByTagName("MessageResponse").item(0);
         l=p.getChildNodes();
         n1=l.getLength();
         for(mm=0;mm<n1;++mm)
              Node temp=docOut.importNode(l.item(mm),true);
              root.appendChild(temp);
         docOut.appendChild(root);
         transform.transform(new DOMSource(docOut), new StreamResult(out));
    catch(Exception e)
         e.printStackTrace();
    public void setParameter(Map arg0) {
    public static void main(String[] args) {
    try{
         RemoveSoapEnvelopSDN genFormat=new RemoveSoapEnvelopSDN();
         FileInputStream in=new FileInputStream("C:\\Apps\\my folder\\sdn\\sdn6.xml");
         FileOutputStream out=new FileOutputStream("C:\\Apps\\my folder\\sdn\\removedEnvelopSdn6.xml");
         genFormat.execute(in,out);
    catch(Exception e)
    e.printStackTrace();
    You can add attributes to the tags as per your requirement. I have commnented those lines in the java code.
    The output will look like this
    http://postimage.org/image/2b2czww90/
    Hope this helps.
    Regards
    Anupam

  • Using XSLT to extract value of a XML node with namespace

    I have a XML source code here.
    <?xml version="1.0" encoding="utf-8" ?>
    <rss version="2.0" xmlns:job="http://www.pageuppeople.com">
      <channel>
        <title>SMH Jobs</title>
        <link>internalrecruitment.smhgroup.com.au/jobsrss.ashx?stp=di</link>
        <description>A listing of jobs available here</description>
        <item>
          <title>eCommerce Optimisation Advisor</title>
          <description>A new and exciting opportunity exists for an experienced eCommerce Advisor to join</description>
          <job:location PUReferenceID="3711">Sydney - Inner Suburbs & CBD</job:location>
        </item>
      </channel>
    </rss>
    I want to use XSLT to extract value of a XML node with namespace <job:location>, and the returned value should be string 'Sydney - Inner Suburbs & CBD'. I tried a few XSL code below, but failed with error or nothing was returned.
    <xsl:value-of select="job:location" disable-output-escaping="yes"/>
    <xsl:value-of select="job/location" disable-output-escaping="yes"/>
    <xsl:value-of select="job\location" disable-output-escaping="yes"/>
    <xsl:value-of select="location" disable-output-escaping="yes"/>
    This might be an easy question for you, but I would appreciate if anyone can help.

    Hi Suncorp IT Learner,
    We need to tell the XSLT that some elements are in another namespace. Copy the xmls declarations for the prefixes you need to use. Then use the xsl format as:
    <xsl: value-of select=”job:location/@PUReferenceID”/>
    In following issue, Chriztian has a good explanation:
    http://our.umbraco.org/forum/developers/xslt/33353-XSLT-reading-XML-attribute-value
    Thanks,
    Qiao Wei
    TechNet Community Support

  • To format string like xml

    Hi,
    i have a string which has a xml content:
    String myXML = "<xml><test>Test</test></xml>";
    With log4j i produce a trace file with the output of String a: Log.info(myXML);
    Unfortunately the content of xml data is verly long and its difficult to read it.
    I would like to have the string to be xml formatted like:
    <xml>
    <test>Test</test>
    </xml>
    how to manage it?
    Thanks

    Your best bet might to be getting a 'tidy' program for xml. Most xml editors can very cleanly re-structure xml to collapsible nodes.
    Also you could try some proactive logging logic;
    after a closing tag, add a \n to return a new line, this will help most editors make it display nicely.

  • Fetching multiple values from XML node

    Hi,
    I have the below XML string / Data stored in one of a table column. I am trying to extract the values of ITEM_NAME node. using the query :
    select extractvalue(xml_data, '/BILL/BILL_DTL/RECORD/ITEM_NAME') from XMLTable;
    If i use this query i am getting the error as : ORA-19025 EXTRACTVALUE returns value of only one node
    XML String / XML data
    &lt;BILL&gt;
    .....&lt;BILL_NO&gt;1000&lt;/BILL_NO&gt;
    .....&lt;SRNO&gt;3456&lt;/SRNO&gt;
    .....&lt;BILL_DTL&gt;
    ........&lt;RECORD&gt;
    ...........&lt;LINE_NO&gt;1&lt;/LINE_NO&gt;
    ...........&lt;ITEM_NAME&gt;TOYOTA COROLLA&lt;/ITEM_NAME&gt;
    ........&lt;/RECORD&gt;
    ........&lt;RECORD&gt;
    ..........&lt;LINE_NO&gt;2&lt;/LINE_NO&gt;
    ..........&lt;ITEM_NAME&gt;NISSAN CEDRIC&lt;/ITEM_NAME&gt;
    .......&lt;/RECORD&gt;
    .....&lt;/BILL_DTL&gt;
    &lt;/BILL&gt;
    The structure of the table is given below.
    SQL&gt; DESC XMLTABLE;
    Column_Name ---------------Type
    DOC_ID -------------------------NUMBER
    XML_DATA --------------------XMLTYPE
    What will be the query to fetch the values from the ITEM_NAME node.
    Thanks & Regards

    A late answer but just to show that it can be done with XMLTable (the built-in Oracle function) when you expect to return multiple rows from one input.
    WITH XMLTable AS
    (SELECT XMLTYPE('<BILL>
       <BILL_NO>1000</BILL_NO>
       <SRNO>3456</SRNO>
       <BILL_DTL>
          <RECORD>
             <LINE_NO>1</LINE_NO>
             <ITEM_NAME>TOYOTA COROLLA</ITEM_NAME>
          </RECORD>
          <RECORD>
             <LINE_NO>2</LINE_NO>
             <ITEM_NAME>NISSAN CEDRIC</ITEM_NAME>
              </RECORD>
         </BILL_DTL>
    </BILL>') xml_data
       FROM dual
    SELECT item_name
      FROM XMLTable,
           XMLTable('/BILL/BILL_DTL/RECORD'
                    PASSING xml_data
                    COLUMNS
                       item_name  VARCHAR2(25) PATH 'ITEM_NAME'
    Returns
    ITEM_NAME
    TOYOTA COROLLA
    NISSAN CEDRIC

  • XML: sorting XML nodes

    How would I sort a bunch of XML nodes? I don't necessarily
    need to change the existing structure, but I do need to iterate
    through in a specific order. In AS2 I would use the childNodes
    array and use Array.sort.

    And here's a attribute sort function from
    http://freerpad.blogspot.com/2007/07/more-hierarchical-sorting-e4x-xml-for.html.
    var xml:XML =
    <root>
    <node id="2">alpha</node>
    <node id="3">delta</node>
    <node id="5">bravo</node>
    <node id="0">foxtrot</node>
    <node id="1">echo</node>
    <node id="4">charlie</node>
    </root>
    sortXmlAttribute(xml,"id",true, Array.CASEINSENSITIVE);
    trace(xml)
    function sortXmlAttribute
    ( avXml :XML,
    avAttributeName :String,
    avPutEmptiesAtBottom :Boolean,
    avArraySortArgument0 :* = 0,
    avArraySortArgument1 :* = 0 )
    :void
    var lvChildrenCount:int
    = avXml.children().length();
    if( lvChildrenCount == 0 )
    return;
    if( lvChildrenCount > 1 )
    var lvAttributeValue :String;
    var lvXml :XML;
    var lvSortOptions:int
    = avArraySortArgument0 is Function
    ? avArraySortArgument1 : avArraySortArgument0;
    var lvSortCaseInsensitive:Boolean
    = ( lvSortOptions & Array.CASEINSENSITIVE )
    == Array.CASEINSENSITIVE;
    var lvArray:Array = new Array();
    for each( lvXml in avXml.children() )
    lvAttributeValue
    = lvXml.attribute( avAttributeName );
    if( lvSortCaseInsensitive )
    lvAttributeValue
    = lvAttributeValue.toUpperCase();
    if( lvArray.indexOf( lvAttributeValue ) == -1 )
    lvArray.push( lvAttributeValue );
    } // for each
    if( lvArray.length > 1 )
    lvArray.sort
    avArraySortArgument0,
    avArraySortArgument1
    if( avPutEmptiesAtBottom )
    if( lvArray[0] == "" )
    lvArray.push( lvArray.shift() );
    } // if
    } // if
    var lvXmlList:XMLList = new XMLList();
    for each( lvAttributeValue in lvArray )
    for each( lvXml in avXml.children() )
    var lvXmlAttributeValue:String
    = lvXml.attribute( avAttributeName );
    if( lvSortCaseInsensitive )
    lvXmlAttributeValue
    = lvXmlAttributeValue.toUpperCase();
    if( lvXmlAttributeValue == lvAttributeValue )
    lvXmlList += lvXml;
    } // for each
    } // for each
    avXml.setChildren( lvXmlList );
    } // if
    for each( var lvXmlChild:XML in avXml.children() )
    sortXmlAttribute
    lvXmlChild,
    avAttributeName,
    avPutEmptiesAtBottom,
    avArraySortArgument0,
    avArraySortArgument1
    } // for each
    } // sortXmlAttribute

  • XML nodes equal?

    I want to know whether two XML nodes are equal. I don't need the difference I want an easy way to get a true or false as return value.

    I've found already a solution myself but to me it looks a bit to complicated and very dirty. The way it works: first I parse the two XML documents to DOM documents. When I've have my two DOM nodes I both transform them to a String with the method below and then I do a String comparison with equals.
    (I use JDK 1.4.2_02 maybe usefull to know)
    public static String nodeToString(Node node) {
      try {
        DOMSource source = new DOMSource(node);
        StringWriter writer = new StringWriter();
        StreamResult result = new StreamResult(writer);
        transformer_.transform(source,result);
        return writer.toString();
       catch(TransformerException te) {
        te.printStackTrace();
      return "";
    Is there any way to avoid the transformation. So I can something like:
    Node node1 = retrieve_somewhere_node1();
    Node node2 = retrieve_somewhere_node2();
    boolean isequal = node1.isNodeEqual(node2);
    (in my case the nodes are always Elements with attributes and subnodes...)

  • SQL Server Agent Failed to decrypt protected XML node

    I'm getting the below error when trying to run sql server agent to run an SSIS package. I've updated folder security to allow sql server agent access, but cannot get the package to execute within SQL Management Studio. The package runs find in SSIS. 
    11.0.2100.60 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  12:12:00 PM  Error: 2014-11-30 12:12:02.65     Code: 0xC0016016     Source: LoadStgProspects      Description:
    Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
    the correct key is available.  End Error  Error: 2014-11-30 12:12:03.88     Code: 0xC0016016     Source: LoadStgProspects      Description: Failed to decrypt protected XML node "DTS:Password" with error
    0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2014-11-30
    12:12:04.74     Code: 0xC0209303     Source: LoadStgProspects Connection manager "Excel Connection Manager"     Description: The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered. If the 64-bit driver
    is not installed<c/> run the package in 32-bit mode. Error code: 0x00000000.  An OLE DB record is available.  Source: "Microsoft OLE DB Service Components"  Hresult: 0x80040154  Description: "Class not registered".
     End Error  Error: 2014-11-30 12:12:04.74     Code: 0xC020801C     Source: Load prospect files Prospect xls [231]     Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection
    method call to the connection manager "Excel Connection Manager" failed with error code 0xC0209303.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.  End Error  Error:
    2014-11-30 12:12:04.74     Code: 0xC0047017     Source: Load prospect files SSIS.Pipeline     Description: Prospect xls failed validation and returned error code 0xC020801C.  End Error  Error: 2014-11-30 12:12:04.74
        Code: 0xC004700C     Source: Load prospect files SSIS.Pipeline     Description: One or more component failed validation.  End Error  Error: 2014-11-30 12:12:04.74     Code: 0xC0024107     Source:
    Load prospect files      Description: There were errors during task validation.  End Error  Error: 2014-11-30 12:12:04.74     Code: 0xC00220DE     Source: LoadStgProspects      Description: Error
    0xC0012050 while loading package file "C:\Users\Jim\Documents\Visual Studio 2010\Projects\SSISTraining\SSISTraining\LoadStgProspects.dtsx". Package failed validation from the ExecutePackage task. The package cannot run.  .  End Error  DTExec:
    The package execution returned DTSER_FAILURE (1).  Started:  12:12:00 PM  Finished: 12:12:04 PM  Elapsed:  4.337 seconds.  The package execution failed.  The step failed.,00:00:04,0,0,,,,0

    Hi selfdestruct80,
    According to your description, you created SSIS package and it works fine. But you got the error message when the SSIS package was called from a SQL Server Agent job.
    According to my knowledge, the package may not run in the following scenarios:
    The current user cannot decrypt secrets from the package.
    A SQL Server connection that uses integrated security fails because the current user does not have the required permissions.
    File access fails because the current user does not have the required permissions to write to the file share that the connection manager accesses.
    A registry-based SSIS package configuration uses the HKEY_CURRENT_USER registry keys. The HKEY_CURRENT_USER registry keys are user-specific.
    A task or a connection manager requires that the current user account has correct permissions.
    According to the error message, the SSIS Package ProtectionLevel property to EncryptSensitiveWithPassword as ArthurZ mentioned. To solve the problem, you need to go to Command Line tab, manually specify the paassword in SQL Agent Job with the command like below:
    /FILE "\"C:\Users\xxxx\Documents\SQL Server Management Studio\SSIS\Package.dtsx\"" /DECRYPT somepassword /CHECKPOINTING OFF /REPORTING E
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • String to XML

    Hi everyone,
    i'm just writing a method, that gets a string and a XPath and want writes the string to the specific XPath in my xml document. The problem ist, that the string itself can contain nodes like (e.g. <image> or something else from my dtd, so i got some problems converting the string to xml. Actually i'm trying this:
         public static void setEditFragment(String content, String xPath) throws Exception {
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             DocumentBuilder builder  = factory.newDocumentBuilder();
             Document document = builder.parse("data.xml");
             XPath xpath = XPathFactory.newInstance().newXPath();
             Node node = (Node)xpath.evaluate(xPath, document, XPathConstants.NODE);
             System.out.println(content);
             node.setTextContent(content);
             // Use a XSLT transformer for writing the new XML file
                Transformer transformer = TransformerFactory.newInstance().newTransformer();
                // Set output to IsoLatin1
                transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1");
             DOMSource        source = new DOMSource( document );
             FileOutputStream os     = new FileOutputStream("tmp.xml");
             StreamResult     result = new StreamResult( os );
             transformer.transform( source, result ); 
         }but of course this will not work and sets up some cryptic signs in mein xml document....
    can anyone give me advice ?
    Thanks !

    Well, if you already have the data XML encoded, then just write them to a file:
    http://java.sun.com/docs/books/tutorial/essential/io/index.html
    Make sure you encode the data with UTF8:
    http://java.sun.com/javase/6/docs/api/java/lang/String.html#getBytes(java.lang.String)
    Write "<?xml version="1.0" encoding="utf-8"?>" before the data!
    Note however, I generally don't recommend to write XML data by hand. Rather use a framework like JAXB.
    -Puce
    Edited by: Puce on May 8, 2008 1:36 PM

  • 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

Maybe you are looking for