Jump to content

XML DOM wrapper (COM)


eltorro
 Share

Recommended Posts

I was just thinking having it in the help file would help people find more readily available information about the library. It's working wonders for me as well. I was simply suggesting so it might save some time for you as you are now the expert since eltorro hasn't come back in a while. Let me know if there's anything I can do to help. I notice the API section that would be auto generated for SciTE has already been made by someone in the comments of the library. If documented the functions, I think that would suffice, and provide some samples (maybe even multiple samples) per function, I believe that would be a great service for you to save some time on this.

I hope it's helpful,

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Thanks, that did the trick! :) Since there's only one element of it I could catch it with

$search = _XMLGetValue ("//Search")
Hello,

I have the following XML (I kept the xmnls: ..... away):

<?xml version="1.0" ?>

<shadowfax:message-envelope>

<shadowfax:message>

<soap:Envelope>

<soap:Header">

<soap:Body>

<PolisWijzigingsNotificatie>

<Pakket>

<Mantel>

<Onderdeel>

</Onderdeel>

</Mantel>

</Pakket>

</PolisWijzigingsNotificatie>

</soap:Body>

</soap:Envelope>

</shadowfax:message>

</shadowfax:message-envelope>

The following statement runs ok:

ConsoleWrite(_XMLGetChildNodes("/shadowfax:message-envelope/shadowfax:message/soap:Envelope/soap:Body") & @CRLF)

But the next statement doesn't work:

ConsoleWrite(_XMLGetChildNodes("/shadowfax:message-envelope/shadowfax:message/soap:Envelope/soap:Body/PolisWijzigingsNotificatie") & @CRLF)

it says: No Matching Nodes found

Why is that?

I hope that somebody can help me :-)

Thanks,

Rodger

Link to comment
Share on other sites

You aren't being very helpful. Does <soap:Header> wrap around the entire contents of <soap:Body></soap:Body>? Also are the quotes supposed to be in <soap:Header"> because they aren't allowed there.

Like this:

<?xml version="1.0" encoding="utf-8"?>
<shadowfax:message-envelope>
  <shadowfax:message>
    <soap:Envelope>
      <soap:Header>
        <soap:Body>
          <PolisWijzigingsNotificatie>
            <Pakket>
              <Mantel>
                <Onderdeel> </Onderdeel>
              </Mantel>
            </Pakket>
          </PolisWijzigingsNotificatie>
        </soap:Body>
      </soap:Header>
    </soap:Envelope>
  </shadowfax:message>
</shadowfax:message-envelope>
Edited by weaponx
Link to comment
Share on other sites

You aren't being very helpful. Does <soap:Header> wrap around the entire contents of <soap:Body></soap:Body>? Also are the quotes supposed to be in <soap:Header"> because they aren't allowed there.

Like this:

<?xml version="1.0" encoding="utf-8"?>
<shadowfax:message-envelope>
  <shadowfax:message>
    <soap:Envelope>
      <soap:Header>
        <soap:Body>
          <PolisWijzigingsNotificatie>
            <Pakket>
              <Mantel>
                <Onderdeel> </Onderdeel>
              </Mantel>
            </Pakket>
          </PolisWijzigingsNotificatie>
        </soap:Body>
      </soap:Header>
    </soap:Envelope>
  </shadowfax:message>
</shadowfax:message-envelope>

Sorry, yes the xml is exactly how you mentioned in your reply.

Link to comment
Share on other sites

Sorry, yes the xml is exactly how you mentioned in your reply.

I can't do anything else without having the namespaces intact.

Also the main reason your original code doesn't work is because you are trying to ConsoleWrite _XMLGetChildNodes which won't work because its an array...

There was a previous question asked about SOAP xml, maybe you can figure it out yourself.

#489126

Link to comment
Share on other sites

I can't do anything else without having the namespaces intact.

Also the main reason your original code doesn't work is because you are trying to ConsoleWrite _XMLGetChildNodes which won't work because its an array...

There was a previous question asked about SOAP xml, maybe you can figure it out yourself.

#489126

The previous question asked about SOAP xml helped me out. Thanks for the referring to it. The problem why it didn't work was the xmlns part. I had xmlns = "http:\\ ......" without a namespace being mentioned. So I added a dummy one to it.

Thnks

Link to comment
Share on other sites

Hi I need help!

I have a list of Nodes that go similar to the following:

<Parent>

<Node> 16.1 164.53 534.4 </Node>

