Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^4: Generating elements with attributes and contents using XML::Smart

by pfaut (Priest)
on Aug 20, 2004 at 12:23 UTC ( #384584=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Generating elements with attributes and contents using XML::Smart
in thread Generating elements with attributes and contents using XML::Smart

I made these corrections to my full program and DTD and I still have a problem. If I have a 'type' element defined, then the 'type' attribute is still getting converted to a tag inside the 'phone' element.

use XML::Smart; my $xml = XML::Smart->new; $xml->{customer}{phone} = "555-1234"; $xml->{customer}{phone}{type} = "home"; $xml->apply_dtd(<<EOF); <?xml version="1.0" ?> <!DOCTYPE customer [ <!ELEMENT customer (type?,phone+)> <!ELEMENT phone (#PCDATA)> <!ATTLIST phone type CDATA #REQUIRED> <!ELEMENT type (#PCDATA)> ]> EOF print $xml->data;

This produces:

<customer> <phone> <type>home</type>555-1234</phone> </customer>
90% of every Perl application is already written.
dragonchild


Comment on Re^4: Generating elements with attributes and contents using XML::Smart
Select or Download Code
Re^5: Generating elements with attributes and contents using XML::Smart
by gmpassos (Priest) on Sep 01, 2004 at 18:34 UTC
    Fixed on XML::Smart 1.6.8! Thanks for the report.

    Graciliano M. P.
    "Creativity is the expression of the liberty".

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://384584]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2014-09-02 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls