Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

XML DOM wrapper (COM)


  • Please log in to reply
742 replies to this topic

#681 Syed23

Syed23

    Mass Spammer! - It's Me

  • Active Members
  • PipPipPipPipPipPip
  • 544 posts

Posted 03 June 2011 - 10:14 AM

I don't see the problem. This works fine for me:

#include <_XMLDOMWrapper.au3> Global $debugging = True, $iRET, $configtype Global $sXML = '<?xml version="1.0" ?>' & @CRLF & _         '<meta_data config_type="private" lastfeed_high="0" />' & @CRLF $iRET = _XMLLoadXML($sXML) ConsoleWrite("$iRET = " & $iRET & @LF) $configtype=_xmlgetattrib("/meta_data", "config_type") msgbox(0,"","Config?  " & $configtype)


:huh2:

Hi PsaltyDS,
i am working on a tool creation. i need your help to complete that. could you please help me ? my task is simple! i should have all the application name in one node and the location and exe of that application should be in its child node. how can i create the XML for 35 to 90 applications? also how can i read that XML attributes thrioguh my code to shows in array?
Thank you,Regards,K.Syed Ibrahim.







#682 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 08 June 2011 - 01:47 AM

@Syed23: You'll have to post some effort for us to work with here.

Have you tried just _XMLCreateFile() and _XMLFileOpen() yet?

:huh2:
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#683 TXTechie

TXTechie

    Adventurer

  • Active Members
  • PipPip
  • 104 posts

Posted 27 June 2011 - 10:16 PM

Can someone give me an idea of how to get started using the XMLDomWrapper.au3 UDF to read my xml file?

I just need to obtain the <OBT_WF_RUN_ID></OBT_WF_RUN_ID> record.

Here's a portion of my XML file:
Plain Text         
<?xml version='1.0' encoding='UTF-8'?> <encapsulatedArchiveGroup xmlns="<a href='http://www.hp.com/EA/6.2.0/RA_CUSTOMER_TRX_ALL/1.0.0.0/06o3415r7eobtvsr5965b7wrp0ha0200baq/GROUP_XML' class='bbc_url' title='External link' rel='nofollow external'>http://www.hp.com/EA/6.2.0/RA_CUSTOMER_TRX_ALL/1.0.0.0/06o3415r7eobtvsr5965b7wrp0ha0200baq/GROUP_XML"</a> xmlns:xsi="<a href='http://www.w3.org/2001/XMLSchema-instance' class='bbc_url' title='External link' rel='nofollow external'>http://www.w3.org/2001/XMLSchema-instance"</a> xsi:schemaLocation="<a href='http://www.hp.com/EA/6.2.0/RA_CUSTOMER_TRX_ALL/1.0.0.0/06o3415r7eobtvsr5965b7wrp0ha0200baq/GROUP_XML' class='bbc_url' title='External link' rel='nofollow external'>http://www.hp.com/EA/6.2.0/RA_CUSTOMER_TRX_ALL/1.0.0.0/06o3415r7eobtvsr5965b7wrp0ha0200baq/GROUP_XML</a> RA_CUSTOMER_TRX_ALL_06o3415r7eobtvsr5965b7wrp0ha0200baq_group.xsd" fileInitialName="RA_CUSTOMER_TRX_ALL_06o3415r7eobtvsr5965b7wrp0ha0200baq_group_0.xml">     <groupSpec>         <productName>EA</productName>         <productVersion>6.2.0</productVersion>         <workflowRunId>3357</workflowRunId>         <runGuid>06o3415r7eobtvsr5965b7wrp0ha0200bax</runGuid>         <archiveGuid>06o3415r7eobtvsr5965b7wrp0ha0200baq</archiveGuid>         <groupGuid>06o3415r7eobtvsr5965b7wrp0ha0200bau</groupGuid>         <sequence>0</sequence>         <beginTime>2011-06-23T12:13:44.000000000-05:00</beginTime>         <appsPack>             <name>RA_CUSTOMER_TRX_ALL</name>             <version>1.0.0.0</version>         </appsPack>         <source>             <guid>06o3415r7eobtvsr5965b7wrp0ha0200bav</guid>             <status>ACTIVE</status>             <category>DATABASE</category>             <type>Oracle</type>             <locationProperty name="Port">10010</locationProperty>             <locationProperty name="Host">auohseoai24.oracleoutsourcing.com</locationProperty>             <locationProperty name="Database">oracle</locationProperty>             <locationProperty name="DBServer">PEOAII</locationProperty>             <locationProperty name="ConnType">default</locationProperty>             <locationProperty name="UserID">obt_if</locationProperty>             <locationProperty name="DriverType">Type 4</locationProperty>             <locationProperty name="CharacterSet">UTF8</locationProperty>         </source>         <destination>             <guid>06o3415r7eobtvsr5965b7wrp0ha0200baw</guid>             <status>ACTIVE</status>             <category>BACKEND</category>             <type>Filesystem</type>             <locationProperty name="Host">auohseoai14</locationProperty>             <locationProperty name="UserID">obt</locationProperty>             <locationProperty name="Directory">/peoaii/3rdparty/HP/D2F/AR</locationProperty>             <file>                 <id xsi:nil="true"/>                 <preProcessName>RA_CUSTOMER_TRX_ALL_06o3415r7eobtvsr5965b7wrp0ha0200baq_group_0.xml</preProcessName>                 <postProcessName>RA_CUSTOMER_TRX_ALL_06o3415r7eobtvsr5965b7wrp0ha0200baq_group_0.xml</postProcessName>                 <type>DATA</type>                 <groupGuid>06o3415r7eobtvsr5965b7wrp0ha0200bau</groupGuid>                 <checksum>                     <algorithm>NONE</algorithm>                 </checksum>                 <compression>NONE</compression>             </file>         </destination>     </groupSpec>     <attInstances>         <attInstance guid="3357-1">             <RA_CUSTOMER_TRX_ALL>                 <CUSTOMER_TRX_ID>68683</CUSTOMER_TRX_ID>                 <LAST_UPDATE_DATE>2003-04-02T12:25:35.000000000-06:00</LAST_UPDATE_DATE>                 <LAST_UPDATED_BY>1261</LAST_UPDATED_BY>                 <CREATION_DATE>2003-04-02T12:25:02.000000000-06:00</CREATION_DATE>                 <CREATED_BY>1261</CREATED_BY>                 <LAST_UPDATE_LOGIN>967894</LAST_UPDATE_LOGIN>                 <TRX_NUMBER>406338</TRX_NUMBER>                 <CUST_TRX_TYPE_ID>1000</CUST_TRX_TYPE_ID>                 <TRX_DATE>2003-04-02T00:00:00.000000000-06:00</TRX_DATE>                 <SET_OF_BOOKS_ID>1</SET_OF_BOOKS_ID>                 <BILL_TO_CONTACT_ID xsi:nil="true"/>                 <BATCH_ID>3413</BATCH_ID>                 <BATCH_SOURCE_ID>1029</BATCH_SOURCE_ID>                 <REASON_CODE xsi:nil="true"/>                 <SOLD_TO_CUSTOMER_ID>5244</SOLD_TO_CUSTOMER_ID>                 <SOLD_TO_CONTACT_ID xsi:nil="true"/>                 <SOLD_TO_SITE_USE_ID xsi:nil="true"/>                 <BILL_TO_CUSTOMER_ID>5244</BILL_TO_CUSTOMER_ID>                 <BILL_TO_SITE_USE_ID>6109</BILL_TO_SITE_USE_ID>                 <SHIP_TO_CUSTOMER_ID>5244</SHIP_TO_CUSTOMER_ID>                 <SHIP_TO_CONTACT_ID xsi:nil="true"/>                 <SHIP_TO_SITE_USE_ID>9155</SHIP_TO_SITE_USE_ID>                 <SHIPMENT_ID xsi:nil="true"/>                 <REMIT_TO_ADDRESS_ID>1020</REMIT_TO_ADDRESS_ID>                 <TERM_ID>1000</TERM_ID>                 <TERM_DUE_DATE xsi:nil="true"/>                 <PREVIOUS_CUSTOMER_TRX_ID xsi:nil="true"/>                 <PRIMARY_SALESREP_ID>100000042</PRIMARY_SALESREP_ID>                 <PRINTING_ORIGINAL_DATE>2003-04-03T05:11:31.000000000-06:00</PRINTING_ORIGINAL_DATE>                 <PRINTING_LAST_PRINTED>2003-08-08T15:03:43.000000000-05:00</PRINTING_LAST_PRINTED>                 <PRINTING_OPTION>PRI</PRINTING_OPTION>                 <PRINTING_COUNT>5</PRINTING_COUNT>                 <PRINTING_PENDING>N</PRINTING_PENDING>                 <PURCHASE_ORDER>03/28/2003</PURCHASE_ORDER>                 <PURCHASE_ORDER_REVISION xsi:nil="true"/>                 <PURCHASE_ORDER_DATE xsi:nil="true"/>                 <CUSTOMER_REFERENCE xsi:nil="true"/>                 <CUSTOMER_REFERENCE_DATE xsi:nil="true"/>                 <COMMENTS xsi:nil="true"/>                 <INTERNAL_NOTES xsi:nil="true"/>                 <EXCHANGE_RATE_TYPE xsi:nil="true"/>                 <EXCHANGE_DATE xsi:nil="true"/>                 <EXCHANGE_RATE xsi:nil="true"/>                 <TERRITORY_ID xsi:nil="true"/>                 <INVOICE_CURRENCY_CODE>USD</INVOICE_CURRENCY_CODE>                 <INITIAL_CUSTOMER_TRX_ID xsi:nil="true"/>                 <AGREEMENT_ID xsi:nil="true"/>                 <END_DATE_COMMITMENT xsi:nil="true"/>                 <START_DATE_COMMITMENT xsi:nil="true"/>                 <LAST_PRINTED_SEQUENCE_NUM>0</LAST_PRINTED_SEQUENCE_NUM>                 <ATTRIBUTE_CATEGORY>ORDER</ATTRIBUTE_CATEGORY>                 <ATTRIBUTE1 xsi:nil="true"/>                 <ATTRIBUTE2>AS400</ATTRIBUTE2>                 <ATTRIBUTE3>03-MAY-03</ATTRIBUTE3>                 <ATTRIBUTE4 xsi:nil="true"/>                 <ATTRIBUTE5 xsi:nil="true"/>                 <ATTRIBUTE6 xsi:nil="true"/>                 <ATTRIBUTE7 xsi:nil="true"/>                 <ATTRIBUTE8 xsi:nil="true"/>                 <ATTRIBUTE9>(BACKORDER)              B030861133</ATTRIBUTE9>                 <ATTRIBUTE10 xsi:nil="true"/>                 <ORIG_SYSTEM_BATCH_NAME xsi:nil="true"/>                 <POST_REQUEST_ID xsi:nil="true"/>                 <REQUEST_ID>903184</REQUEST_ID>                 <PROGRAM_APPLICATION_ID>222</PROGRAM_APPLICATION_ID>                 <PROGRAM_ID>20428</PROGRAM_ID>                 <PROGRAM_UPDATE_DATE>2003-04-02T12:25:02.000000000-06:00</PROGRAM_UPDATE_DATE>                 <FINANCE_CHARGES xsi:nil="true"/>                 <COMPLETE_FLAG>Y</COMPLETE_FLAG>                 <POSTING_CONTROL_ID>-3</POSTING_CONTROL_ID>                 <BILL_TO_ADDRESS_ID xsi:nil="true"/>                 <RA_POST_LOOP_NUMBER xsi:nil="true"/>                 <SHIP_TO_ADDRESS_ID xsi:nil="true"/>                 <CREDIT_METHOD_FOR_RULES xsi:nil="true"/>                 <CREDIT_METHOD_FOR_INSTALLMENTS xsi:nil="true"/>                 <RECEIPT_METHOD_ID xsi:nil="true"/>                 <ATTRIBUTE11 xsi:nil="true"/>                 <ATTRIBUTE12 xsi:nil="true"/>                 <ATTRIBUTE13 xsi:nil="true"/>                 <ATTRIBUTE14>Customer_Pays-Customer_Pays</ATTRIBUTE14>                 <ATTRIBUTE15 xsi:nil="true"/>                 <RELATED_CUSTOMER_TRX_ID xsi:nil="true"/>                 <INVOICING_RULE_ID xsi:nil="true"/>                 <SHIP_VIA>UPS</SHIP_VIA>                 <SHIP_DATE_ACTUAL>2003-04-02T00:00:00.000000000-06:00</SHIP_DATE_ACTUAL>                 <WAYBILL_NUMBER>0</WAYBILL_NUMBER>                 <FOB_POINT xsi:nil="true"/>                 <CUSTOMER_BANK_ACCOUNT_ID xsi:nil="true"/>                 <INTERFACE_HEADER_ATTRIBUTE1>16201</INTERFACE_HEADER_ATTRIBUTE1>                 <INTERFACE_HEADER_ATTRIBUTE2>DOM_LENS_DAILY_CNV</INTERFACE_HEADER_ATTRIBUTE2>                 <INTERFACE_HEADER_ATTRIBUTE3>F90-0001012966</INTERFACE_HEADER_ATTRIBUTE3>                 <INTERFACE_HEADER_ATTRIBUTE4>0</INTERFACE_HEADER_ATTRIBUTE4>                 <INTERFACE_HEADER_ATTRIBUTE5>0</INTERFACE_HEADER_ATTRIBUTE5>                 <INTERFACE_HEADER_ATTRIBUTE6>485028</INTERFACE_HEADER_ATTRIBUTE6>                 <INTERFACE_HEADER_ATTRIBUTE7>0</INTERFACE_HEADER_ATTRIBUTE7>                 <INTERFACE_HEADER_ATTRIBUTE8>0</INTERFACE_HEADER_ATTRIBUTE8>                 <INTERFACE_HEADER_CONTEXT>ORDER ENTRY</INTERFACE_HEADER_CONTEXT>                 <DEFAULT_USSGL_TRX_CODE_CONTEXT xsi:nil="true"/>                 <INTERFACE_HEADER_ATTRIBUTE10>45</INTERFACE_HEADER_ATTRIBUTE10>                 <INTERFACE_HEADER_ATTRIBUTE11>0</INTERFACE_HEADER_ATTRIBUTE11>                 <INTERFACE_HEADER_ATTRIBUTE12>                             1</INTERFACE_HEADER_ATTRIBUTE12>                 <INTERFACE_HEADER_ATTRIBUTE13>                             0</INTERFACE_HEADER_ATTRIBUTE13>                 <INTERFACE_HEADER_ATTRIBUTE14>                             0</INTERFACE_HEADER_ATTRIBUTE14>                 <INTERFACE_HEADER_ATTRIBUTE15 xsi:nil="true"/>                 <INTERFACE_HEADER_ATTRIBUTE9>0</INTERFACE_HEADER_ATTRIBUTE9>                 <DEFAULT_USSGL_TRANSACTION_CODE xsi:nil="true"/>                 <RECURRED_FROM_TRX_NUMBER xsi:nil="true"/>                 <STATUS_TRX>OP</STATUS_TRX>                 <DOC_SEQUENCE_ID xsi:nil="true"/>                 <DOC_SEQUENCE_VALUE xsi:nil="true"/>                 <PAYING_CUSTOMER_ID xsi:nil="true"/>                 <PAYING_SITE_USE_ID xsi:nil="true"/>                 <RELATED_BATCH_SOURCE_ID xsi:nil="true"/>                 <DEFAULT_TAX_EXEMPT_FLAG xsi:nil="true"/>                 <CREATED_FROM>RAXTRX</CREATED_FROM>                 <ORG_ID>52</ORG_ID>                 <WH_UPDATE_DATE xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE1 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE2 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE3 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE4 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE5 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE6 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE7 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE8 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE9 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE10 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE11 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE12 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE13 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE14 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE15 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE16 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE17 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE18 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE19 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE20 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE21 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE22 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE23 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE24 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE25 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE26 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE27 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE28 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE29 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE30 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE_CATEGORY xsi:nil="true"/>                 <EDI_PROCESSED_FLAG xsi:nil="true"/>                 <EDI_PROCESSED_STATUS xsi:nil="true"/>                 <MRC_EXCHANGE_RATE_TYPE xsi:nil="true"/>                 <MRC_EXCHANGE_DATE xsi:nil="true"/>                 <MRC_EXCHANGE_RATE xsi:nil="true"/>                 <PAYMENT_SERVER_ORDER_NUM xsi:nil="true"/>                 <APPROVAL_CODE xsi:nil="true"/>                 <ADDRESS_VERIFICATION_CODE xsi:nil="true"/>                 <OLD_TRX_NUMBER xsi:nil="true"/>                 <BR_AMOUNT xsi:nil="true"/>                 <BR_UNPAID_FLAG xsi:nil="true"/>                 <BR_ON_HOLD_FLAG xsi:nil="true"/>                 <DRAWEE_ID xsi:nil="true"/>                 <DRAWEE_CONTACT_ID xsi:nil="true"/>                 <DRAWEE_SITE_USE_ID xsi:nil="true"/>                 <REMITTANCE_BANK_ACCOUNT_ID xsi:nil="true"/>                 <OVERRIDE_REMIT_ACCOUNT_FLAG xsi:nil="true"/>                 <DRAWEE_BANK_ACCOUNT_ID xsi:nil="true"/>                 <SPECIAL_INSTRUCTIONS xsi:nil="true"/>                 <REMITTANCE_BATCH_ID xsi:nil="true"/>                 <PREPAYMENT_FLAG xsi:nil="true"/>                 <CT_REFERENCE>16201</CT_REFERENCE>                 <CONTRACT_ID xsi:nil="true"/>                 <BILL_TEMPLATE_ID xsi:nil="true"/>                 <REVERSED_CASH_RECEIPT_ID xsi:nil="true"/>                 <OBT_ROW_SEQ>1</OBT_ROW_SEQ>                 <OBT_TIMESTAMP>2007-11-20T16:46:26.000000000-06:00</OBT_TIMESTAMP>                 <OBT_WF_RUN_ID>160</OBT_WF_RUN_ID>                 <OBT_SAVED_ROWID>AAGb8DAKBAAAJLHAAD</OBT_SAVED_ROWID>                 <CC_ERROR_CODE xsi:nil="true"/>                 <CC_ERROR_TEXT xsi:nil="true"/>                 <CC_ERROR_FLAG xsi:nil="true"/>             </RA_CUSTOMER_TRX_ALL>         </attInstance>


