Hi.
Since PSVersion 3.0 I get the error "The input document has exceeded a limit set by MaxCharactersFromEntities."when loading an xml document with:
[xml]$c = gc "c:\temp\xmlfile.xml"
My XML FILE:
<?xml version="1.0" ?><!DOCTYPE Translators[<!ENTITY MODULEBASE "C:/apl/s1/DispRoot/Module"><!ENTITY JAVABIN "C:\apl\s1\jre7x64\bin"><!ENTITY IDEAS "C:/UGS/IDEAS12"><!ENTITY ORBIX "C:/ORBIX/Iona/asp/6.1/lib/"><!ENTITY PROJTRANS "d:/ProjTrans"><!ENTITY PT_JFV "_10000.1.0"><!ENTITY UGSPKG "com.teamcenter.translator.ugs."><!ENTITY WRAPPER "com.teamcenter.tstk.server.translator.ugs."><!ENTITY EAIWRAPPER "&WRAPPER;EaiTranslator">
]><Translators><!-- Configuration of the Solid Works to JT translator --><SolidWorksToJt provider="X" service="swtojt" isactive="false"
wrapperclass="&EAIWRAPPER;"><TransExecutable dir="C:/progra~1/EAI/Translators/SolidWorks" name="Swtojt.exe"/><Options><Option name="configfile" string="-z" value="D:/apps/Translators/SWtoJt/SwtoJt.config"
description="Path to the config file"/><Option name="outputdir" string="-o"
description="Full path to the output directory."/><Option name="inputpath" string=""
description="Full path to the input file."/></Options><FileExtensions><InputExtensions nitem="2"><InputExtension extension=".SLDASM"/><InputExtension extension=".SLDPRT"/></InputExtensions><OutputExtensions nitem="1"><OutputExtension extension=".jt"/></OutputExtensions></FileExtensions><Postprocess provider="X" service="previewservice"/></SolidWorksToJt><!-- Configuration of the Solid Edge to JT translator --><SolidEdgeToJt provider="X" service="setojt" isactive="false"><TransExecutable name="setranslations.bat" dir="&MODULEBASE;/Translators/setranslations"/><Options><Option name="inputpath" string="-i" description="Full path to the input file." /><Option name="vis" string="-v" value="false" description="visualization"/><Option name="clientoption" optionkey="TARGET" string="-t" value="" description="target extension"/><Option name="outputdir" string="-o" description="Full path to the output directory."/><Option name="clientoption" optionkey="TARGET_FILE" string="" value="" description="Target file name"/></Options><FileExtensions><InputExtensions nitem="5"><InputExtension extension=".par"/><InputExtension extension=".asm"/><InputExtension extension=".psm"/><InputExtension extension=".pwd"/><InputExtension extension=".dft"/></InputExtensions><OutputExtensions nitem="15"><OutputExtension extension=".jpg"/><OutputExtension extension=".jt"/><OutputExtension extension=".dwg"/><OutputExtension extension=".dxf"/><OutputExtension extension=".X_T"/><OutputExtension extension=".stp"/><OutputExtension extension=".igs"/><OutputExtension extension=".stl"/><OutputExtension extension=".emf"/><OutputExtension extension=".xgl"/><OutputExtension extension=".sat"/><OutputExtension extension=".plmxml"/><OutputExtension extension=".tif"/><OutputExtension extension=".bmp"/><OutputExtension extension=".pdf"/></OutputExtensions></FileExtensions></SolidEdgeToJt><!-- Configuration for queryscos translator --><QueryScos provider="X" service="queryscos" isactive="false"><TransExecutable name="queryscos.bat" dir="&MODULEBASE;/Translators/queryscos"/><Options><Option name="inputpath" string=""
description="Full path to the input file which will contain user input for complete dispatcher service."/><Option name="outputdir" string=""
description="Full path to the output directory."/><Option name="outputfile" string="queryscos_results.txt"
description="Name of the output file containing results."/> </Options><TransErrorStrings><TransInputStream string="ERROR"/><TransInputStream string="error"/><TransErrorStream string="ERROR"/><TransErrorStream string="error"/></TransErrorStrings><TransErrorExclStrings><TransErrorStreamExcl string="0 errors"/></TransErrorExclStrings> <FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".txt"/></OutputExtensions></FileExtensions></QueryScos><!-- Configuration for RdvContextDBDownload translator --><RdvContextDBDownload provider="X" service="rdvcontextdbdownload" isactive="false"><TransExecutable name="rdvcontextdbdownload.bat" dir="&MODULEBASE;/Translators/rdvcontextdbdownload"/> <Options><Option name="inputpath" string=""
description="Full path to the input file which will contain user input for complete dispatcher service."/><Option name="outputdir" string=""
description="Full path to the output directory."/><Option name="outputfile" string="sco_results"
description="Name of the output file containing results."/></Options><TransErrorStrings><TransInputStream string="ERROR"/><TransInputStream string="error"/><TransErrorStream string="ERROR"/><TransErrorStream string="error"/></TransErrorStrings><TransErrorExclStrings><TransErrorStreamExcl string="0 errors"/></TransErrorExclStrings><FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".plmxml"/></OutputExtensions></FileExtensions> </RdvContextDBDownload><!-- Configuration for RdvContextDBDownload translator --><RdvContextNONDBDownload provider="X" service="rdvcontextnondbdownload" isactive="false"><TransExecutable name="rdvcontextnondbdownload.bat" dir="&MODULEBASE;/Translators/rdvcontextnondbdownload"/> <Options><Option name="inputpath" string=""
description="Full path to the input file which will contain user input for complete dispatcher service."/><Option name="outputdir" string=""
description="Full path to the output directory."/><Option name="outputfile" string="sco_results"
description="Name of the output file containing results."/></Options><TransErrorStrings><TransInputStream string="ERROR"/><TransInputStream string="error"/><TransErrorStream string="ERROR"/><TransErrorStream string="error"/></TransErrorStrings><TransErrorExclStrings><TransErrorStreamExcl string="0 errors"/></TransErrorExclStrings><FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".plmxml"/></OutputExtensions></FileExtensions><!--Invoke populatefsc Translator after generation of PLMXML file"--> <Postprocess provider="X" service="populatefsc"/> </RdvContextNONDBDownload><!-- Configuration of the NX to PV Direct translator --><NxToPvDirect provider="X" service="nxtopvdirect" isactive="false" OutputNeeded="false"
wrapperclass="&WRAPPER;ugtopvdirect.UgToPvDirect"><TransExecutable name="nxtopvdirect.bat" dir="&MODULEBASE;/Translators/nxtopvdirect"/><Options><!-- Option name="" string="" value="-single_part"/ --><Option name="ConfigMapFile" string="-configmap"
value="&MODULEBASE;/Translators/nxtopvdirect/ConfigMap.properties"
description="Property file which has the Map between Client passed in
Criteria and the location of config file to be used"/><Option name="inputpath" string=""
description="Full path to the input file."/></Options><TransErrorStrings><TransInputStream string="Cannot"/><TransInputStream string="Error"/><TransInputStream string="exception"/><TransInputStream string="ERROR"/><TransErrorStream string="Errored"/><TransErrorStream string="failed"/></TransErrorStrings><!-- Postprocess provider="X" service="copyugrelstatus"/ --></NxToPvDirect><NxTransDirect provider="X" service="nxtransdirect" isactive="false" OutputNeeded="false"><TransExecutable name="nxtransdirect.bat" dir="&MODULEBASE;/Translators/nxtransdirect"/><Options><Option name="inputpath" string="-inputFile="
description="Full path to the input file."/><Option name="clientoption" optionkey="user" string="-u="
value=""
description="Specifies username for NX Translator login to Teamcenter."/><Option name="clientoption" optionkey="password" string="-p="
value=""
description="Specifies password for NX Translator login to Teamcenter."/><Option name="clientoption" optionkey="group" string="-g="
value=""
description="Specifies group for NX Translator login to Teamcenter."/><Option name="clientoption" optionkey="encrypted_password" string="-encrypt="
value="true"
description="Specifies whether or not password is encrypted for NX Translator login to Teamcenter."/><Option name="clientoption" optionkey="use_module_user" string="-autologin="
value="true"
description="Specifies whether to auto login as module user."/> <Option name="clientoption" optionkey="storeInSourceVolume" string="-storeInSourceVolume="
value="false"
description="Specifies whether to store the translated data in the same volume as source."/> <Option name="clientoption" optionkey="updateExistingVisData" string="-updateExistingVisData="
value="false"
description="Specifies whether to update existing translated data."/><Option name="clientoption" optionkey="changeOwnerToCad" string="-changeOwnerToCad="
value="false"
description="Specifies whether to change the translated data to the same owner as source."/> </Options><TransErrorStrings><TransInputStream string="Cannot"/><TransInputStream string="Error"/><TransInputStream string="exception"/><TransInputStream string="ERROR"/><TransErrorStream string="Errored"/><TransErrorStream string="failed"/></TransErrorStrings></NxTransDirect><CopyUgRelStatus provider="X" service="copyugrelstatus" isactive="false" OutputNeeded="false" wrapperclass="&WRAPPER;copyugrelstatus.CopyUgRelStatus"></CopyUgRelStatus><!-- Configuration of the UG Nx to PV translator --><NxToPv provider="X" service="nxtopv" isactive="false"><TransExecutable name="nxtopv.bat" dir="&MODULEBASE;/Translators/nxtopv"/><Options><Option name="inputpath" string=""
description="Full path to the input file."/><Option name="StructOption" string="-honour_structure" value=""
description=""/><Option name="Output_dir" string="-force_output_dir" value=""
description=""/><Option name="outputdir" string=""
description="Full path to the output directory."/><Option name="BOM_Indicator" string="-bom" value=""
description=""/><Option name="BOM_FileName" string="nxtopv.bom" value=""
description=""/></Options><FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".jt"/></OutputExtensions></FileExtensions><Postprocess provider="X" service="previewservice"/></NxToPv><!-- Configuration of the Visprint translator --><Visprint provider="X" service="visprint" isactive="false" OutputNeeded="false"><TransExecutable name="visprint.bat" dir="&MODULEBASE;/Translators/visprint"/><Options><Option name="inputpath" string="" description="Full path to the input file."/><Option name="clientoption" optionkey="PRINTER_NAME" string="" value="" description="Name of the Printer"/><Option name="clientoption" optionkey="STAMP" string="" value="" description="Watermerk to be printed"/></Options><FileExtensions><InputExtensions nitem="10"><!-- List of file extensions --><InputExtension extension=".doc"/><InputExtension extension=".xls"/><InputExtension extension=".ppt"/><InputExtension extension=".docx"/><InputExtension extension=".xlsx"/><InputExtension extension=".pptx"/><InputExtension extension=".dft"/><InputExtension extension=".prt"/><InputExtension extension=".dwg"/><InputExtension extension=".pdf"/></InputExtensions></FileExtensions></Visprint><!-- Configuration of the NX to Cgm Direct translator --><NxToCgmDirect provider="X" service="nxtocgmdirect" isactive="false" OutputNeeded="false"
wrapperclass="&WRAPPER;ugtocgmdirect.UgToCgmDirect"><TransExecutable name="nxtocgmdirect.bat" dir="&MODULEBASE;/Translators/nxtocgmdirect"/><Options><Option name="inputpath" string="-i"
description="Full path to the input file."/></Options><TransErrorStrings><TransInputStream string="Cannot"/><TransInputStream string="ERROR"/><TransInputStream string="exception"/><TransInputStream string="ERRORS"/><TransErrorStream string="Errored"/><TransErrorStream string="failed"/></TransErrorStrings></NxToCgmDirect><!-- Configuration for NX refile module --><NxRefile provider="X" service="nxrefile" isactive="false" OutputNeeded="false"><TransExecutable name="nxrefile.bat" dir="&MODULEBASE;/Translators/nxrefile"/><Options><Option name="inputpath" string=""
description="Full path to the input file."/><Option name="outputdir" string=""
description="Full path to the output directory."/><Option name="modulePath" string=""
value="&MODULEBASE;/Translators/nxrefile"
description="Dir where refile command is located"/><Option name="clientoption" optionkey="commandName" string=""
value="refilenx"
description="Refile command to launch. Do not include extension (.bat/.sh)"/><Option name="clientoption" optionkey="commandArgs" string=""
description="arguments for refile command"/></Options><FileExtensions><InputExtensions nitem="2"><InputExtension extension=".bat"/><InputExtension extension=".txt"/></InputExtensions><OutputExtensions nitem="2"><OutputExtension extension=".log"/><OutputExtension extension=".syslog"/></OutputExtensions></FileExtensions></NxRefile><!-- Configuration for NX Clone module --><NxClone provider="X" service="nxclone" isactive="false" OutputNeeded="false"><TransExecutable name="nxclone.bat" dir="&MODULEBASE;/Translators/nxclone"/><Options><Option name="modulePath" string=""
value="&MODULEBASE;/Translators/nxclone"
description="Dir where clone command is located"/><Option name="inputpath" string=""
description="Full path to the input file."/><Option name="outputdir" string=""
description="Full path to the output directory."/><Option name="clientoption" optionkey="single_part" string=""
value="no"
description="Whether to use -part or -assembly option"/><Option name="clientoption" optionkey="user" string="-user="
value=""
description="Specifies username for NX Clone login to Teamcenter."/><Option name="clientoption" optionkey="password" string="-password="
value=""
description="Specifies password for NX Clone login to Teamcenter."/><Option name="clientoption" optionkey="group" string="-group="
value=""
description="Specifies group for NX Clone login to Teamcenter."/><Option name="clientoption" optionkey="encrypted_password" string="-encrypt="
value="true"
description="Specifies whether or not password is encrypted for NX Clone login to Teamcenter."/><Option name="clientoption" optionkey="operation" string="-operation="
value="export"
description="Default is export. Other modes are not currently supported"/><Option name="clientoption" optionkey="default_naming" string="-default_naming="
value="autotranslate"
description="Default naming"/><Option name="clientoption" optionkey="default_checkout" string="-default_checkout="
value="no"
description="Checkout parts"/><Option name="clientoption" optionkey="copy_associated_files" string="-copy_associated_files="
value="no"
description="Copy Teamcenter Associated files"/><Option name="clientoption" optionkey="copy_n_s" string="-copy_n="
value="specification:yes"
description="Copy non-master datasets of ItemRevision"/><Option name="clientoption" optionkey="copy_n_m" string="-copy_n="
value="manifestation:yes"
description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_a" string="-copy_n="
value="altrep:yes"
description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_c" string="-copy_n="
value="scenario:yes"
description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_e" string="-copy_n="
value="simulation:yes"
description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_l" string="-copy_n="
value="motion:yes"
description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_r" string="-copy_n="
value="cae_solution:yes"
description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_n" string="-copy_n="
value="cae_mesh:yes"
description="Copy non-master datasets in ItemRevision"/><Option name="clientoption" optionkey="copy_n_g" string="-copy_n="
value="cae_geometry:yes"
description="Copy non-master datasets in ItemRevision"/></Options><TransErrorExclStrings><TransErrorStreamExcl string="0 errors"/></TransErrorExclStrings></NxClone><!-- Configuration for FMS Transfer --><FMSTransfer provider="X" service="fmstransfer" isactive="false"><TransExecutable name="fmstransfer.bat" dir="&MODULEBASE;/Translators/fmstransfer"/><Options><Option name="inputpath" string="-Dcom.teamcenter.fms.ts.task="
description="Full path to the input file."/><Option name="outputpath" string="-Dcom.teamcenter.fms.ts.output="
description="Full path to the output file."/></Options><FileExtensions><InputExtensions nitem="1"><InputExtension extension=".fmst"/></InputExtensions><OutputExtensions nitem="1"><OutputExtension extension=".fmstransferred"/></OutputExtensions></FileExtensions><TransErrorStrings><TransInputStream string="IgnoreErrorStrings"/><TransErrorStream string="IgnoreErrorStrings"/></TransErrorStrings></FMSTransfer><!-- Configuration for Populate FSC --><PopulateFSC provider="X" service="populatefsc" isactive="false"><TransExecutable name="populatefsc.bat" dir="&MODULEBASE;/Translators/populatefsc"/><Options><Option name="outputpath" string="-output_file="
description="Full path to the output file."/><Option name="clientoption" optionkey="Username" string="-user="
value="" description="Username of the translation task"/><Option name="clientoption" optionkey="Group" string="-group="
value="" description="Group of the translation task"/><Option name="clientoption" optionkey="FSC_TARGETS" string="-targets="
value=""
description="Target FSC Server URI that has to be loaded"/><Option name="clientoption" optionkey="SCO_UID" string="-uid="
value=""
description="UID of the Structured Context Object(SCO)"/><Option name="clientoption" optionkey="RDV_plmxml_file" string="-RDV_plmxml_file="
value=""
description="To check if it is RDV generated plmxml or simply Bomwriter PLMXML file"/></Options></PopulateFSC><!-- Configuration for Store and Forward --><StoreAndForward provider="X" service="store_and_forward" isactive="false"><TransExecutable name="store_and_forward.bat" dir="&MODULEBASE;/Translators/store_and_forward"/><Options><Option name="clientoption" optionkey="Username" string="-user="
value="" description="Username of the translation task"/><Option name="clientoption" optionkey="Group" string="-group="
value="" description="Group of the translation task"/><Option name="clientoption" optionkey="CleanupTicketsFile" string="-cleanup_tickets_file="
value=""
description="File listing cleanup fms tickets"/></Options></StoreAndForward><!-- Configuration of the Pro Engineer to DXF translator --><ProEToDxf provider="X" service="proetodxf" isactive="false"
wrapperclass="&WRAPPER;proetodxf.ProEToDxf"><!-- Start the NameService daemon --><Daemon exec="C:/apl/s1/ProE/x86e_win64/nms/nmsd.exe" args="-noservice"/><TransExecutable name="ProEWildfireDXFExe.exe" dir="&MODULEBASE;/Translators/proetodxf/"/><Options><Option name="inputpath" string="-i"
description="Full path to the input file"/><Option name="outputpath" string="-o"
description="Full path to the output file."/></Options><FileExtensions><OutputExtensions nitem="1"><OutputExtension extension=".dxf"/></OutputExtensions></FileExtensions><!--Postprocess provider="X" service="previewservice"/--></ProEToDxf><!-- Configuration of the Teamcenter Project Schedule translator --><ProjectTrans provider="X" service="projecttrans" NoOfTries="5" WaitTimeForReTries="15" isactive="false"><SysExecutable name="&JAVABIN;\java"/><Options><Option name="classpath" string="-cp" system="java.class.path" append=";&PROJTRANS;/lib/scheduling_tstk&PT_JFV;.jar;&PROJTRANS;/lib/scheduling_strong_interface&PT_JFV;.jar;&PROJTRANS;/lib/scheduling&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaClient&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaCommon&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaCoreStrong&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaCoreTypes&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaProjectManagementStrong&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaProjectManagementTypes&PT_JFV;.jar;&PROJTRANS;/lib/TcSoaStrongModel&PT_JFV;.jar;&PROJTRANS;/lib/commons-logging.jar;&PROJTRANS;/lib/commons-codec.jar;&PROJTRANS;/lib/commons-httpclient.jar;&PROJTRANS;/lib/xercesImpl.jar;&PROJTRANS;/lib/xerces.jar;&PROJTRANS;/lib/resolver.jar;&PROJTRANS;/lib/xml-apis.jar"
description="Classpath to the java virtual machine." /><Option name="classname" string=""
value="com.teamcenter.project.tstk.SchedulingTranslator"
description="Teamcenter Project Schedule Translator class."/><Option name="inputpath" string="-i"
description="Full path to the input file."/><Option name="outputdir" string="-d"
description="Full path to the output directory."/><Option name="configfile" string="-conf"
value="&PROJTRANS;/conf.properties"
description="Full path to config file."/></Options></ProjectTrans><!-- Configuration of the Teamcenter Schedule Manager translator --><SchMgrTrans provider="X" service="schmgrtrans" isactive="false"><TransExecutable dir="d:/SchMgrTrans" name="schmgrtrans.bat"/><Options><Option name="jarversionextension" string="" value="&PT_JFV;" description="Version extension for jar."/><Option description="" name="clientoption" optionkey="readFromInputTicket" string="readFromInputTicket" value=""/><Option description="" name="clientoption" optionkey="readFromOutputTicket" string="readFromOutputTicket" value=""/><Option description="" name="clientoption" optionkey="writeToOutputTicket" string="writeToOutputTicket" value=""/></Options></SchMgrTrans ></Translators>Does anyone know why?
(by the way: I managed to solve the problem with:
Function Get-XML
{
param(
[Parameter(Mandatory=$true)]
[string]$filePath
)
$fileContent = New-Object System.Xml.XmlDocument
$fileContent.XmlResolver = $null
Try {
$fileContent.Load($filePath)
}
Catch [system.exception] {
write-host "Could not open file $filePath"
}
$fileContent
})
If you found this post helpful, please "Vote as Helpful". If it answered your question, remember to "Mark as Answer"
MCC & PowerShell enthusiast
http://oliver.lipkau.net/blog