WINAMP.COM | Forums > Developer Center > NSIS Discussion > XML plugin |
| Pages (2): « 1 [2] |
Last Thread
Next Thread
|
| Author |
|
|
JDaniels13 Junior Member
Registered: Aug 2006 |
The thing that the nsisXML has going for it is it supports XPath, including the attribute specs in the XPath query. I understand there is a Tiny XPath company to TinyXML, but the XPath functionality is not integrated into the XML plugin. |
||
|
|
|
mtyler Junior Member
Registered: Sep 2006 |
I have integrated TinyXPath with this plugin
If anyone is interested, I have integrated the TinyXPath library with this plugin. It worked like a charm the very first time (surprised the heck out of me). Here are the steps: to the top of xml.cpp (XML Plugin source file)code: 5) Add the following code block to xml.cpp: code: 6) Compile the XML Plugin source to the xml.dll file. Place the new xml.dll file in the NSIS/plugins directory (duh!) 7) Add the following code block to the XML.nsh file located in the NSIS/include directory: code: Viola! You're done. Use in your installer script and the current node gets changed to the first node matching the XPath expression. If I have time, or someone else beats me to it, iterative expression matching could easily be added by storing the XPath state (by using the xpath_processor.h rather than xpath_static.h).code: Ask if you need any help. Let me know if this helps. And thank you "Instructor" for the Xml Plugin (way better than the rest of them) |
||
|
|
|
JDaniels13 Junior Member
Registered: Aug 2006 |
Thanks for your efforts! I'm not very handy with C++ builds; could you post the resulting XML.dll here? |
||
|
|
|
mtyler Junior Member
Registered: Sep 2006 |
Here is the new xml.dll file
This site will not allow me to upload a DLL. I've zipped to see if it will accept it. You will need to modify xml.nsh according to my message.
|
||
|
|
|
mtyler Junior Member
Registered: Sep 2006 |
PLEASE NOTE: |
||
|
|
|
jeichhorn Junior Member
Registered: Jun 2005 |
I am trying to use the ${xml::GotoXPath} command added by mtyler. code: I am trying to select the element /test/c2/c3 with the content 'c2_content2'. When i use the xpath code: the element is selected as expected, but when i use code: it does not find the element (result is -1). Do i use the GotoXPath function in a wrong way in my second example? Thanks for help. Jörg |
||
|
|
|
mtyler Junior Member
Registered: Sep 2006 |
The immediate workaround for your problem is to execute after loading the document and before conducting any static XPath queries that begin with the root element. Any XPath that is based on the top level element will work, including yours.code: The way the TinyXML works is to have a node above the top level element for the document itself. From this node you can get the document name and access XML comments that are outside the scope of the top level element. The XML plugin maintains it state as the current or last node that was read. This enables you to jump around from a relative perspective. But, from a technical perspective, conducting a static XPath query from the document node will not work. I considered modifying the GotoXPath function to account for this, but I think that it will defeat the purpose of the document node. So use the workaround specified above or use the XPath query Descendant notation along with the root element (even though this is not entirely accurate; you should use xml::RootElement): code: The original GotoPath function looks for a leading slash in the path designation and moves the current node to the root element before it locates the desired element. This works well for this function because it is a simple navigation function. The TinyXPath library is a robust XPath processor that will not benefit from the same logic used by the GotoPath function. Therefore, the suggestions I made above should become the norm. As usual, I hope that this has helped. Feel free to ask for assistance. I am appreciative of all the great tools and technologies supported by this community. |
||
|
|
|
Instructor Major Dude
Registered: Jul 2004 |
Changed: Compiled statically without msvcrt.lib, now plugin work on Win95. __________________ |
||
|
|
|
rtpHarry Junior Member
Registered: Nov 2006 |
possible bug in system
I almost abandoned this plugin yesterday when I was writing my installer. Now I have found a work around for it and I think its a great plugin again! The second time I used it was in a Section (for the install files part) and it failed with -1 every time until I saw somebody suggest for a different problem to prepend $EXEDIR to the start which fixed it.
|
||
|
|
|
atul123 Junior Member
Registered: Dec 2006 |
Where can I find examples of "How to use this XML plugin?" |
||
|
|
|
niklasu Junior Member
Registered: Jan 2007 |
XPathNode and XPathAttribute
But everytime the xml:XPathAttribute statement executes the installer crashes with the following message: code: (And I get the same error when using XPathNode too...) What am I doing wrong here? |
||
|
|
|
Instructor Major Dude
Registered: Jul 2004 |
code: __________________ |
||
|
|
|
Yathosho Forum King
Registered: Jan 2002 |
could you put this on the wiki please? __________________ |
||
|
|
|
Commerzpunk Junior Member
Registered: Feb 2007 |
code: I really tried hard to get this working for me. The installer always crashed, when I tried to "InsertBeforeNode". Now, I used this code and changed it, had several hundered crashes. Here is the working result (for me): code: Messageboxes are for information and debugging only, of course! Greets, HA Last edited by Commerzpunk on 02-09-2007 at 10:14 AM |
||
|
|
|
eafonsof Junior Member
Registered: May 2007 |
Modify "value" attribute.
Hi there, I tried the following commands to modify the attribute named "value". It's not working as I expected. Does anybody know what's missing or wrong? |
||
|
|
|
Instructor Major Dude
Registered: Jul 2004 |
code: __________________ |
||
|
|
|
Instructor Major Dude
Registered: Jul 2004 |
Updated: TinyXml to v2.5.3 __________________ |
||
|
|
|
DrDan Member
Registered: Apr 2007 |
I'm working on an installer that uses this plug-in. Now, depending on the contents in my XML I need to run an external progam (in fact another NSIS uninstaller) that will read in the XML file and make changes to it. |
||
|
|
|
Wizarth Junior Member
Registered: Jul 2007 |
SizeOf
Edit: Sorry, wrong thread. |
||
|
|
|
walb07 Junior Member
Registered: Aug 2007 |
Problem to parse XML with <!DOCTYPE ... []> element
Hi, |
||
|
|
|
jogijhelumi Junior Member
Registered: Jan 2008 |
I'm trying to use XPathNode for expressions with namespace i.e. fns: Deployment |
||
|
|
|
FkYkko Junior Member
Registered: Jan 2008 |
Hi I'm wondering if the attached plugin in this thread is the latest version of this plugin? It seems to me that the include file (xml.nsh) differs from the source code regarding some functions? For example, RemoveChild seems to return an error code while the include file and documentation does not specify any variable for this method. The RemoveAllChild function is not implemented in the source but is is availible in the documentation and include file? Last edited by FkYkko on 01-29-2008 at 04:40 PM |
||
|
|
|
Instructor Major Dude
Registered: Jul 2004 |
Updated: TinyXPath to v1.3.1 __________________ |
||
|
|
|
FkYkko Junior Member
Registered: Jan 2008 |
Thanks for the quick reply. |
||
|
|
|
Tzzz Junior Member
Registered: Mar 2008 |
XML::Xxxx functions: doc to improve
Hello, |
||
|
|
|
xbarns Senior Member
Registered: Aug 2007 |
Hi all, In order to change the "<Data name="Database" type="string">C:\Program Files\Test\Database\Test.FDB</Data>" is there any other way then looping through the nodes and comparing attributes ? i am already looping through the "ConfigModule" Nodes and comparing, is there an easier way? Here is the code i have so far: Thanks for helping
|
||
|
|
|
freeDB_man Junior Member
Registered: Jan 2008 |
I tried to use this plug-in with the special build of NSIS that has a string length limitation of 8192 instead of 1024 but the plug-in is indifferent to the change and only reads 1024 chars. |
||
|
|
|
spitze Junior Member
Registered: May 2008 |
Hi all, Now i want to insert: between I tried this piece of code The Output is: but it should be: Any suggestions?? Thanx |
||
|
|
|
Instructor Major Dude
Registered: Jul 2004 |
code: __________________ |
||
|
|
|
radorl Junior Member
Registered: Dec 2008 |
I'm editing XML file which uses DDDD; notation for non-ASCII characters. I noticed that after saving of modified XML file all DDDD; characters were replaced by original two-byte UTF-8 codes. |
||
|
|
|
casioclave Junior Member
Registered: Mar 2009 |
Hi. Can U help me to change value in this stiring <value>en</value> from "en" to "ru" Last edited by casioclave on 03-20-2009 at 10:36 AM |
||
|
|
|
mattm591 Junior Member
Registered: May 2009 |
I am trying to use this plugin to get values from an XML structure. but I cannot get any others. The code I am trying uses {xml::NextAttribute} and no matter what I do I alway get -1 returned for $2 and $0 and $1 are null. I originally tried it like this to get the loop, but it doesn't work even if I only run it once. Can anyone please tell me what I'm doing wrong and how I can access these values. |
||
|
|
|
mattm591 Junior Member
Registered: May 2009 |
Ok I have managed to get it working.
|
||
|
|
|
sag47 Junior Member
Registered: Dec 2006 |
Here is a nice small example of using this plugin. In my installer header I included XML.nsh. code: Here is a sample XML file that you should extract to the temp folder ($TEMP). code: Basically what I wanted to do in the XML file above was to set text inside of the <name></name> XML node to text that is dependent on user options in my installer. Here's my NSIS code that I use to modify the above XML: Commands above explained...
Here is what my XML file looks like after being modified... code: Note: I changed XML values from my actual installer for the sake of this quick example to help get others started. So I would ignore the actual content because it has no use at all. It took only a couple of minutes of reading the documentation that came with the XML plugin for NSIS that I created the above functions. So read the documentation for a better explanation of all of the capabilities possible with this wonderful plugin. Sam Gleske Last edited by sag47 on 10-18-2009 at 10:52 PM |
||
|
|
|
ChocJunkie Member
Registered: Oct 2009 |
What's the difference between using andcode: for getting a element child? Especially, I'm interested what ${FirstChildElement} exists for, if the task can be done using ${FistChild}. A child can only be of type text or element. So that ${FirstChild} "Name" does search for a element child, doesn't it?code: Thanks ![]() CJ |
||
|
|
|
| Pages (2): « 1 [2] |
Last Thread Next Thread
|
WINAMP.COM | Forums > Developer Center > NSIS Discussion > XML plugin |
Forum Rules:
|