Thank you,

TX Techie

Edited by TXTechie, 27 June 2011 - 10:18 PM.


#684 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 29 June 2011 - 03:36 AM

There are very many examples in this topic. What did you try, and what were the results?

:)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#685 TXTechie

TXTechie

    Adventurer

  • Active Members
  • PipPip
  • 104 posts

Posted 29 June 2011 - 04:05 PM

Hi PsaltyDS,

I've tried some of the examples but I keep getting a "-1". I don't know anything about XML structures and so I don't know what the <OBT_WF_RUN_ID> element is in order to know which function(s) within the XMLDomWrapper I should use in order to determine the value of the <OBT_WF_RUN_ID> element. :) So, I was hoping for some direction.

Since I don't need to loop through the entire document enumerating values, I just need to obtain this one value - I've found it difficult to figure out how to do this from the many examples in this message thread.

Any assistance is appreciated! ;)

TX Techie

#686 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 29 June 2011 - 09:01 PM

Start from step one: how did you use _XMLFileOpen() and error check the result? The fragment of XML you showed includes namespace specifications, did you use those when opening the file?

:)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#687 TXTechie

TXTechie

    Adventurer

  • Active Members
  • PipPip
  • 104 posts

Posted 29 June 2011 - 09:33 PM

I appreciate your patience in working with me, PsaltyDS.

