Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 15th, 2006, 01:28 PM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default read the contents of an XML child

The simplest things are the hardest for me. Im just getting into XML action using PHP 4.4.1 I found a lack of simple examples and posts on the web, others too advanced.

I want to:
open/read an xml document, <- this has been impossible so far
count the childs <gall> that are there,
choose a random one,
get the information <bla>this bit here</bla> from each child,
put it in a few $variables.

The XML looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<db01>
    <gall>
        <order>43</order>
        <code>40a22468c7dc1</code>
        <title>untitled</title>
        <author>David Hayward</author>
        <series>Dead Cars</series>
        <smalls>40c4e9cbc62c5.jpg</smalls>
        <larges>40c4e9cc1adbf.jpg</larges>
        <email>[email protected]</email>
    </gall>
    <gall>
        <order>10</order>
        <code>409e72d45e88d</code> ...
    </gall>
</db01>

Thanks in advance.
1MANJAPAN
 
Old January 29th, 2006, 06:34 PM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would be very happy if there was someone who finally replied to this problem !

I am facing a similar problem, where I **trying** to delete a node in the middle of similar nodes, eg trying to delete b(1) (with c2 value "Hello!":

<a>
 <b>
  <c1></c1>
  <c2></c2>
 </b>
 <b>
  <c1></c1>
  <c2>Hello!</c2>
 </b>
 <b>
  <c1></c1>
  <c2></c2>
 </b>
</a>

 
Old January 29th, 2006, 06:39 PM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Florian_mrt
 I would be very happy if there was someone who finally replied to this problem !

I am facing a similar problem, where I **trying** to delete a node in the middle of similar nodes, eg trying to delete b(1) (with c2 value "Hello!":

<a>
<b>
<c1></c1>
<c2></c2>
</b>
<b>
<c1></c1>
<c2>Hello!</c2>
</b>
<b>
<c1></c1>
<c2></c2>
</b>
</a>

I forgot to say: I am writing this in ASP, VBScript. The function I have so far is:


function f_DeleteXMLLink(v_intLink)
    dim v_strReturn
    dim o_xmlSettingsNode
    dim o_xmlRoot

    set o_xmlSettingsNode=Server.CreateObject("Microsoft.X MLDOM")

    Set o_xmlRoot = o_xmlSettingsDocument.documentElement
    set o_xmlSettingsNode=o_xmlSettingsDocument.getElement sByTagName("a/b[" & v_intLink & "]")

    Set o_xmlSettingsDocument = o_xmlSettingsDocument.removechild(o_xmlSettingsNod e.item(v_intLink))

    set o_xmlSettingsNode=nothing
    set o_xmlRoot=nothing

    f_DeleteXMLLink=v_strReturn
end function



I _bet_ no-one knows the answer.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Read child page form value on different domain davenic Javascript How-To 9 December 2nd, 2007 09:38 PM
I cant retrieve XMl child nodes jfergy Classic ASP XML 0 December 8th, 2006 10:24 PM
DTS Package, XML task. Read XML file and store it Victoria SQL Server DTS 0 July 24th, 2006 02:43 PM
delete XML node from JavaScript - not child crmpicco Javascript How-To 1 April 27th, 2006 11:42 AM
XSLT read through XML to transform another XML dendenx2 XSLT 8 July 7th, 2005 08:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.