<Node> 63.2 734.3 150.1 </Node>

<Node> 11.9 452.2 21.9 </Node>

</Parent>

I need to delete only ONE of the nodes in the list, how am I to do this? _XMLDeleteNode() deletes all of them and I can't get the other delete functions to work as it always gives me an error.

Link to comment
Share on other sites

Since all of your child nodes have the same tag name you have to access them by index. The index begins at one.

_XMLDeleteNode("//Parent/Node[2]");Delete 63.2 734.3 150.1

Edited by weaponx
Link to comment
Share on other sites

  • 3 weeks later...

Add :

$bXMLAUTOSAVE = False

After:

#Include "_XMLDomWrapper.au3"

Before:

TEST1()

#Include "_XMLDomWrapper.au3"
$bXMLAUTOSAVE = False
TEST1()

The wrapper use the msxml save method to save the xml when a function has changed it.

The error is caused because the wrapper is trying to save the file. Since you used the loaded xml directly, there is no file name and that is triggering the error.

The save feature can be disabled, however, there is not a method in the wrapper to toggle the autosave feature.

Meanwhile, it can be toggled off by setting its flag to False.

$bXMLAUTOSAVE=FALSE

A check in the wrapper shall be forth coming to determine whether the xml is loaded from a file, and skip auto saving if it is not.

Edited by eltorro
Link to comment
Share on other sites

The UDF has been pretty reliable for me. I could document each function and provide examples for submission.

The last contact I had with eltorro was August 12th, 2008 and he was planning on creating a new version that allowed multiple documents to be handled simultaneously. Its a nice idea but the implementation might be ugly.

It has been awhile....

I have here: http://my-autoit.googlecode.com/files/_MSXML.au3 which allows multiple documents. When a document is opened, the object is returned. The functions require that the object be passed to them. Otherwise it should be functionally the same.

Essentially, it breaks scripts that use the old version but is a step forward providing multi-document functionality.

Several people have inquired about including this in the default install. I would like to use the version posted above instead of the current wrapper. Almost all the code base is the same at this moment. There is still work to be done. I know that the function headers work to build a chm file. I modified the help builder PaulIA left to the forum to work with other UDF's. Examples for most of the functions are still needed to round out the files needed for submission. If anyone want to contribute, I can be contacted at the email address listed in the UDF headers.

Here is a link to the preliminary chm file: http://my-autoit.googlecode.com/files/MSXML_Au3.chm

@WeaponX

I really can't express the gratitude I have for the support you have provided. Thank You! is not enough. If you would like to push this through, I would certainly appreciate it.

Link to comment
Share on other sites

eltorro, did you dee the changes I made to the _XMLTransform function? It wasn't liking XML loaded from a string. You may have updated it already.

#637081

I just saw it now. Are there any other changes? Maybe they can all be include in a session or two. If you send me what you have maybe I could "diff" them. I'd like to make the changes in the newer version as that is the one the should be sent for submission review.
Link to comment
Share on other sites

I guess 500 posts is a lot to filter through.

Edited by eltorro
Link to comment
Share on other sites

_XMLTransform has been the only problematic function for me.

This line causes problems when using an xml string and I don't really know what purpose it served otherwise:

If Not FileExists("XSLFile.xsl") Then FileWrite("XSLFile.xsl", $xslDoc.xml ())

The only other problem is the line breaks left over when deleting nodes.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

How do I speedup the function: _XMLCreateRootChild(...)

This code takes 138,29 seconds!

Thanks for your replys!

#Include <Timers.au3>
#include <_XMLDomWrapper.au3>

$XML = @ScriptDir & "\XML.xml"
$Root = "XML"

_XMLCreateFile($XML,$Root,true)
_XMLFileOpen($XML)

_XMLSetAutoSave(False)

 $starttime = _Timer_Init()
        
For $r = 1 to 10
    _XMLCreateRootChild ("Root" & $r,"RootItem","" )
    For $c1 = 1 to 10
        _XMLCreateChildNode ($Root & "/Root" & $r,"Root" & $r & "." & $c1,$r * $c1,"")
        For $c2 = 1 to 10
            _XMLCreateChildNode ($Root & "/Root" & $r & "/Root" & $r & "." & $c1,"Root" & $r & "." & $c1 & "." & $c2 ,$r * $c1 * $C2,"")
        Next
    Next
Next

MsgBox(0,"",Round(_Timer_Diff($starttime) / 1000,2))

;138,29 seconds
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...