Development Articles
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDevelopment Articles

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 14th, 2004, 09:18 AM
Admin Admin is offline
Developer Shed
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Posts: 961 Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level)Admin User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Article Discussion: Serializing XML With PHP

Simplify the task of creating XML documents with the XML_Serializer class, which lets you build nested XML documents from PHP data structures like arrays and objects (and vice versa). I'll show you how to build an XML document tree via the XML_Serializer class from PEAR, how to programmatically create an XML document from an array or an object, how to attach attributes to elements, and how to customize the behavior of the serializer. All this, and much, much more!


Read the full article here: Serializing XML With PHP

Reply With Quote
  #2  
Old April 18th, 2004, 04:08 PM
Iaco74 Iaco74 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 Iaco74 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi, this is my first post in this forum.
I'm italian I'm sorry for my english.
I have read this important article, I have installed PHP pear on my Local Apache server and it's working fine.

I have manually installed the xml_serializer package in my PEAR directory (because the web installer doesn't install the package that aren't "stable").

I have try to make some example but I have an error :

Code:
Notice: Array to string conversion in C:\Programmi\Apache Group\Apache2\htdocs\xml\xml_serializer\XML_Serializer-0.9.1\Serializer.php on line 492


I have try to put this code in the serialize Class
Code:
error_reporting(E_ALL & ~E_NOTICE);


The error doesn't occur but the result is incorrect
I haven't the result like a tutorials.


Can you help me to resolve this error ?

Reply With Quote
  #3  
Old April 18th, 2004, 06:53 PM
Sorvoja Sorvoja is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Oslo, Norway
Posts: 120 Sorvoja User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 36 m 48 sec
Reputation Power: 5
Hello,

It was a good read.
__________________
SEO Blog

Reply With Quote
  #4  
Old April 22nd, 2004, 12:14 PM
karassik karassik is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Oregon
Posts: 16 karassik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Options - scalarAsAttributes

I thought it was a great start to dynamically building an XML document. I was wondering if someone who has used this a bit could explain how I might use
Quote:
// represent scalar values as attributes instead of element
$serializer->setOption("scalarAsAttributes", true);

for only a part of the XML document for example:

Code:
<DOCUMENT PAGE="a4" TYPE="landscape" LEFT="40" RIGHT="20" TOP="10" BOTTOM="30">
   <DATASOURCE>
      <FIELDS>"id_clinic, gpms_clinic, legal_name_clinic"</FIELDS>
      <TABLE>"clinic_clinic INNER JOIN AR_aging ON id_clinic=idclinic_aging"</TABLE>
      <WHERE>"active_clinic=1 AND id_clinic='".vars("idclinic")."'"</WHERE>
      <GROUPBY>"gpms_clinic"</GROUPBY>
      <ORDERBY>""</ORDERBY>
   </DATASOURCE>
   <PAGEHEADER HEIGHT="0">
      <LINE X1="0" Y1="38" X2="770" Y2="+0" COLOR="00000" WIDTH="1.5" TYPE="1"/>
      <IMAGE X="5" Y="00" WIDTH="215" HEIGHT="35" SRC="LogoPDF.jpg" TYPE="jpeg"/>
   </PAGEHEADER>


The DOCUMENT tag is make of scalarAsAttributes, but the following DATASOURCE tags are regular formation? How would I define cartain parts within other parts or after other parts? IE how would I create the above code with XML_Serializer?

Thanks for your help.

Ezra

Reply With Quote
  #5  
Old May 2nd, 2004, 07:40 PM
dejaone dejaone is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 300 dejaone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 7 m 22 sec
Reputation Power: 5
I'm more confitable with Serializing XML using Java package from Sun.

Reply With Quote
  #6  
Old May 5th, 2004, 07:20 PM
mastorna mastorna is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 1 mastorna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
XML from MySQL

I've recieved the same error as mentioned previously.

Code:
PHP Notice:  Array to string conversion in name/pear/lib/XML/Serializer.php on line 496


I checked the Serializer php at that line and found this:

PHP Code:
if ((string)$tag["content"] == '') { 


it seems to check for an empty string element before creating a node of it.

Is there a fix for this?

My second issue is which writing out the file.

Is that code correct in the example to write out the file? Both print the same error. He hadn't done anything with the $result var in any of the fopen() commands, so I'm unsure if the result was actually posted to a file.

just curious on that last one....

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDevelopment Articles > Article Discussion: Serializing XML With PHP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT