mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-26 16:33:45 +01:00 
			
		
		
		
	* Expose TDOMWriter and TXMLWriter
git-svn-id: trunk@41662 -
This commit is contained in:
		
							parent
							
								
									2c7f278615
								
							
						
					
					
						commit
						992d945b0a
					
				
							
								
								
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							| @ -3504,6 +3504,8 @@ packages/fcl-xml/Makefile.fpc svneol=native#text/plain | |||||||
| packages/fcl-xml/Makefile.fpc.fpcmake svneol=native#text/plain | packages/fcl-xml/Makefile.fpc.fpcmake svneol=native#text/plain | ||||||
| packages/fcl-xml/buildfclxml.lpi svneol=native#text/plain | packages/fcl-xml/buildfclxml.lpi svneol=native#text/plain | ||||||
| packages/fcl-xml/buildfclxml.pp svneol=native#text/plain | packages/fcl-xml/buildfclxml.pp svneol=native#text/plain | ||||||
|  | packages/fcl-xml/examples/reducexml.lpi svneol=native#text/plain | ||||||
|  | packages/fcl-xml/examples/reducexml.pp svneol=native#text/plain | ||||||
| packages/fcl-xml/examples/test.html svneol=native#text/html | packages/fcl-xml/examples/test.html svneol=native#text/html | ||||||
| packages/fcl-xml/examples/testhtml.pp svneol=native#text/plain | packages/fcl-xml/examples/testhtml.pp svneol=native#text/plain | ||||||
| packages/fcl-xml/fpmake.pp svneol=native#text/plain | packages/fcl-xml/fpmake.pp svneol=native#text/plain | ||||||
|  | |||||||
							
								
								
									
										47
									
								
								packages/fcl-xml/examples/reducexml.lpi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								packages/fcl-xml/examples/reducexml.lpi
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,47 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <CONFIG> | ||||||
|  |   <ProjectOptions> | ||||||
|  |     <Version Value="11"/> | ||||||
|  |     <General> | ||||||
|  |       <Flags> | ||||||
|  |         <MainUnitHasCreateFormStatements Value="False"/> | ||||||
|  |         <MainUnitHasTitleStatement Value="False"/> | ||||||
|  |         <MainUnitHasScaledStatement Value="False"/> | ||||||
|  |         <UseDefaultCompilerOptions Value="True"/> | ||||||
|  |       </Flags> | ||||||
|  |       <SessionStorage Value="InProjectDir"/> | ||||||
|  |       <MainUnit Value="0"/> | ||||||
|  |       <Title Value="reducexml"/> | ||||||
|  |       <UseAppBundle Value="False"/> | ||||||
|  |       <ResourceType Value="res"/> | ||||||
|  |     </General> | ||||||
|  |     <BuildModes Count="1"> | ||||||
|  |       <Item1 Name="Default" Default="True"/> | ||||||
|  |     </BuildModes> | ||||||
|  |     <PublishOptions> | ||||||
|  |       <Version Value="2"/> | ||||||
|  |       <UseFileFilters Value="True"/> | ||||||
|  |     </PublishOptions> | ||||||
|  |     <RunParams> | ||||||
|  |       <FormatVersion Value="2"/> | ||||||
|  |       <Modes Count="0"/> | ||||||
|  |     </RunParams> | ||||||
|  |     <Units Count="1"> | ||||||
|  |       <Unit0> | ||||||
|  |         <Filename Value="reducexml.pp"/> | ||||||
|  |         <IsPartOfProject Value="True"/> | ||||||
|  |       </Unit0> | ||||||
|  |     </Units> | ||||||
|  |   </ProjectOptions> | ||||||
|  |   <CompilerOptions> | ||||||
|  |     <Version Value="11"/> | ||||||
|  |     <Target> | ||||||
|  |       <Filename Value="reducexml"/> | ||||||
|  |     </Target> | ||||||
|  |     <SearchPaths> | ||||||
|  |       <IncludeFiles Value="$(ProjOutDir)"/> | ||||||
|  |       <OtherUnitFiles Value="../src"/> | ||||||
|  |       <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> | ||||||
|  |     </SearchPaths> | ||||||
|  |   </CompilerOptions> | ||||||
|  | </CONFIG> | ||||||
							
								
								
									
										37
									
								
								packages/fcl-xml/examples/reducexml.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								packages/fcl-xml/examples/reducexml.pp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,37 @@ | |||||||
|  | program reducexml; | ||||||
|  | 
 | ||||||
|  | {$mode objfpc} | ||||||
|  | {$h+} | ||||||
|  | 
 | ||||||
|  | uses cwstring,SysUtils,classes,DOM,xmlutils,xmlread,xmlwrite; | ||||||
|  | 
 | ||||||
|  | Var | ||||||
|  |   D : TXMLDocument; | ||||||
|  |   S : TFileStream; | ||||||
|  |   W : TDOMWriter; | ||||||
|  |   FN : String; | ||||||
|  |   | ||||||
|  | 
 | ||||||
|  | begin | ||||||
|  |   if paramCount=0 then | ||||||
|  |     begin | ||||||
|  |     Writeln('Usage : reducexml infile [outfile]'); | ||||||
|  |     halt(1); | ||||||
|  |     end; | ||||||
|  |   ReadXMLFile(D,ParamStr(1)); | ||||||
|  |   FN:=ParamStr(2); | ||||||
|  |   if FN='' then | ||||||
|  |     FN:=ChangeFileExt(ParamStr(1),'-new.xml'); | ||||||
|  |   W:=nil;   | ||||||
|  |   S:=TFileStream.Create(FN,fmCreate); | ||||||
|  |   try | ||||||
|  |     W:=TDOMWriter.Create(S,D); | ||||||
|  |     W.IndentSize:=1; | ||||||
|  | //    W.Canonical:=True; | ||||||
|  |     W.UseTab:=True; | ||||||
|  |     W.WriteNode(D); | ||||||
|  |   Finally | ||||||
|  |     W.Free; | ||||||
|  |     S.Free; | ||||||
|  |   end; | ||||||
|  | end. | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user
	 michael
						michael