Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: XML::Writer and namespaces

by Mr. Ed (Initiate)
on Dec 21, 2016 at 13:51 UTC ( [id://1178294]=note: print w/replies, xml ) Need Help??


in reply to XML::Writer and namespaces

Ok, I've find out to get the namespace-declaration in the root-element: <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

I need to set $writer->forceNSDecl($ns1); before writing the first tag

But how get I the "xsi:" - Prefix on the attribute?

Replies are listed 'Best First'.
Re^2: XML::Writer and namespaces
by Mr. Ed (Initiate) on Dec 21, 2016 at 13:59 UTC
    And finally ... here is the solution for issue 2) $writer->emptyTag("node", ([$ns1,"nil"] => "true")); makes my day: <node xsi:nil="true" />

    You have to read the perldoc very carefully, The NAMESPACES-section says:

    ... then the module will accept two-member array reference in the place of element and attribute names ...
Re^2: XML::Writer and namespaces
by Anonymous Monk on Dec 04, 2019 at 15:02 UTC
    Hi, I want to ask if there is any metho other than forceNSDecl to add namespace? in case if I want to add an attribute after the namespace?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-19 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found