When I use the following script:

#include <XMLDomWrapper.au3> Global $debugging = True, $iRET, $configtype Global $sXML = @ScriptDir & "\Test.xml" $iRET = _XMLFileOpen($sXML) ConsoleWrite("$iRET = " & $iRET & @LF)

I get a return of "1", which means it successfully opened the xml file, correct?

Now what do I do?

#688 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 30 June 2011 - 03:49 AM

First, don't make our lives hard by posting incomplete stuff that we have to edit just to see what you're talking about. It only took adding two lines to your partial XML example to make it complete. Just put this at the end:
    </attInstances> </encapsulatedArchiveGroup>
Now it's a complete XML file we can work with. :)

Now, on closer inspection you get some sympathy because this involves a topic that makes my pin feathers hurt: XPath query with an un-named default namespace. Ref: KB288147 Evil stuff. ;)

Your XML has an un-named default namespace: xmlns="http://www.hp.com/EA/6.2.0/RA_CUSTOMER_TRX_ALL/1.0.0.0/06o3415r7eobtvsr5965b7wrp0ha0200baq/GROUP_XML"

If there is a defined namespace in your scope, then it MUST be explicitly named in the XPath query. The problem is the default namespace has no name. You still can't just leave it off, it MUST be used in XPATH. So at the document object in the MSXML DOM, you have to set the property for "SelectionNamespaces" with a usable name, and the exact same URI as the default. That is accomplished by this line:
$objDoc.setProperty("SelectionNamespaces", 'xmlns:MyNS=' & $sXmlNS)
The default namespace used in XPath selections will now be the same as it was before, but now it has a usable name "MyNS". So we can use that namespace name in the XPath elements:
"/MyNS:encapsulatedArchiveGroup/MyNS:attInstances/MyNS:attInstance/MyNS:RA_CUSTOMER_TRX_ALL/MyNS:OBT_WF_RUN_ID"


So, using this for Test1.xml:
Plain Text         
<?xml version='1.0' encoding='UTF-8'?> <encapsulatedArchiveGroup xmlns="http://www.hp.com/EA/6.2.0/RA_CUSTOMER_TRX_ALL/1.0.0.0/06o3415r7eobtvsr5965b7wrp0ha0200baq/GROUP_XML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hp.com/EA/6.2.0/RA_CUSTOMER_TRX_ALL/1.0.0.0/06o3415r7eobtvsr5965b7wrp0ha0200baq/GROUP_XML RA_CUSTOMER_TRX_ALL_06o3415r7eobtvsr5965b7wrp0ha0200baq_group.xsd" fileInitialName="RA_CUSTOMER_TRX_ALL_06o3415r7eobtvsr5965b7wrp0ha0200baq_group_0.xml">     <groupSpec>         <productName>EA</productName>         <productVersion>6.2.0</productVersion>         <workflowRunId>3357</workflowRunId>         <runGuid>06o3415r7eobtvsr5965b7wrp0ha0200bax</runGuid>         <archiveGuid>06o3415r7eobtvsr5965b7wrp0ha0200baq</archiveGuid>         <groupGuid>06o3415r7eobtvsr5965b7wrp0ha0200bau</groupGuid>         <sequence>0</sequence>         <beginTime>2011-06-23T12:13:44.000000000-05:00</beginTime>         <appsPack>             <name>RA_CUSTOMER_TRX_ALL</name>             <version>1.0.0.0</version>         </appsPack>         <source>             <guid>06o3415r7eobtvsr5965b7wrp0ha0200bav</guid>             <status>ACTIVE</status>             <category>DATABASE</category>             <type>Oracle</type>             <locationProperty name="Port">10010</locationProperty>             <locationProperty name="Host">auohseoai24.oracleoutsourcing.com</locationProperty>             <locationProperty name="Database">oracle</locationProperty>             <locationProperty name="DBServer">PEOAII</locationProperty>             <locationProperty name="ConnType">default</locationProperty>             <locationProperty name="UserID">obt_if</locationProperty>             <locationProperty name="DriverType">Type 4</locationProperty>             <locationProperty name="CharacterSet">UTF8</locationProperty>         </source>         <destination>             <guid>06o3415r7eobtvsr5965b7wrp0ha0200baw</guid>             <status>ACTIVE</status>             <category>BACKEND</category>             <type>Filesystem</type>             <locationProperty name="Host">auohseoai14</locationProperty>             <locationProperty name="UserID">obt</locationProperty>             <locationProperty name="Directory">/peoaii/3rdparty/HP/D2F/AR</locationProperty>             <file>                 <id xsi:nil="true"/>                 <preProcessName>RA_CUSTOMER_TRX_ALL_06o3415r7eobtvsr5965b7wrp0ha0200baq_group_0.xml</preProcessName>                 <postProcessName>RA_CUSTOMER_TRX_ALL_06o3415r7eobtvsr5965b7wrp0ha0200baq_group_0.xml</postProcessName>                 <type>DATA</type>                 <groupGuid>06o3415r7eobtvsr5965b7wrp0ha0200bau</groupGuid>                 <checksum>                     <algorithm>NONE</algorithm>                 </checksum>                 <compression>NONE</compression>             </file>         </destination>     </groupSpec>     <attInstances>         <attInstance guid="3357-1">             <RA_CUSTOMER_TRX_ALL>                 <CUSTOMER_TRX_ID>68683</CUSTOMER_TRX_ID>                 <LAST_UPDATE_DATE>2003-04-02T12:25:35.000000000-06:00</LAST_UPDATE_DATE>                 <LAST_UPDATED_BY>1261</LAST_UPDATED_BY>                 <CREATION_DATE>2003-04-02T12:25:02.000000000-06:00</CREATION_DATE>                 <CREATED_BY>1261</CREATED_BY>                 <LAST_UPDATE_LOGIN>967894</LAST_UPDATE_LOGIN>                 <TRX_NUMBER>406338</TRX_NUMBER>                 <CUST_TRX_TYPE_ID>1000</CUST_TRX_TYPE_ID>                 <TRX_DATE>2003-04-02T00:00:00.000000000-06:00</TRX_DATE>                 <SET_OF_BOOKS_ID>1</SET_OF_BOOKS_ID>                 <BILL_TO_CONTACT_ID xsi:nil="true"/>                 <BATCH_ID>3413</BATCH_ID>                 <BATCH_SOURCE_ID>1029</BATCH_SOURCE_ID>                 <REASON_CODE xsi:nil="true"/>                 <SOLD_TO_CUSTOMER_ID>5244</SOLD_TO_CUSTOMER_ID>                 <SOLD_TO_CONTACT_ID xsi:nil="true"/>                 <SOLD_TO_SITE_USE_ID xsi:nil="true"/>                 <BILL_TO_CUSTOMER_ID>5244</BILL_TO_CUSTOMER_ID>                 <BILL_TO_SITE_USE_ID>6109</BILL_TO_SITE_USE_ID>                 <SHIP_TO_CUSTOMER_ID>5244</SHIP_TO_CUSTOMER_ID>                 <SHIP_TO_CONTACT_ID xsi:nil="true"/>                 <SHIP_TO_SITE_USE_ID>9155</SHIP_TO_SITE_USE_ID>                 <SHIPMENT_ID xsi:nil="true"/>                 <REMIT_TO_ADDRESS_ID>1020</REMIT_TO_ADDRESS_ID>                 <TERM_ID>1000</TERM_ID>                 <TERM_DUE_DATE xsi:nil="true"/>                 <PREVIOUS_CUSTOMER_TRX_ID xsi:nil="true"/>                 <PRIMARY_SALESREP_ID>100000042</PRIMARY_SALESREP_ID>                 <PRINTING_ORIGINAL_DATE>2003-04-03T05:11:31.000000000-06:00</PRINTING_ORIGINAL_DATE>                 <PRINTING_LAST_PRINTED>2003-08-08T15:03:43.000000000-05:00</PRINTING_LAST_PRINTED>                 <PRINTING_OPTION>PRI</PRINTING_OPTION>                 <PRINTING_COUNT>5</PRINTING_COUNT>                 <PRINTING_PENDING>N</PRINTING_PENDING>                 <PURCHASE_ORDER>03/28/2003</PURCHASE_ORDER>                 <PURCHASE_ORDER_REVISION xsi:nil="true"/>                 <PURCHASE_ORDER_DATE xsi:nil="true"/>                 <CUSTOMER_REFERENCE xsi:nil="true"/>                 <CUSTOMER_REFERENCE_DATE xsi:nil="true"/>                 <COMMENTS xsi:nil="true"/>                 <INTERNAL_NOTES xsi:nil="true"/>                 <EXCHANGE_RATE_TYPE xsi:nil="true"/>                 <EXCHANGE_DATE xsi:nil="true"/>                 <EXCHANGE_RATE xsi:nil="true"/>                 <TERRITORY_ID xsi:nil="true"/>                 <INVOICE_CURRENCY_CODE>USD</INVOICE_CURRENCY_CODE>                 <INITIAL_CUSTOMER_TRX_ID xsi:nil="true"/>                 <AGREEMENT_ID xsi:nil="true"/>                 <END_DATE_COMMITMENT xsi:nil="true"/>                 <START_DATE_COMMITMENT xsi:nil="true"/>                 <LAST_PRINTED_SEQUENCE_NUM>0</LAST_PRINTED_SEQUENCE_NUM>                 <ATTRIBUTE_CATEGORY>ORDER</ATTRIBUTE_CATEGORY>                 <ATTRIBUTE1 xsi:nil="true"/>                 <ATTRIBUTE2>AS400</ATTRIBUTE2>                 <ATTRIBUTE3>03-MAY-03</ATTRIBUTE3>                 <ATTRIBUTE4 xsi:nil="true"/>                 <ATTRIBUTE5 xsi:nil="true"/>                 <ATTRIBUTE6 xsi:nil="true"/>                 <ATTRIBUTE7 xsi:nil="true"/>                 <ATTRIBUTE8 xsi:nil="true"/>                 <ATTRIBUTE9>(BACKORDER)              B030861133</ATTRIBUTE9>                 <ATTRIBUTE10 xsi:nil="true"/>                 <ORIG_SYSTEM_BATCH_NAME xsi:nil="true"/>                 <POST_REQUEST_ID xsi:nil="true"/>                 <REQUEST_ID>903184</REQUEST_ID>                 <PROGRAM_APPLICATION_ID>222</PROGRAM_APPLICATION_ID>                 <PROGRAM_ID>20428</PROGRAM_ID>                 <PROGRAM_UPDATE_DATE>2003-04-02T12:25:02.000000000-06:00</PROGRAM_UPDATE_DATE>                 <FINANCE_CHARGES xsi:nil="true"/>                 <COMPLETE_FLAG>Y</COMPLETE_FLAG>                 <POSTING_CONTROL_ID>-3</POSTING_CONTROL_ID>                 <BILL_TO_ADDRESS_ID xsi:nil="true"/>                 <RA_POST_LOOP_NUMBER xsi:nil="true"/>                 <SHIP_TO_ADDRESS_ID xsi:nil="true"/>                 <CREDIT_METHOD_FOR_RULES xsi:nil="true"/>                 <CREDIT_METHOD_FOR_INSTALLMENTS xsi:nil="true"/>                 <RECEIPT_METHOD_ID xsi:nil="true"/>                 <ATTRIBUTE11 xsi:nil="true"/>                 <ATTRIBUTE12 xsi:nil="true"/>                 <ATTRIBUTE13 xsi:nil="true"/>                 <ATTRIBUTE14>Customer_Pays-Customer_Pays</ATTRIBUTE14>                 <ATTRIBUTE15 xsi:nil="true"/>                 <RELATED_CUSTOMER_TRX_ID xsi:nil="true"/>                 <INVOICING_RULE_ID xsi:nil="true"/>                 <SHIP_VIA>UPS</SHIP_VIA>                 <SHIP_DATE_ACTUAL>2003-04-02T00:00:00.000000000-06:00</SHIP_DATE_ACTUAL>                 <WAYBILL_NUMBER>0</WAYBILL_NUMBER>                 <FOB_POINT xsi:nil="true"/>                 <CUSTOMER_BANK_ACCOUNT_ID xsi:nil="true"/>                 <INTERFACE_HEADER_ATTRIBUTE1>16201</INTERFACE_HEADER_ATTRIBUTE1>                 <INTERFACE_HEADER_ATTRIBUTE2>DOM_LENS_DAILY_CNV</INTERFACE_HEADER_ATTRIBUTE2>                 <INTERFACE_HEADER_ATTRIBUTE3>F90-0001012966</INTERFACE_HEADER_ATTRIBUTE3>                 <INTERFACE_HEADER_ATTRIBUTE4>0</INTERFACE_HEADER_ATTRIBUTE4>                 <INTERFACE_HEADER_ATTRIBUTE5>0</INTERFACE_HEADER_ATTRIBUTE5>                 <INTERFACE_HEADER_ATTRIBUTE6>485028</INTERFACE_HEADER_ATTRIBUTE6>                 <INTERFACE_HEADER_ATTRIBUTE7>0</INTERFACE_HEADER_ATTRIBUTE7>                 <INTERFACE_HEADER_ATTRIBUTE8>0</INTERFACE_HEADER_ATTRIBUTE8>                 <INTERFACE_HEADER_CONTEXT>ORDER ENTRY</INTERFACE_HEADER_CONTEXT>                 <DEFAULT_USSGL_TRX_CODE_CONTEXT xsi:nil="true"/>                 <INTERFACE_HEADER_ATTRIBUTE10>45</INTERFACE_HEADER_ATTRIBUTE10>                 <INTERFACE_HEADER_ATTRIBUTE11>0</INTERFACE_HEADER_ATTRIBUTE11>                 <INTERFACE_HEADER_ATTRIBUTE12>                             1</INTERFACE_HEADER_ATTRIBUTE12>                 <INTERFACE_HEADER_ATTRIBUTE13>                             0</INTERFACE_HEADER_ATTRIBUTE13>                 <INTERFACE_HEADER_ATTRIBUTE14>                             0</INTERFACE_HEADER_ATTRIBUTE14>                 <INTERFACE_HEADER_ATTRIBUTE15 xsi:nil="true"/>                 <INTERFACE_HEADER_ATTRIBUTE9>0</INTERFACE_HEADER_ATTRIBUTE9>                 <DEFAULT_USSGL_TRANSACTION_CODE xsi:nil="true"/>                 <RECURRED_FROM_TRX_NUMBER xsi:nil="true"/>                 <STATUS_TRX>OP</STATUS_TRX>                 <DOC_SEQUENCE_ID xsi:nil="true"/>                 <DOC_SEQUENCE_VALUE xsi:nil="true"/>                 <PAYING_CUSTOMER_ID xsi:nil="true"/>                 <PAYING_SITE_USE_ID xsi:nil="true"/>                 <RELATED_BATCH_SOURCE_ID xsi:nil="true"/>                 <DEFAULT_TAX_EXEMPT_FLAG xsi:nil="true"/>                 <CREATED_FROM>RAXTRX</CREATED_FROM>                 <ORG_ID>52</ORG_ID>                 <WH_UPDATE_DATE xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE1 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE2 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE3 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE4 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE5 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE6 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE7 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE8 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE9 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE10 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE11 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE12 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE13 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE14 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE15 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE16 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE17 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE18 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE19 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE20 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE21 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE22 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE23 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE24 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE25 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE26 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE27 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE28 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE29 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE30 xsi:nil="true"/>                 <GLOBAL_ATTRIBUTE_CATEGORY xsi:nil="true"/>                 <EDI_PROCESSED_FLAG xsi:nil="true"/>                 <EDI_PROCESSED_STATUS xsi:nil="true"/>                 <MRC_EXCHANGE_RATE_TYPE xsi:nil="true"/>                 <MRC_EXCHANGE_DATE xsi:nil="true"/>                 <MRC_EXCHANGE_RATE xsi:nil="true"/>                 <PAYMENT_SERVER_ORDER_NUM xsi:nil="true"/>                 <APPROVAL_CODE xsi:nil="true"/>                 <ADDRESS_VERIFICATION_CODE xsi:nil="true"/>                 <OLD_TRX_NUMBER xsi:nil="true"/>                 <BR_AMOUNT xsi:nil="true"/>                 <BR_UNPAID_FLAG xsi:nil="true"/>                 <BR_ON_HOLD_FLAG xsi:nil="true"/>                 <DRAWEE_ID xsi:nil="true"/>                 <DRAWEE_CONTACT_ID xsi:nil="true"/>                 <DRAWEE_SITE_USE_ID xsi:nil="true"/>                 <REMITTANCE_BANK_ACCOUNT_ID xsi:nil="true"/>                 <OVERRIDE_REMIT_ACCOUNT_FLAG xsi:nil="true"/>                 <DRAWEE_BANK_ACCOUNT_ID xsi:nil="true"/>                 <SPECIAL_INSTRUCTIONS xsi:nil="true"/>                 <REMITTANCE_BATCH_ID xsi:nil="true"/>                 <PREPAYMENT_FLAG xsi:nil="true"/>                 <CT_REFERENCE>16201</CT_REFERENCE>                 <CONTRACT_ID xsi:nil="true"/>                 <BILL_TEMPLATE_ID xsi:nil="true"/>                 <REVERSED_CASH_RECEIPT_ID xsi:nil="true"/>                 <OBT_ROW_SEQ>1</OBT_ROW_SEQ>                 <OBT_TIMESTAMP>2007-11-20T16:46:26.000000000-06:00</OBT_TIMESTAMP>                 <OBT_WF_RUN_ID>160</OBT_WF_RUN_ID>                 <OBT_SAVED_ROWID>AAGb8DAKBAAAJLHAAD</OBT_SAVED_ROWID>                 <CC_ERROR_CODE xsi:nil="true"/>                 <CC_ERROR_TEXT xsi:nil="true"/>                 <CC_ERROR_FLAG xsi:nil="true"/>             </RA_CUSTOMER_TRX_ALL>         </attInstance>     </attInstances> </encapsulatedArchiveGroup>


This works:
#include <Array.au3> #include <_XMLDomWrapper.au3> Global $debugging = True, $iRET, $configtype, $aRET Global $sXML = @ScriptDir & "\Test1.xml" Global $sXmlNS = '"http://www.hp.com/EA/6.2.0/RA_CUSTOMER_TRX_ALL/1.0.0.0/06o3415r7eobtvsr5965b7wrp0ha0200baq/GROUP_XML"' Global $sXmlQuery = "/MyNS:encapsulatedArchiveGroup/MyNS:attInstances/MyNS:attInstance/MyNS:RA_CUSTOMER_TRX_ALL/MyNS:OBT_WF_RUN_ID" $iRET = _XMLFileOpen($sXML) ConsoleWrite("$iRET = " & $iRET & @LF) $objDoc.setProperty("SelectionNamespaces", 'xmlns:MyNS=' & $sXmlNS) $aRET = _XMLGetValue($sXmlQuery) If IsArray($aRET) Then     _ArrayDisplay($aRET) Else     ConsoleWrite("Error, $aRET = " & $aRET & @LF) EndIf


;)

Edited by PsaltyDS, 30 June 2011 - 03:53 AM.

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#689 erebus

erebus

    Quod me nutrit me destruit.

  • Active Members
  • PipPipPipPipPipPip
  • 454 posts

