Load and save methods usage examples

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.

A DomDocument can load files using different URI: http://, https://, tcp://, tcps://, file://and alias://. Use getErrorsCount() and getErrorDescription() to display errors about the document loading.
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.
A DomDocument can be saved at different URI beginning with: http://, https://, tcp://, tcps://,file:// and alias://. Use getErrorsCount() and getErrorDescription()to display errors about the document saving.
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.