Модераторы: Partizan, gambit
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> *.csproj файл - валидация, xml-документ 
:(
    Опции темы
_Dream
Дата 2.4.2007, 10:40 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Шустрый
*


Профиль
Группа: Участник
Сообщений: 133
Регистрация: 4.11.2006
Где: Там

Репутация: нет
Всего: нет



Привет.
я работаю с приходящими мне *.csproj файлами,  создаю xml-документ иду по нодам - и т д. Надо как-то провалидировать на то действительно ли это *.csproj файл

вот что-то нашел но не знаю то ли это



--------------------
Noone dies a virgin. Life screws us all...
PM MAIL ICQ GTalk   Вверх
mr.DUDA
Дата 2.4.2007, 13:46 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


3D-маньяк
****


Профиль
Группа: Экс. модератор
Сообщений: 8244
Регистрация: 27.7.2003
Где: город-герой Минск

Репутация: 110
Всего: 232



Цитата(_Dream @  2.4.2007,  09:40 Найти цитируемый пост)
вот что-то нашел но не знаю то ли это

то


--------------------
user posted image
PM MAIL WWW   Вверх
_Dream
Дата 2.4.2007, 17:01 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Шустрый
*


Профиль
Группа: Участник
Сообщений: 133
Регистрация: 4.11.2006
Где: Там

Репутация: нет
Всего: нет



хм.. ну я подозревал нечто такое smile
1 в 2005 другое?
2 у меня например не совпадает(вот пример 1го из *.csproj файла)
Код

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{755AA2B4-4B6B-4B55-97AA-F89054D548E9}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ResourceEditor.Gui</RootNamespace>
    <AssemblyName>ResourceEditor.Gui</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="DevExpress.Data.v6.3, Version=6.3.2.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" />
    <Reference Include="DevExpress.Utils.v6.3, Version=6.3.2.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" />
    <Reference Include="DevExpress.XtraBars.v6.3, Version=6.3.2.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" />
    <Reference Include="DevExpress.XtraEditors.v6.3, Version=6.3.2.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" />
    <Reference Include="DevExpress.XtraGrid.v6.3, Version=6.3.2.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" />
    <Reference Include="DevExpress.XtraTreeList.v6.3, Version=6.3.2.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4" />
    <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\..\Documents and Settings\XpandeR\Desktop\New Folder\log4net-1.2.10\bin\net\2.0\debug\log4net.dll</HintPath>
    </Reference>
    <Reference Include="nunit.framework, Version=2.2.9.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="DataSourceGridControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="DataSourceGridControl.Designer.cs">
      <DependentUpon>DataSourceGridControl.cs</DependentUpon>
    </Compile>
    <Compile Include="IResourceStateTabPage.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="MainForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="MainForm.Designer.cs">
      <DependentUpon>MainForm.cs</DependentUpon>
    </Compile>
    <Compile Include="ResourceDataControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="ResourceDataControl.Designer.cs">
      <DependentUpon>ResourceDataControl.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <EmbeddedResource Include="DataSourceGridControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>DataSourceGridControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="MainForm.resx">
      <SubType>Designer</SubType>
      <DependentUpon>MainForm.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="ResourceDataControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ResourceDataControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\licenses.licx" />
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="ResourceItemsNavigationControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ResourceItemsNavigationControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources.resx">
      <SubType>Designer</SubType>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
      <DesignTime>True</DesignTime>
    </Compile>
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
    <Compile Include="ResourceItemsNavigationControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="ResourceItemsNavigationControl.Designer.cs">
      <DependentUpon>ResourceItemsNavigationControl.cs</DependentUpon>
    </Compile>
    <Compile Include="Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="AfterNodeDoubleClickedEventArgs.cs" />
    <Compile Include="IDataSourceTabPage.cs">
      <SubType>Component</SubType>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\ResourceEditor.Core.csproj">
      <Project>{3DE44362-1B46-46EB-88BE-50C30A69D7B4}</Project>
      <Name>ResourceEditor.Core</Name>
    </ProjectReference>
    <ProjectReference Include="..\ResourceEditor.Common\ResourceEditor.Common.csproj">
      <Project>{4898DF78-22AF-4E7C-8767-684F3A49B887}</Project>
      <Name>ResourceEditor.Common</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\control.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\form.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\resourceFile.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\codeFile.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\solutionFile.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\projectFile.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\audioTabImage.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\filesTabImage.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\iconTabImage.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\otherTabImage.BMP" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\stringTabImage.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\imageTabImage.bmp" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
    <None Include="Resources\xmlTabImage.bmp" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


3 как мне этим воспользоватся  smile  (мне что ручками парсить и смотреть на соответствие элементов и атрибутов? smile )

спасибо
--------------------
Noone dies a virgin. Life screws us all...
PM MAIL ICQ GTalk   Вверх
mr.DUDA
Дата 3.4.2007, 08:35 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


3D-маньяк
****


Профиль
Группа: Экс. модератор
Сообщений: 8244
Регистрация: 27.7.2003
Где: город-герой Минск

Репутация: 110
Всего: 232



1 - другое
3 - если провалидировать надо, то юзай XmlTextReader с назначенной через XmlReaderSettings схемой (тот самый .xsd файлик):

Код
using System;
using System.Xml;
using System.Xml.Schema;
using System.IO;

public class Sample {

  public static void Main() {

    // Create the XmlSchemaSet class.
    XmlSchemaSet sc = new XmlSchemaSet();

    // Add the schema to the collection.
    sc.Add("urn:bookstore-schema", "books.xsd");

    // Set the validation settings.
    XmlReaderSettings settings = new XmlReaderSettings();
    settings.ValidationType = ValidationType.Schema;
    settings.Schemas = sc;
    settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
 
    // Create the XmlReader object.
    XmlReader reader = XmlReader.Create("booksSchemaFail.xml", settings);

    // Parse the file. 
    while (reader.Read());
    
  }

  // Display any validation errors.
  private static void ValidationCallBack(object sender, ValidationEventArgs e) {
    Console.WriteLine("Validation Error: {0}", e.Message);
  }
}


(пример из мсдн, там таких навалом)


--------------------
user posted image
PM MAIL WWW   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Прежде чем создать тему, посмотрите сюда:
mr.DUDA
THandle

Используйте теги [code=csharp][/code] для подсветки кода. Используйтe чекбокс "транслит" если у Вас нет русских шрифтов.
Что делать если Вам помогли, но отблагодарить помощника плюсом в репутацию Вы не можете(не хватает сообщений)? Пишите сюда, или отправляйте репорт. Поставим :)
Так же не забывайте отмечать свой вопрос решенным, если он таковым является :)


Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, mr.DUDA, THandle.

 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | Общие вопросы по .NET и C# | Следующая тема »


 




[ Время генерации скрипта: 0.2727 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.