Page 1 of 1
					
				Strip Namesspaces
				Posted: Mon Feb 11, 2013 9:09 am
				by Rookie
				Hello all,
	
	is it possible to strip all namespaces in an xml file when using an switchscript?
	
	Or which namespace must i register when there are namespace definitions like this:
	
	
	
	thanks in advance and best regards
	
			 
			
					
				Strip Namesspaces
				Posted: Mon Feb 11, 2013 11:04 am
				by freddyp
				var xmlFile = new Document( path to XML file );
	var defaultMap = xmlFile.createDefaultMap();
	
	Be sure to look it up in the online help for more explanation: Scripting module - Scripting reference - XML module - Document class and Metadata module - Map class.
	
	Freddy
			 
			
					
				Strip Namesspaces
				Posted: Mon Feb 11, 2013 2:40 pm
				by Rookie
				Thanks for your reply.
	
	Actually i am using this after test all avaible namespaces in the xml, and this works.
	
	var dataset = job.getDataset("Xml");
	var theXML = new Document( dataset.getPath( ) );
	var ns = theXML.createEmptyMap();
	ns.put("i" ,"
http://url.to/schemas/orderexport");
	
	ok ... i guess i must use the one in xmlns field 

 deleteng all namespaces from an xml seems to be impossible with switchscripter 

 
			
					
				Strip Namesspaces
				Posted: Mon Feb 11, 2013 10:48 pm
				by tz8
				it's impossible because you have to enable the namespaces in order to target the  element! You could simply open it as a file instead of as a document and perform a line by line string search for "", closing the file and reopening as document then, but that would be a _very_ crude hack!