Skip to content

Instantly share code, notes, and snippets.

View DominicCronin's full-sized avatar
💭
Still Upskilling on Azure DevOps.

Dominic Cronin DominicCronin

💭
Still Upskilling on Azure DevOps.
View GitHub Profile
@DominicCronin
DominicCronin / ValidateXmlFile.ps1
Last active November 29, 2022 12:26
ValidateXmlFile: a powershell script for validating XML
function ValidateXmlFile {
param ([string]$xmlFile = $(read-host "Please specify the path to the Xml file"))
$xmlFile = resolve-path $xmlFile
"==============================================================="
"Validating $xmlFile using the schemas locations specified in it"
"==============================================================="
# The validating reader silently fails to catch any problems if the schema locations aren't set up properly
# So attempt to get to the right place....
pushd (Split-Path $xmlFile)
set
{
if (value == null)
{
this._guid = null;
return;
}
if (value.Length == 0)
{
this._guid = new Guid?(Guid.Empty);
for (int i = 0; i < 9999999; i++)
{
double number = null;
if( double.TryParse(bigArray[i], out number)
{
ProcessNumber(number);
}
else
{
DoSomethingElse();
for (int i = 0; i < 9999999; i++)
{
try
{
double number = double.Parse(bigArray[i]);
ProcessNumber(number);
}
catch (Exception)
{
DoSomethingElse();
# Setup
$publicationId = 20 # The publication where your content is published
# Broker database - substitute your own settings here.
$connStringBuilder = new-object System.Data.SqlClient.SqlConnectionStringBuilder
$connStringBuilder["Data Source"] = "WEB8,1433"
$connStringBuilder["Initial Catalog"] = "Tridion_Broker"
$connStringBuilder["User ID"] = "TridionBrokerUser"
$connStringBuilder["Password"] = "Tridion1"
[PresentationsByView(ViewPrefix ="ContentBlock")]
public List<IRenderableViewModel> ContentBlocks { get; set; }
@foreach (var cp in Model.ContentBlocks)
{
@Html.Render(cp)
}
public List<IRenderableViewModel> ContentBlocks {
get
{
return ComponentPresentations
.Where(cp => cp.RenderData.View == "ContentBlock")
.ToList<IRenderableViewModel>();
}
}
@foreach (var cp in Model.ComponentPresentations.Where(cp => cp.RenderData.View == "ContentBlock"))
{
@Html.Render(cp)
}
[ComponentPresentations]
public List<IRenderableViewModel> ComponentPresentations { get; set; }