I am trying to use XML :: Simple to update some Java applications' server.xml files . When I'm able to fix and update the object, the output from Here is an example XML: I am making a small change through Then I can output my file like this: Everything works fine and the data is good in the: Dumper, but when I look at my output, I now have XML like this: I need everything that she backs up, but despite my best efforts it did not make me so far. It is very hard to use XML :: Simple for input, but output is very close to impossible. I use. < / P> XMLout is giving me some trouble It seems that emphasizing the importance of expanding all the basic features into single elements Ignore Java applications when they start.
& lt; Server port = "9000" shutdown = "shut down" & gt; & Lt; Service name = "Catalina" & gt; & Lt; Connector port = "9002" redirection = "8443" enabled lookup = "false" protocol = "AJP / 1.3" urencoding = "UTF-8" /> & Lt; Lister classname = "org.apache.catalina.core.AprLifecycleListener" at "SSLEngine =" /> & Lt; / Services & gt; & Lt; / Server & gt;
XMLin :
$ xml- & gt; XMLin ("server.xml", ForceAre = & gt; ['Connector']); $ Server_xml- & gt; {'Port'} = $ server_port; $ Server_xml- & gt; {'Service'} - & gt; {'Connector'} - & gt; [0] - & gt; {'Port'} = $ http_port;
XMLout ($ server_xml, RootName = & gt; 'server', KeepRoot = & Gt; 0, NoAttr = & gt; 1, Output file = & gt; "server.xml");
& lt; Server & gt; & Lt; Listener & gt; & Lt; SSLEngine & gt; On & lt; / SSLEngine & gt; & Lt; ClassName & gt; Org.apache.catalina.core.AprLifecycleListener & lt; / ClassName & gt; & Lt; / Listener & gt; ...
Use XML :: Libs ML Q (); My $ parser = XML :: Libacs ML- & gt; New (); my $ doc = $ parser-> parse_file ('server.xml '$ {Server- & gt; set attribute (port = & gt; $ server_port); $ $ for my $ connector ($ server) for my $ server ($ doc-> searchnode (' / server ')) - & gt; Search Node ('service / connector [0]') {$ a Ector- & gt; Setaetivet (port = & gt; $ http_port);}} $ doc- & gt; toFile ( 'server.xml');
No comments:
Post a Comment