Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: saving xml in javascript [Thread Next] Re: saving xml in javascriptTo: NULL Date: 3/2/2007 3:28:00 PM
On Mar 2, 5:23 pm, "RickH" <passp...@windcrestsoftware.com> wrote:
> On Mar 2, 5:16 pm, "RickH" <passp...@windcrestsoftware.com> wrote:
>
>
>
>
>
> > On Mar 1, 12:07 am, unbewusst.s...@google.com.invalid (Une B=E9vue)
> > wrote:
>
> > > > > Currently when I execute this is makes no change whatsoever to th=
e xml
> > > > > file. What I expected was to open the xml doc manually and see 4 =
child
> > > > > nodes of the root instead of 3 as shown above in the xml listing.=
Any
> > > > > thoughts or ideas on what I'm doing wrong?
>
> > > It is not possible, by JavaScript policy, to save a document in the
> > > client side.
>
> > > You might ask for that using a server side script writen in php for
> > > example...
> > > --
> > > Une B=E9vue
>
> > > It is not possible, by JavaScript policy, to save a document in the
> > > client side.
>
> > This is only true if your web page is being served by a web server.
> > If the web page is a local file on a hard drive that you have rights
> > to, then the save method works. I use it all the time to write
> > browser-based applications that dont require a web server to exist on
> > the users machine. They just click a local html file fill out the
> > form and save away.- Hide quoted text -
>
> > - Show quoted text -
>
> Also, for IE I would also suggest you instantiate the DOM in this
> manner: as the class name you are using in the example will give you a
> very old version 3 of the DOM, now that the DOM is installed side-by-
> side on windows new releases, there is no longer a single clsid for
> the DOM. The function below will return the most recent version that
> the machine has installed. Also in your type of app make sure the
> async property is set to false.
>
> function getXMLDom() {
> // Please use the highest version of XML that is currently instal=
led
> on your machine
> var locXML
> try {
> locXML =3D new ActiveXObject("Msxml2.FreeThreadedDOMDocum=
ent.6.0")
> }
> catch(e) {
> try {
> locXML =3D new ActiveXObject("Msxml2.FreeThreade=
dDOMDocument.5.0")
> }
> catch(e) {
> try {
> locXML =3D new ActiveXObject("Msxml2.Fre=
eThreadedDOMDocument.4.0")
> }
> catch(e) {
> try {
> locXML =3D new ActiveXObject("Ms=
xml2.FreeThreadedDOMDocument.3.0")
> }
> catch(e) {
> try {
> locXML =3D new ActiveXObj=
ect("MSXML2.DOMDocument.6.0")
> }
> catch(e) {
> try {
> locXML =3D new A=
ctiveXObject("MSXML2.DOMDocument.5.0")
> }
> catch(e) {
> try {
> locXML =
=3D new ActiveXObject("MSXML2.DOMDocument.4.0")
> }
> catch(e) {
> try {
> =
locXML =3D new ActiveXObject("MSXML2.DOMDocument.3.0")
> }
> catch(e) {
> }
> }
> }
> }
> }
> }
> }
> }
> locXML.async =3D false
> locXML.validateOnParse =3D true;
> locXML.resolveExternals =3D true;
> locXML.setProperty("SelectionLanguage", "XPath");
> if (typeof(locXML) =3D=3D 'undefined') {
> alert('Error: you must have the XML DOM installed')
> return null
> } else {
> return locXML
> }
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
Oops, I'm finding my own bugs, the function previously posted should
end like this:
if (typeof(locXML) =3D=3D 'undefined') {
alert('Error: you must have the XML DOM installed')
return null
} else {
locXML.async =3D false
locXML.validateOnParse =3D true;
locXML.resolveExternals =3D true;
locXML.setProperty("SelectionLanguage", "XPath");
return locXML
}
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
