The Document Object Modeling (DOM) classes / The DomDocument class |
Load and save methods usage examples for the xml.DomDocument class.
You can load an existing xml document. Before loading an xml document you need to create the DomDocument object.
load("data.xml") load("http://www.w3schools.com/xml/cd_catalog.xml") load("https://localhost:6394/ws/r/calculator?WSDL") load("file:///data/cd_catalog.xml") load("tcp://localhost:4242/") load("tcps://localhost:4243/") load("alias://demo")where demo alias is defined in fglprofile as ws.demo.url = "http://www.w3schools.com/xml/cd_catalog.xml"
loadfromstring("<List> <elt>First element</elt> <elt>Second element</elt> <elt>Third element</elt> </List>")Produces a subtree with a root node List and three nodes elt and three textnode.
save("myfile.xml") save("http://myserver:8080/data/save1.xml") save("file:///data/save.xml") save("tcp://localhost:4242/") save("alias://test")where test alias is defined in fglprofile as ws.test.url = "http://localhost:8080/data/save3.xml"
saveToString saves the DomDocument in a string. Use getErrorsCount() and getErrorDescription() to display errors about the document saving
normalize function emulates a DomDocument save and load. It can be called at any stage of the DomDocument building. This removes empty Text nodes and sets namespace declarations as if the document had been saved.