Posted 30 June 2011 - 09:50 PM

Sorry, but I can't figure out how this UDF works. I am an experienced AU3 user, however I know almost nothing about XML. I tried to follow your examples, but there was no success. Here is my code:

#include <_XMLDomWrapper.au3> $check = _XMLFileOpen(@ScriptDir & "\ezstream\test.xml") MsgBox(0,"",$check) $value = _XMLGetValue("ezstream/url") Msgbox(0,"value",$value)


And here is my XML file:

Plain Text         
<?xml version="1.0"?> <!-- EXAMPLE: Ogg Vorbis stream from standard input WITHOUT reencoding This example streams an Ogg Vorbis stream from standard input (stdin.) Since ezstream will not be doing any reencoding, the resulting stream format (quality/bitrate, samplerate, channels) will be of the respective input stream. --> <ezstream>     <url><a href='http://localhost:8000/vorbis.ogg</url>' class='bbc_url' title='External link' rel='nofollow external'>http://localhost:8000/vorbis.ogg</url></a>     <sourcepassword>hackme</sourcepassword>     <format>VORBIS</format>     <filename>stdin</filename>         <!-- Important: For streaming from standard input, the default for continuous streaming is bad. Set <stream_once /> to 1 here to prevent ezstream from spinning endlessly when the input stream stops: -->     <stream_once>1</stream_once>         <!-- The following settings are used to describe your stream to the server. It's up to you to make sure that the bitrate/quality/samplerate/channels information matches up with your input stream files. -->     <svrinfoname>My Stream</svrinfoname>     <svrinfourl><a href='http://www.oddsock.org</svrinfourl>' class='bbc_url' title='External link' rel='nofollow external'>http://www.oddsock.org</svrinfourl></a>     <svrinfogenre>RockNRoll</svrinfogenre>     <svrinfodescription>This is a stream description</svrinfodescription>     <svrinfobitrate>96</svrinfobitrate>     <svrinfoquality>2.0</svrinfoquality>     <svrinfochannels>2</svrinfochannels>     <svrinfosamplerate>44100</svrinfosamplerate>         <!-- Allow the server to advertise the stream on a public YP directory: -->     <svrinfopublic>1</svrinfopublic> </ezstream>


Sorry but I can't read the "url" value... Any ideas?

#690 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 01 July 2011 - 02:17 AM

Didn't notice _XMLGetValue() returns and array, huh?

:)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#691 erebus

erebus

    Quod me nutrit me destruit.

  • Active Members
  • PipPipPipPipPipPip
  • 454 posts

Posted 03 July 2011 - 12:24 PM

Still no luck. Can you please test my code and see what's wrong? I can't really understand:

#include <_XMLDomWrapper.au3> #Include <Array.au3> $_chk = _XMLFileOpen("test.xml") MsgBox(0,"",$_chk) $value = _XMLGetValue("ezstream/url") _ArrayDisplay($value) MsgBox(0,"",$value[0])


Thank you in advance.

#692 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 03 July 2011 - 08:54 PM

You just needed the root "/" at the beginning of your XPath:
#include <_XMLDomWrapper.au3> #include <Array.au3> $debugging = True ; Global declared in _XMLDOMWrapper.au3 $_chk = _XMLFileOpen(@ScriptDir & "\Test1.xml") ConsoleWrite("Debug: $_chk = " & $_chk & @LF) $value = _XMLGetValue("/ezstream/url") If IsArray($value) Then     _ArrayDisplay($value) Else     ConsoleWrite("Debug: Error, $value = " & $value & @LF) EndIf


:)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#693 erebus

erebus

    Quod me nutrit me destruit.

  • Active Members
  • PipPipPipPipPipPip
  • 454 posts

Posted 04 July 2011 - 02:40 PM

Thanks a lot mate, I really appreciate it. Have a nice day :)

#694 Nurav

Nurav

    Seeker

  • Active Members
  • 34 posts

Posted 22 July 2011 - 01:45 PM

Can someone help me in parsing the following xml. The problem is that I do not have any distinguishable 'attribute' between two NODEs.
There can be any number of NODEs under Root with no attribute.

Thanks in advance.

<ROOT><br />     <NODE><br />         <Param1>1</Param1><br />         <Param2>2</Param2><br />         <Param3>3</Param3><br />     </NODE><br /> <br />     <NODE><br />         <Param1>4</Param1><br />         <Param2>5</Param2><br />         <Param3>6</Param3><br />     </NODE><br /> </ROOT>


#695 skin27

skin27

    Wayfarer

  • Active Members
  • Pip
  • 62 posts

Posted 22 July 2011 - 02:10 PM

Can someone help me in parsing the following xml. The problem is that I do not have any distinguishable 'attribute' between two NODEs.
There can be any number of NODEs under Root with no attribute.

Thanks in advance.

<ROOT><br />     <NODE><br />         <Param1>1</Param1><br />         <Param2>2</Param2><br />         <Param3>3</Param3><br />     </NODE><br /> <br />     <NODE><br />         <Param1>4</Param1><br />         <Param2>5</Param2><br />         <Param3>6</Param3><br />     </NODE><br /> </ROOT>

This seems more a xpath question than specific to the XML udf. There are several possibilities depends on your needs:

1) By content. For example: //NODE/Param1 = 4 (This returns the boolean true)
2) By node number.For example: /ROOT/NODE[2]/Param1 (This returns 4)

If the xml becomes large or very complex its better to use xslt or xquery with for example Saxon, but for most cases the XML UDF with Xpath will do the trick.

#696 sergeyWolf

sergeyWolf

    Seeker

  • Active Members
  • 39 posts

Posted 29 July 2011 - 12:00 AM

just start use wrapper and got "Variable used without being declared."

code below

AutoIt         
#Include <_XMLDomWrapper.au3> Opt ('MustDeclareVars', 1) Local $_xml_path = @DesktopDir&"\newXML.xml" Local $_node_root = "data" If Not FileExists ($_xml_path) Then     _XMLCreateFile ($_xml_path, $_node_root, True) EndIf Local $_xml_open = _XMLFileOpen ($_xml_path) _XMLCreateRootChild ("icon", "" , "") _XMLCreateRootChild ("name", "" , "") ;_XMLCreateChildNode($_node_root&"/icon","GroupNumber",$x,"") ; create children by index Local $name[3] $name[0] = "nameJone" $name[1] = "nameEmmy" $name[2] = "nameMickel" For $x = 1 to 3     _XMLCreateChildNode ($_node_root&"/icon","start", $name[$x-1], "327469283754string275462756") Next ;Local $aNames[3]=["Matthew","Abigail","Olivia"] ;For $x =1 to 3 ;_XMLCreateChildWAttr ($root&"/Group[2]", "some"&$x, "attribute", "value", "stringdata" ) ;_XMLCreateAttrib ( $root&"/Group[2]/some"&$x, "newattribute", "newvalue") ;_XMLCreateAttrib ( $root&"/Group[2]/some"&$x, "newattribute123", "newvalue") ;Next $_xml_open =0 Exit


i took "Ready example" and start play with it after one option (Opt ('MustDeclareVars', 1)) script stoped

error msg

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\__sergey\autoit\temp.au3"     _XMLCreateRootChild:icon C:\Program Files (x86)\AutoIt3\Include\_XMLDomWrapper.au3 (1671) : ==> Variable used without being declared.: $objFormat = $objDoc.createTextNode (@CR) ^ ERROR >Exit code: 1    Time: 0.359


is there quick fix? or wait new version? :)

ps: don;t want change by myself something in foreign code

Edited by sergeyWolf, 29 July 2011 - 12:19 AM.

- I want program that crack all other programs...- Let's split up, i'll search this program and you'll find crack for it. ^_^'

#697 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 30 July 2011 - 03:17 AM

Change line 1671 of the _XMLDOMWrapper.au3 file to add the "Local" keyword:
    Local $objFormat = $objDoc.createTextNode(@CR)

That should fix it.

:)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#698 sergeyWolf

sergeyWolf

    Seeker

  • Active Members
  • 39 posts

Posted 30 July 2011 - 09:40 PM

Change line 1671 of the _XMLDOMWrapper.au3 file to add the "Local" keyword:

    Local $objFormat = $objDoc.createTextNode(@CR)

That should fix it.

:)

thnx i'll try

got another question
how to get properly all atributes and their values of node?
for example we got
<?xml version="1.0"?> <data>     <item attr1="1" attr2="2" attr3="3"/> </data>

need to get all attributes of "item"
can't find necessary function to use ;)

Edited by sergeyWolf, 30 July 2011 - 09:46 PM.

- I want program that crack all other programs...- Let's split up, i'll search this program and you'll find crack for it. ^_^'

#699 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 01 August 2011 - 05:07 PM

Look at _XMLGetAllAttrib() in the UDF. It's a little strange because it modifies two ByRef arrays, and also returns the results in a single 2D array. You'd have to ask eltorro why it does both.

:)
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

#700 up2late

up2late

    Seeker

  • Active Members
  • 6 posts

Posted 09 September 2011 - 06:18 PM

Greetings. I am hoping someone can help me parse through my XML. I have reviewed the examples in this thread but still dont understand the whole attribute structures. Here is what I have so far:

Example of XML File is attached.


I am trying to capture the value of <is_hidden>false</is_hidden> as a variable from the node? control type ="ADVTEXTBOX_CTRL" where the element ID is user_id. I am suspecting I missing a whole lot in relation to nodes and such.

Here is my sample code:

#include <_XMLDomWrapper.au3>
$sXML_File = "C:\File.xml"
_XMLFileOpen($sXML_File)
If _XMLFileOpen($sXML_File) Then
$sVer = _XMLGetAttrib('./config/control/advtextbox_ctrl', 'is_hidden')
MsgBox(1, "Test", $sVer,"")
;ConsoleWrite($sVer & @LF)
EndIf



Any help would be greatly appreciated.
Thanks!

Attached Files

  • Attached File  file.xml   2.23KB   164 downloads

Edited by up2late, 09 September 2011 - 06:24 PM.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users