diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1a38d00 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true + +[*.csproj] +indent_style = space +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..7e77a3a --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..c0a5c0f --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,126 @@ +# Contributing + +## Project Scope + +The AngleSharp project ultimately tries to provide tools to parse, inspect, modify and interact with traditional web resources, such as HTML or CSS, for .NET development. Anything that is related to this goal will be considered. The project aims to be fully standards compliant. If your contribution is not following the standard, the chances of accepting it are limited. + +## Code License + +This is an open source project falling under the MIT License. By using, distributing, or contributing to this project, you accept and agree that all code within the AngleSharp project are licensed under MIT license. + +## Becoming a Contributor + +Until the project has enough contributors a BDFL model is followed. As such the sole key maintainer keeps the right to appoint GitHub members as regular project contributors. Nevertheless, usually appointing someone follows this process: + +1. An individual contributes actively via discussions (reporting bugs, giving feedback to existing or opening new issues) and / or pull requests +2. The individual is either directly asked, invited or asks for contributor rights on the project +3. The individual uses the contribution rights to sustain or increase the active contributions + +Every contributor has to sign the contributor's license agreement (CLA) to establish a legal trust between the project and its contributors. + +## Working on AngleSharp + +### Issue Discussion + +Discussion of issues should be placed transparently in the [issue tracker](https://github.com/FlorianRappl/AngleSharp/issues/) here on GitHub. + +### Modifying the code + +AngleSharp uses features from C# 6 and will soon switch to C# 7. You will therefore need a C# compiler that is up for the job. + +1. Fork and clone the repo. +2. First try to build the AngleSharp.Core libray and see if you get the tests running. +3. You will be required to resolve some dependencies via NuGet. + +AngleSharp itself does not have dependencies, however, the tests are dependent on NUnit. + +The build system of AngleSharp uses Cake. A bootstrap script (build.ps1 for Windows or build.sh for *nix systems) is included. Note, that at the moment AngleSharp requires NuGet 3.5, which looks for MSBuild pre-15, i.e., before Visual Studio 2017 on Windows systems. + +### Code Conventions + +Most parts in the AngleSharp project are fairly straight forward. Among these are: + +- Always use statement blocks for control statements, e.g., in a for-loop, if-condition, ... +- You may use a simple (throw) statement in case of enforcing contracts on argument +- Be explicit about modifiers (some files follow an older convention of the code base, but we settled on the explicit style) + +There are a couple of rules, which are definitely not standard, but highly recommended for consistency and readability: + +- AngleSharp uses the RHS convention, where types are always put on the right hand side if possible, i.e., preferring `var` under all circumstances +- A single empty line between two non-simple statements (e.g., for-loop and if-condition) should be inserted +- Types are preferred to keywords (`String` instead of `string` or `Int32` instead of `int`) + +### Development Workflow + +1. If no issue already exists for the work you'll be doing, create one to document the problem(s) being solved and self-assign. +2. Otherwise please let us know that you are working on the problem. Regular status updates (e.g. "still in progress", "no time anymore", "practically done", "pull request issued") are highly welcome. +2. Create a new branch—please don't work in the `master` branch directly. It is reserved for releases. We recommend naming the branch to match the issue being addressed (`feature-#777` or `issue-777`). +3. Add failing tests for the change you want to make. Tests are crucial and should be taken from W3C (or other specification). +4. Fix stuff. Always go from edge case to edge case. +5. All tests should pass now. Also your new implementation should not break existing tests. +6. Update the documentation to reflect any changes. (or document such changes in the original issue) +7. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `devel`. + +Just to illustrate the git workflow for AngleSharp a little bit more we've added the following graphs. + +Initially AngleSharp starts at the `master` branch. This branch should contain the latest stable (or released) version. + +![AngleSharp Initial Master](https://github.com/AngleSharp/AngleSharp/wiki/initial-master.png) + +Here we now created a new branch called `devel`. This is the development branch. + +![AngleSharp Initial Devel](https://github.com/AngleSharp/AngleSharp/wiki/initial-devel.png) + +Now active work is supposed to be done. Therefore a new branch should be created. Let's create one: + + git checkout -b feature-#777 + +There may be many of these feature branches. Most of them are also pushed to the server for discussion or synchronization. + + git push -u origin feature-#777 + +At this point the graph could look as follows. The diagram shows two feature branches in different stages. + +![AngleSharp Feature Branches](https://github.com/AngleSharp/AngleSharp/wiki/feature-branches.png) + +Now feature branches may be closed when they are done. Here we simply merge with the feature branch(es). For instance the following command takes the `feature-#777` branch from the server and merges it with the `devel` branch. + + git checkout devel + git pull + git pull origin feature-#777 + git push + +This aggregates to the graph below. + +![AngleSharp Merge Branches](https://github.com/AngleSharp/AngleSharp/wiki/feature-merges.png) + +Finally we may have all the features that are needed to release a new version of AngleSharp. Here we tag the release. For instance for the 1.0 release we use `v1.0`. + + git checkout master + git merge devel + git tag v1.0 + +Hence finally we have the full graph. + +![AngleSharp Release Git Graph](https://github.com/AngleSharp/AngleSharp/wiki/release.png) + +### Versioning + +The rules of [semver](http://semver.org/) don't necessarily apply here, but we will try to stay quite close to them. + +Prior to version 1.0.0 we use the following scheme: + +1. MINOR versions for reaching a feature milestone potentially combined with dramatic API changes +2. PATCH versions for refinements (e.g. performance improvements, bug fixes) + +After releasing version 1.0.0 the scheme changes to become: + +1. MAJOR versions at maintainers' discretion following significant changes to the codebase (e.g., API changes) +2. MINOR versions for backwards-compatible enhancements (e.g., performance improvements) +3. PATCH versions for backwards-compatible bug fixes (e.g., spec compliance bugs, support issues) + +#### Code style + +Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.** In general most of the [C# coding guidelines from Microsoft](https://msdn.microsoft.com/en-us/library/ff926074.aspx) are followed. This project prefers type inference with `var` to explicitly stating (redundant) information. + +It is also important to keep a certain `async`-flow and to always use `ConfigureAwait(false)` in conjunction with an `await` expression. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..ba9d7a1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,6 @@ +# Issue Templates + +Please use one of the following templates to create your issue: + +- [BUG REPORT](https://github.com/AngleSharp/AngleSharp.Xml/issues/new?template=bugs.md) +- [FEATURE PROPOSAL](https://github.com/AngleSharp/AngleSharp.Xml/issues/new?template=features.md) diff --git a/.github/ISSUE_TEMPLATE/bugs.md b/.github/ISSUE_TEMPLATE/bugs.md new file mode 100644 index 0000000..ab03296 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bugs.md @@ -0,0 +1,31 @@ +## Bug Report + +### Prerequisites + +- [ ] Can you reproduce the problem in a [MWE](https://en.wikipedia.org/wiki/Minimal_working_example)? +- [ ] Are you running the latest version of AngleSharp? +- [ ] Did you check the FAQs to see if that helps you? +- [ ] Are you reporting to the correct repository? (if its an issue with the core library, please report to `AngleSharp` directly) +- [ ] Did you perform a search in the issues? + +For more information, see the `CONTRIBUTING` guide. + +### Description + +[Description of the bug] + +### Steps to Reproduce + +1. [First Step] +2. [Second Step] +3. [and so on...] + +**Expected behavior:** [What you expected to happen] + +**Actual behavior:** [What actually happened] + +**Environment details:** [OS, .NET Runtime, ...] + +### Possible Solution + +[Optionally, share your idea to fix the issue] diff --git a/.github/ISSUE_TEMPLATE/features.md b/.github/ISSUE_TEMPLATE/features.md new file mode 100644 index 0000000..29cea72 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/features.md @@ -0,0 +1,13 @@ +## New Feature Proposal + +### Description + +[Description of the proposed feature] + +### Background + +Provide any additional background for the feature. e.g., user scenarios. + +### Specification + +In case of updates that adhere to specification changes, please reference the used specification. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..b20f514 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,24 @@ +## Types of Changes + +### Prerequisites + +Please make sure you can check the following two boxes: + +- [ ] I have read the **CONTRIBUTING** document +- [ ] My code follows the code style of this project + +### Contribution Type + +What types of changes does your code introduce? Put an `x` in all the boxes that apply: + +- [ ] Bug fix (non-breaking change which fixes an issue, please reference the issue id) +- [ ] New feature (non-breaking change which adds functionality, make sure to open an associated issue first) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) +- [ ] My change requires a change to the documentation +- [ ] I have updated the documentation accordingly +- [ ] I have added tests to cover my changes +- [ ] All new and existing tests passed + +### Description + +[Place a meaningful description here.] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b85a72d --- /dev/null +++ b/.gitignore @@ -0,0 +1,194 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +################ +## Rider +################ + +.idea/ + +################ +## VS Code +################ + +.vscode/ + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Rr]elease/ +[Bb]in/ +[Bb]uild/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# DNX +*.lock.json +artifacts/ + +[Dd]ebug/ +[Rr]elease/ +[Pp]ackages/ +[Tt]ools/ +![Tt]ools/packages.config +TestResults/ +*.nuget.targets +*.nuget.props +*.nupkg +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover +*.dotSettings + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1290875 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# 0.11.0 + +Planned for Friday, February 1 2019. + +- Initial release diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..319430a --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,11 @@ +# AngleSharp.Xml Contributors + +Thanks :heart: to all who contributed to AngleSharp.Xml via issues, pull requests, suggestions, and questions. + +AngleSharp.Xml contains code written by (in order of first pull request / commit): + +* [Florian Rappl](https://github.com/FlorianRappl) + +Without these awesome people AngleSharp.Xml could not exist. Thanks to everyone for your contributions! :beers: + +Missing you? Please contact us! Potentially, the simplest way is to file a PR with your name / GitHub profile link added to this file. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1de4acd --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2019 AngleSharp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..5035fca --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ +![logo](https://raw.githubusercontent.com/AngleSharp/AngleSharp.Xml/master/header.png) + +# AngleSharp.Xml + +[![Build Status](https://img.shields.io/appveyor/ci/FlorianRappl/AngleSharp-Xml.svg?style=flat-square)](https://ci.appveyor.com/project/FlorianRappl/AngleSharp-Xml) +[![GitHub Tag](https://img.shields.io/github/tag/AngleSharp/AngleSharp.Xml.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.Xml/releases) +[![NuGet Count](https://img.shields.io/nuget/dt/AngleSharp.Xml.svg?style=flat-square)](https://www.nuget.org/packages/AngleSharp.Xml/) +[![Issues Open](https://img.shields.io/github/issues/AngleSharp/AngleSharp.Xml.svg?style=flat-square)](https://github.com/AngleSharp/AngleSharp.Xml/issues) +[![StackOverflow Questions](https://img.shields.io/stackexchange/stackoverflow/t/anglesharp.svg?style=flat-square)](https://stackoverflow.com/tags/anglesharp) +[![CLA Assistant](https://cla-assistant.io/readme/badge/AngleSharp/AngleSharp.Xml?style=flat-square)](https://cla-assistant.io/AngleSharp/AngleSharp.Xml) + +AngleSharp.Xml extends the core AngleSharp library with some XML capabilities. This repository is the home of the source for the AngleSharp.Xml NuGet package. + +## Basic Configuration + +If you just want a configuration *that works* you should use the following code: + +```cs +var config = Configuration.Default + .WithXml(); // from AngleSharp.Xml +``` + +This will register a parser for XML related content. + +## Advantages of AngleSharp.Xml over System.Xml + +(tbd) + +## Features + +- Fully compliant XML parser +- XML DOM similar to HTML(5) +- DTD parser and validation check +- XML serialization + +## Participating + +Participation in the project is highly welcome. For this project the same rules as for the AngleSharp core project may be applied. + +If you have any question, concern, or spot an issue then please report it before opening a pull request. An initial discussion is appreciated regardless of the nature of the problem. + +## License + +The MIT License (MIT) + +Copyright (c) 2019 AngleSharp + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/build.cake b/build.cake new file mode 100644 index 0000000..ea5de30 --- /dev/null +++ b/build.cake @@ -0,0 +1,219 @@ +/* **************************************** + Publishing workflow + ------------------- + + - Update CHANGELOG.md + - Run a normal build with Cake + - Push to devel and FF merge to master + - Switch to master + - Run a Publish build with Cake + - Switch back to devel branch + **************************************** */ + +#addin "Cake.FileHelpers" +#addin "Octokit" +using Octokit; + +var target = Argument("target", "Default"); +var configuration = Argument("configuration", "Release"); +var isLocal = BuildSystem.IsLocalBuild; +var isRunningOnUnix = IsRunningOnUnix(); +var isRunningOnWindows = IsRunningOnWindows(); +var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor; +var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest; +var buildNumber = AppVeyor.Environment.Build.Number; +var releaseNotes = ParseReleaseNotes("./CHANGELOG.md"); +var version = releaseNotes.Version.ToString(); +var buildDir = Directory("./src/AngleSharp.Xml/bin") + Directory(configuration); +var buildResultDir = Directory("./bin") + Directory(version); +var nugetRoot = buildResultDir + Directory("nuget"); + +// Initialization +// ---------------------------------------- + +Setup(_ => +{ + Information("Building version {0} of AngleSharp.Xml.", version); + Information("For the publish target the following environment variables need to be set:"); + Information(" NUGET_API_KEY, GITHUB_API_TOKEN"); +}); + +// Tasks +// ---------------------------------------- + +Task("Clean") + .Does(() => + { + CleanDirectories(new DirectoryPath[] { buildDir, buildResultDir, nugetRoot }); + }); + +Task("Restore-Packages") + .IsDependentOn("Clean") + .Does(() => + { + NuGetRestore("./src/AngleSharp.Xml.sln", new NuGetRestoreSettings { + ToolPath = "tools/nuget.exe" + }); + }); + +Task("Build") + .IsDependentOn("Restore-Packages") + .Does(() => + { + DotNetCoreBuild("./src/AngleSharp.Xml.sln", new DotNetCoreBuildSettings() { + Configuration = configuration + }); + }); + +Task("Run-Unit-Tests") + .IsDependentOn("Build") + .Does(() => + { + var settings = new DotNetCoreTestSettings + { + Configuration = configuration + }; + + if (isRunningOnAppVeyor) + { + settings.TestAdapterPath = Directory("."); + settings.Logger = "Appveyor"; + // TODO Finds a way to exclude tests not allowed to run on appveyor + // Not used in current code + //settings.Where = "cat != ExcludeFromAppVeyor"; + } + + DotNetCoreTest("./src/AngleSharp.Xml.Tests/", settings); + }); + +Task("Copy-Files") + .IsDependentOn("Build") + .Does(() => + { + var mapping = new Dictionary + { + { "net46", "net46" }, + { "netstandard2.0", "netstandard2.0" } + }; + + if (!isRunningOnWindows) + { + mapping.Remove("net46"); + } + + foreach (var item in mapping) + { + var targetDir = nugetRoot + Directory("lib") + Directory(item.Key); + CreateDirectory(targetDir); + CopyFiles(new FilePath[] + { + buildDir + Directory(item.Value) + File("AngleSharp.Xml.dll"), + buildDir + Directory(item.Value) + File("AngleSharp.Xml.xml") + }, targetDir); + } + + CopyFiles(new FilePath[] { "src/AngleSharp.Xml.nuspec" }, nugetRoot); + }); + +Task("Create-Package") + .IsDependentOn("Copy-Files") + .Does(() => + { + var nugetExe = GetFiles("./tools/**/nuget.exe").FirstOrDefault() + ?? (isRunningOnAppVeyor ? GetFiles("C:\\Tools\\NuGet3\\nuget.exe").FirstOrDefault() : null); + + if (nugetExe == null) + { + throw new InvalidOperationException("Could not find nuget.exe."); + } + + var nuspec = nugetRoot + File("AngleSharp.Xml.nuspec"); + + NuGetPack(nuspec, new NuGetPackSettings + { + Version = version, + OutputDirectory = nugetRoot, + Symbols = false, + Properties = new Dictionary { { "Configuration", configuration } } + }); + }); + +Task("Publish-Package") + .IsDependentOn("Create-Package") + .WithCriteria(() => isLocal) + .Does(() => + { + var apiKey = EnvironmentVariable("NUGET_API_KEY"); + + if (String.IsNullOrEmpty(apiKey)) + { + throw new InvalidOperationException("Could not resolve the NuGet API key."); + } + + foreach (var nupkg in GetFiles(nugetRoot.Path.FullPath + "/*.nupkg")) + { + NuGetPush(nupkg, new NuGetPushSettings + { + Source = "https://nuget.org/api/v2/package", + ApiKey = apiKey + }); + } + }); + +Task("Publish-Release") + .IsDependentOn("Publish-Package") + .WithCriteria(() => isLocal) + .Does(() => + { + var githubToken = EnvironmentVariable("GITHUB_API_TOKEN"); + + if (String.IsNullOrEmpty(githubToken)) + { + throw new InvalidOperationException("Could not resolve AngleSharp GitHub token."); + } + + var github = new GitHubClient(new ProductHeaderValue("AngleSharpCakeBuild")) + { + Credentials = new Credentials(githubToken) + }; + + var newRelease = github.Repository.Release; + newRelease.Create("AngleSharp", "AngleSharp.Xml", new NewRelease("v" + version) + { + Name = version, + Body = String.Join(Environment.NewLine, releaseNotes.Notes), + Prerelease = false, + TargetCommitish = "master" + }).Wait(); + }); + +Task("Update-AppVeyor-Build-Number") + .WithCriteria(() => isRunningOnAppVeyor) + .Does(() => + { + var num = AppVeyor.Environment.Build.Number; + AppVeyor.UpdateBuildVersion($"{version}-{num}"); + }); + +// Targets +// ---------------------------------------- + +Task("Package") + .IsDependentOn("Run-Unit-Tests") + .IsDependentOn("Create-Package"); + +Task("Default") + .IsDependentOn("Package"); + +Task("Publish") + .IsDependentOn("Publish-Package") + .IsDependentOn("Publish-Release"); + +Task("AppVeyor") + .IsDependentOn("Run-Unit-Tests") + .IsDependentOn("Update-AppVeyor-Build-Number"); + +// Execution +// ---------------------------------------- + +RunTarget(target); \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..61a9f11 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,81 @@ +Param( + [string]$Script = "build.cake", + [string]$Target = "Default", + [ValidateSet("Release", "Debug")] + [string]$Configuration = "Release", + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity = "Verbose", + [switch]$Experimental, + [switch]$WhatIf, + [switch]$Mono, + [switch]$SkipToolPackageRestore, + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$ScriptArgs +) + +$PSScriptRoot = split-path -parent $MyInvocation.MyCommand.Definition; +$UseDryRun = ""; +$UseMono = ""; +$TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" +$NUGET_OLD_EXE = Join-Path $TOOLS_DIR "nuget_old.exe" +$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" +$NUGET_OLD_URL = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe" + +# Should we use experimental build of Roslyn? +$UseExperimental = ""; +if ($Experimental.IsPresent) { + $UseExperimental = "-experimental" +} + +# Is this a dry run? +if ($WhatIf.IsPresent) { + $UseDryRun = "-dryrun" +} + +# Should we use mono? +if ($Mono.IsPresent) { + $UseMono = "-mono" +} + +# Try download NuGet.exe if do not exist. +if (!(Test-Path $NUGET_EXE)) { + (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) +} + +# Try download NuGet.exe if do not exist. +if (!(Test-Path $NUGET_OLD_URL)) { + (New-Object System.Net.WebClient).DownloadFile($NUGET_OLD_URL, $NUGET_OLD_EXE) +} + +# Make sure NuGet (latest) exists where we expect it. +if (!(Test-Path $NUGET_EXE)) { + Throw "Could not find nuget.exe" +} + +# Make sure NuGet (v3.5.0) exists where we expect it. +if (!(Test-Path $NUGET_OLD_EXE)) { + Throw "Could not find nuget_old.exe" +} + +# Restore tools from NuGet? +if (-Not $SkipToolPackageRestore.IsPresent) +{ + Push-Location + Set-Location $TOOLS_DIR + Invoke-Expression "$NUGET_EXE install -ExcludeVersion" + Pop-Location + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } +} + +# Make sure that Cake has been installed. +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe" +} + +# Start Cake +Invoke-Expression "$CAKE_EXE `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" +exit $LASTEXITCODE \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..41923b4 --- /dev/null +++ b/build.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +############################################################### +# This is the Cake bootstrapper script that is responsible for +# downloading Cake and all specified tools from NuGet. +############################################################### + +# Define directories. +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +NUGET_EXE=$TOOLS_DIR/nuget.exe +NUGET_OLD_EXE=$TOOLS_DIR/nuget_old.exe +CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe + +# Define default arguments. +SCRIPT="build.cake" +TARGET="Default" +CONFIGURATION="Release" +VERBOSITY="verbose" +DRYRUN= +SHOW_VERSION=false +SCRIPT_ARGUMENTS=() + +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + -t|--target) TARGET="$2"; shift ;; + -c|--configuration) CONFIGURATION="$2"; shift ;; + -v|--verbosity) VERBOSITY="$2"; shift ;; + -d|--dryrun) DRYRUN="-dryrun" ;; + --version) SHOW_VERSION=true ;; + --) shift; SCRIPT_ARGUMENTS+=("$@"); break ;; + *) SCRIPT_ARGUMENTS+=("$1") ;; + esac + shift +done + +# Make sure the tools folder exist. +if [ ! -d $TOOLS_DIR ]; then + mkdir $TOOLS_DIR +fi + +# Make sure that packages.config exist. +if [ ! -f $TOOLS_DIR/packages.config ]; then + echo "Downloading packages.config..." + curl -Lsfo $TOOLS_DIR/packages.config http://cakebuild.net/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occured while downloading packages.config." + exit 1 + fi +fi + +# Download NuGet (v3.5.0) if it does not exist. +if [ ! -f $NUGET_OLD_EXE ]; then + echo "Downloading NuGet..." + curl -Lsfo $NUGET_OLD_EXE https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occured while downloading nuget.exe." + exit 1 + fi +fi + +# Download NuGet (latest) if it does not exist. +if [ ! -f $NUGET_EXE ]; then + echo "Downloading NuGet..." + curl -Lsfo $NUGET_EXE https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occured while downloading nuget.exe." + exit 1 + fi +fi + +# Restore tools from NuGet. +pushd $TOOLS_DIR >/dev/null +mono $NUGET_EXE install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet packages." + exit 1 +fi +popd >/dev/null + +# Make sure that Cake has been installed. +if [ ! -f $CAKE_EXE ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 +fi + +# Start Cake +if $SHOW_VERSION; then + exec mono $CAKE_EXE -version +else + exec mono $CAKE_EXE $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" +fi \ No newline at end of file diff --git a/header.png b/header.png new file mode 100644 index 0000000..73e22f8 Binary files /dev/null and b/header.png differ diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..5f9da94 Binary files /dev/null and b/logo.png differ diff --git a/src/AngleSharp.Xml.Tests/AngleSharp.Xml.Tests.csproj b/src/AngleSharp.Xml.Tests/AngleSharp.Xml.Tests.csproj new file mode 100644 index 0000000..241d7af --- /dev/null +++ b/src/AngleSharp.Xml.Tests/AngleSharp.Xml.Tests.csproj @@ -0,0 +1,22 @@ + + + netcoreapp2.1 + true + Key.snk + false + + + + + netstandard2.0 + + + + + + + + + + + \ No newline at end of file diff --git a/src/AngleSharp.Xml.Tests/DTDTree.cs b/src/AngleSharp.Xml.Tests/DTDTree.cs new file mode 100644 index 0000000..966ca0d --- /dev/null +++ b/src/AngleSharp.Xml.Tests/DTDTree.cs @@ -0,0 +1,43 @@ +using AngleSharp.DTD; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; + +namespace UnitTests +{ + /// + /// Some examples taken from + /// http://xmlwriter.net/xml_guide/doctype_declaration.shtml. + /// + [TestClass] + public class DTDTree + { + [TestMethod] + public void SubjectsDtd() + { + var dtd = @" + + + + + + + + + + + +"; + + var parser = new DtdParser(dtd); + parser.Parse(); + + var result = parser.Result; + Assert.AreEqual(12, result.Count); + Assert.AreEqual(1, result.Attributes.Count()); + Assert.AreEqual(11, result.Elements.Count()); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Dom/XmlSamples.cs b/src/AngleSharp.Xml.Tests/Dom/XmlSamples.cs new file mode 100644 index 0000000..51222f2 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Dom/XmlSamples.cs @@ -0,0 +1,4839 @@ +namespace AngleSharp.Core.Tests.Xml +{ + using AngleSharp.Dom; + using NUnit.Framework; + using System.Linq; + + /// + /// Parsing the sample XML files taken from + /// http://msdn.microsoft.com/en-us/library/bb387026.aspx + /// Additional (maybe): + /// http://tantek.com/XHTML/Test/minimal.html + /// + [TestFixture] + public class XmlSamples + { + [Test] + public void XmlTypicalPurchaseOrder() + { + var document = (@" + +
+ Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA +
+
+ Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA +
+ Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + +
").ToXmlDocument(); + + var documentPurchaseOrder1 = document.ChildNodes[0] as IElement; + Assert.AreEqual(9, documentPurchaseOrder1.ChildNodes.Length); + Assert.AreEqual(2, documentPurchaseOrder1.Attributes.Count()); + Assert.AreEqual("PurchaseOrder", documentPurchaseOrder1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1.NodeType); + Assert.IsNotNull(documentPurchaseOrder1.GetAttribute("PurchaseOrderNumber")); + Assert.AreEqual("99503", documentPurchaseOrder1.GetAttribute("PurchaseOrderNumber")); + Assert.AreEqual("1999-10-20", documentPurchaseOrder1.GetAttribute("OrderDate")); + + var documentPurchaseOrder1Text0 = documentPurchaseOrder1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Text0.TextContent); + + var documentPurchaseOrder1Address1 = documentPurchaseOrder1.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentPurchaseOrder1Address1.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrder1Address1.Attributes.Count()); + Assert.AreEqual("Address", documentPurchaseOrder1Address1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address1.NodeType); + Assert.AreEqual("Shipping", documentPurchaseOrder1Address1.GetAttribute("Type")); + + var documentPurchaseOrder1Address1Text0 = documentPurchaseOrder1Address1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address1Text0.TextContent); + + var documentPurchaseOrder1Address1Name1 = documentPurchaseOrder1Address1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address1Name1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address1Name1.Attributes.Count()); + Assert.AreEqual("Name", documentPurchaseOrder1Address1Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address1Name1.NodeType); + + var documentPurchaseOrder1Address1Name1Text0 = documentPurchaseOrder1Address1Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Name1Text0.NodeType); + Assert.AreEqual("Ellen Adams", documentPurchaseOrder1Address1Name1Text0.TextContent); + + var documentPurchaseOrder1Address1Text2 = documentPurchaseOrder1Address1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address1Text2.TextContent); + + var documentPurchaseOrder1Address1Street3 = documentPurchaseOrder1Address1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address1Street3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address1Street3.Attributes.Count()); + Assert.AreEqual("Street", documentPurchaseOrder1Address1Street3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address1Street3.NodeType); + + var documentPurchaseOrder1Address1Street3Text0 = documentPurchaseOrder1Address1Street3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Street3Text0.NodeType); + Assert.AreEqual("123 Maple Street", documentPurchaseOrder1Address1Street3Text0.TextContent); + + var documentPurchaseOrder1Address1Text4 = documentPurchaseOrder1Address1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address1Text4.TextContent); + + var documentPurchaseOrder1Address1City5 = documentPurchaseOrder1Address1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address1City5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address1City5.Attributes.Count()); + Assert.AreEqual("City", documentPurchaseOrder1Address1City5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address1City5.NodeType); + + var documentPurchaseOrder1Address1City5Text0 = documentPurchaseOrder1Address1City5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1City5Text0.NodeType); + Assert.AreEqual("Mill Valley", documentPurchaseOrder1Address1City5Text0.TextContent); + + var documentPurchaseOrder1Address1Text6 = documentPurchaseOrder1Address1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address1Text6.TextContent); + + var documentPurchaseOrder1Address1State7 = documentPurchaseOrder1Address1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address1State7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address1State7.Attributes.Count()); + Assert.AreEqual("State", documentPurchaseOrder1Address1State7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address1State7.NodeType); + + var documentPurchaseOrder1Address1State7Text0 = documentPurchaseOrder1Address1State7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1State7Text0.NodeType); + Assert.AreEqual("CA", documentPurchaseOrder1Address1State7Text0.TextContent); + + var documentPurchaseOrder1Address1Text8 = documentPurchaseOrder1Address1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address1Text8.TextContent); + + var documentPurchaseOrder1Address1Zip9 = documentPurchaseOrder1Address1.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address1Zip9.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address1Zip9.Attributes.Count()); + Assert.AreEqual("Zip", documentPurchaseOrder1Address1Zip9.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address1Zip9.NodeType); + + var documentPurchaseOrder1Address1Zip9Text0 = documentPurchaseOrder1Address1Zip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Zip9Text0.NodeType); + Assert.AreEqual("10999", documentPurchaseOrder1Address1Zip9Text0.TextContent); + + var documentPurchaseOrder1Address1Text10 = documentPurchaseOrder1Address1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Text10.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address1Text10.TextContent); + + var documentPurchaseOrder1Address1Country11 = documentPurchaseOrder1Address1.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address1Country11.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address1Country11.Attributes.Count()); + Assert.AreEqual("Country", documentPurchaseOrder1Address1Country11.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address1Country11.NodeType); + + var documentPurchaseOrder1Address1Country11Text0 = documentPurchaseOrder1Address1Country11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Country11Text0.NodeType); + Assert.AreEqual("USA", documentPurchaseOrder1Address1Country11Text0.TextContent); + + var documentPurchaseOrder1Address1Text12 = documentPurchaseOrder1Address1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address1Text12.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address1Text12.TextContent); + + var documentPurchaseOrder1Text2 = documentPurchaseOrder1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Text2.TextContent); + + var documentPurchaseOrder1Address3 = documentPurchaseOrder1.ChildNodes[3] as IElement; + Assert.AreEqual(13, documentPurchaseOrder1Address3.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrder1Address3.Attributes.Count()); + Assert.AreEqual("Address", documentPurchaseOrder1Address3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address3.NodeType); + Assert.AreEqual("Billing", documentPurchaseOrder1Address3.GetAttribute("Type")); + + var documentPurchaseOrder1Address3Text0 = documentPurchaseOrder1Address3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address3Text0.TextContent); + + var documentPurchaseOrder1Address3Name1 = documentPurchaseOrder1Address3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address3Name1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address3Name1.Attributes.Count()); + Assert.AreEqual("Name", documentPurchaseOrder1Address3Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address3Name1.NodeType); + + var documentPurchaseOrder1Address3Name1Text0 = documentPurchaseOrder1Address3Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Name1Text0.NodeType); + Assert.AreEqual("Tai Yee", documentPurchaseOrder1Address3Name1Text0.TextContent); + + var documentPurchaseOrder1Address3Text2 = documentPurchaseOrder1Address3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address3Text2.TextContent); + + var documentPurchaseOrder1Address3Street3 = documentPurchaseOrder1Address3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address3Street3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address3Street3.Attributes.Count()); + Assert.AreEqual("Street", documentPurchaseOrder1Address3Street3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address3Street3.NodeType); + + var documentPurchaseOrder1Address3Street3Text0 = documentPurchaseOrder1Address3Street3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Street3Text0.NodeType); + Assert.AreEqual("8 Oak Avenue", documentPurchaseOrder1Address3Street3Text0.TextContent); + + var documentPurchaseOrder1Address3Text4 = documentPurchaseOrder1Address3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address3Text4.TextContent); + + var documentPurchaseOrder1Address3City5 = documentPurchaseOrder1Address3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address3City5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address3City5.Attributes.Count()); + Assert.AreEqual("City", documentPurchaseOrder1Address3City5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address3City5.NodeType); + + var documentPurchaseOrder1Address3City5Text0 = documentPurchaseOrder1Address3City5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3City5Text0.NodeType); + Assert.AreEqual("Old Town", documentPurchaseOrder1Address3City5Text0.TextContent); + + var documentPurchaseOrder1Address3Text6 = documentPurchaseOrder1Address3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address3Text6.TextContent); + + var documentPurchaseOrder1Address3State7 = documentPurchaseOrder1Address3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address3State7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address3State7.Attributes.Count()); + Assert.AreEqual("State", documentPurchaseOrder1Address3State7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address3State7.NodeType); + + var documentPurchaseOrder1Address3State7Text0 = documentPurchaseOrder1Address3State7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3State7Text0.NodeType); + Assert.AreEqual("PA", documentPurchaseOrder1Address3State7Text0.TextContent); + + var documentPurchaseOrder1Address3Text8 = documentPurchaseOrder1Address3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address3Text8.TextContent); + + var documentPurchaseOrder1Address3Zip9 = documentPurchaseOrder1Address3.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address3Zip9.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address3Zip9.Attributes.Count()); + Assert.AreEqual("Zip", documentPurchaseOrder1Address3Zip9.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address3Zip9.NodeType); + + var documentPurchaseOrder1Address3Zip9Text0 = documentPurchaseOrder1Address3Zip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Zip9Text0.NodeType); + Assert.AreEqual("95819", documentPurchaseOrder1Address3Zip9Text0.TextContent); + + var documentPurchaseOrder1Address3Text10 = documentPurchaseOrder1Address3.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Text10.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address3Text10.TextContent); + + var documentPurchaseOrder1Address3Country11 = documentPurchaseOrder1Address3.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Address3Country11.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Address3Country11.Attributes.Count()); + Assert.AreEqual("Country", documentPurchaseOrder1Address3Country11.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Address3Country11.NodeType); + + var documentPurchaseOrder1Address3Country11Text0 = documentPurchaseOrder1Address3Country11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Country11Text0.NodeType); + Assert.AreEqual("USA", documentPurchaseOrder1Address3Country11Text0.TextContent); + + var documentPurchaseOrder1Address3Text12 = documentPurchaseOrder1Address3.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Address3Text12.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Address3Text12.TextContent); + + var documentPurchaseOrder1Text4 = documentPurchaseOrder1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Text4.TextContent); + + var documentPurchaseOrder1DeliveryNotes5 = documentPurchaseOrder1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1DeliveryNotes5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1DeliveryNotes5.Attributes.Count()); + Assert.AreEqual("DeliveryNotes", documentPurchaseOrder1DeliveryNotes5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1DeliveryNotes5.NodeType); + + var documentPurchaseOrder1DeliveryNotes5Text0 = documentPurchaseOrder1DeliveryNotes5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1DeliveryNotes5Text0.NodeType); + Assert.AreEqual("Please leave packages in shed by driveway.", documentPurchaseOrder1DeliveryNotes5Text0.TextContent); + + var documentPurchaseOrder1Text6 = documentPurchaseOrder1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Text6.TextContent); + + var documentPurchaseOrder1Items7 = documentPurchaseOrder1.ChildNodes[7] as IElement; + Assert.AreEqual(5, documentPurchaseOrder1Items7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7.Attributes.Count()); + Assert.AreEqual("Items", documentPurchaseOrder1Items7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7.NodeType); + + var documentPurchaseOrder1Items7Text0 = documentPurchaseOrder1Items7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Text0.TextContent); + + var documentPurchaseOrder1Items7Item1 = documentPurchaseOrder1Items7.ChildNodes[1] as IElement; + Assert.AreEqual(9, documentPurchaseOrder1Items7Item1.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrder1Items7Item1.Attributes.Count()); + Assert.AreEqual("Item", documentPurchaseOrder1Items7Item1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item1.NodeType); + Assert.AreEqual("872-AA", documentPurchaseOrder1Items7Item1.GetAttribute("PartNumber")); + + var documentPurchaseOrder1Items7Item1Text0 = documentPurchaseOrder1Items7Item1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item1Text0.TextContent); + + var documentPurchaseOrder1Items7Item1ProductName1 = documentPurchaseOrder1Items7Item1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Items7Item1ProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7Item1ProductName1.Attributes.Count()); + Assert.AreEqual("ProductName", documentPurchaseOrder1Items7Item1ProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item1ProductName1.NodeType); + + var documentPurchaseOrder1Items7Item1ProductName1Text0 = documentPurchaseOrder1Items7Item1ProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1ProductName1Text0.NodeType); + Assert.AreEqual("Lawnmower", documentPurchaseOrder1Items7Item1ProductName1Text0.TextContent); + + var documentPurchaseOrder1Items7Item1Text2 = documentPurchaseOrder1Items7Item1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item1Text2.TextContent); + + var documentPurchaseOrder1Items7Item1Quantity3 = documentPurchaseOrder1Items7Item1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Items7Item1Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7Item1Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentPurchaseOrder1Items7Item1Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item1Quantity3.NodeType); + + var documentPurchaseOrder1Items7Item1Quantity3Text0 = documentPurchaseOrder1Items7Item1Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1Quantity3Text0.NodeType); + Assert.AreEqual("1", documentPurchaseOrder1Items7Item1Quantity3Text0.TextContent); + + var documentPurchaseOrder1Items7Item1Text4 = documentPurchaseOrder1Items7Item1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item1Text4.TextContent); + + var documentPurchaseOrder1Items7Item1USPrice5 = documentPurchaseOrder1Items7Item1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Items7Item1USPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7Item1USPrice5.Attributes.Count()); + Assert.AreEqual("USPrice", documentPurchaseOrder1Items7Item1USPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item1USPrice5.NodeType); + + var documentPurchaseOrder1Items7Item1USPrice5Text0 = documentPurchaseOrder1Items7Item1USPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1USPrice5Text0.NodeType); + Assert.AreEqual("148.95", documentPurchaseOrder1Items7Item1USPrice5Text0.TextContent); + + var documentPurchaseOrder1Items7Item1Text6 = documentPurchaseOrder1Items7Item1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item1Text6.TextContent); + + var documentPurchaseOrder1Items7Item1Comment7 = documentPurchaseOrder1Items7Item1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Items7Item1Comment7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7Item1Comment7.Attributes.Count()); + Assert.AreEqual("Comment", documentPurchaseOrder1Items7Item1Comment7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item1Comment7.NodeType); + + var documentPurchaseOrder1Items7Item1Comment7Text0 = documentPurchaseOrder1Items7Item1Comment7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1Comment7Text0.NodeType); + Assert.AreEqual("Confirm this is electric", documentPurchaseOrder1Items7Item1Comment7Text0.TextContent); + + var documentPurchaseOrder1Items7Item1Text8 = documentPurchaseOrder1Items7Item1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item1Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item1Text8.TextContent); + + var documentPurchaseOrder1Items7Text2 = documentPurchaseOrder1Items7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Text2.TextContent); + + var documentPurchaseOrder1Items7Item3 = documentPurchaseOrder1Items7.ChildNodes[3] as IElement; + Assert.AreEqual(9, documentPurchaseOrder1Items7Item3.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrder1Items7Item3.Attributes.Count()); + Assert.AreEqual("Item", documentPurchaseOrder1Items7Item3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item3.NodeType); + Assert.IsNotNull(documentPurchaseOrder1Items7Item3.GetAttribute("PartNumber")); + Assert.AreEqual("926-AA", documentPurchaseOrder1Items7Item3.GetAttribute("PartNumber")); + + var documentPurchaseOrder1Items7Item3Text0 = documentPurchaseOrder1Items7Item3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item3Text0.TextContent); + + var documentPurchaseOrder1Items7Item3ProductName1 = documentPurchaseOrder1Items7Item3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Items7Item3ProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7Item3ProductName1.Attributes.Count()); + Assert.AreEqual("ProductName", documentPurchaseOrder1Items7Item3ProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item3ProductName1.NodeType); + + var documentPurchaseOrder1Items7Item3ProductName1Text0 = documentPurchaseOrder1Items7Item3ProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3ProductName1Text0.NodeType); + Assert.AreEqual("Baby Monitor", documentPurchaseOrder1Items7Item3ProductName1Text0.TextContent); + + var documentPurchaseOrder1Items7Item3Text2 = documentPurchaseOrder1Items7Item3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item3Text2.TextContent); + + var documentPurchaseOrder1Items7Item3Quantity3 = documentPurchaseOrder1Items7Item3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Items7Item3Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7Item3Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentPurchaseOrder1Items7Item3Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item3Quantity3.NodeType); + + var documentPurchaseOrder1Items7Item3Quantity3Text0 = documentPurchaseOrder1Items7Item3Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3Quantity3Text0.NodeType); + Assert.AreEqual("2", documentPurchaseOrder1Items7Item3Quantity3Text0.TextContent); + + var documentPurchaseOrder1Items7Item3Text4 = documentPurchaseOrder1Items7Item3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item3Text4.TextContent); + + var documentPurchaseOrder1Items7Item3USPrice5 = documentPurchaseOrder1Items7Item3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Items7Item3USPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7Item3USPrice5.Attributes.Count()); + Assert.AreEqual("USPrice", documentPurchaseOrder1Items7Item3USPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item3USPrice5.NodeType); + + var documentPurchaseOrder1Items7Item3USPrice5Text0 = documentPurchaseOrder1Items7Item3USPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3USPrice5Text0.NodeType); + Assert.AreEqual("39.98", documentPurchaseOrder1Items7Item3USPrice5Text0.TextContent); + + var documentPurchaseOrder1Items7Item3Text6 = documentPurchaseOrder1Items7Item3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item3Text6.TextContent); + + var documentPurchaseOrder1Items7Item3ShipDate7 = documentPurchaseOrder1Items7Item3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrder1Items7Item3ShipDate7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrder1Items7Item3ShipDate7.Attributes.Count()); + Assert.AreEqual("ShipDate", documentPurchaseOrder1Items7Item3ShipDate7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrder1Items7Item3ShipDate7.NodeType); + + var documentPurchaseOrder1Items7Item3ShipDate7Text0 = documentPurchaseOrder1Items7Item3ShipDate7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3ShipDate7Text0.NodeType); + Assert.AreEqual("1999-05-21", documentPurchaseOrder1Items7Item3ShipDate7Text0.TextContent); + + var documentPurchaseOrder1Items7Item3Text8 = documentPurchaseOrder1Items7Item3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Item3Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Item3Text8.TextContent); + + var documentPurchaseOrder1Items7Text4 = documentPurchaseOrder1Items7.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Items7Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrder1Items7Text4.TextContent); + + var documentPurchaseOrder1Text8 = documentPurchaseOrder1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrder1Text8.NodeType); + Assert.AreEqual("\n", documentPurchaseOrder1Text8.TextContent); + } + + [Test] + public void XmlTypicalPurchaseOrderInNamespace() + { + var document = (@" + + + Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA + + + Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA + + Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + +").ToXmlDocument(); + + var documentawPurchaseOrder0 = document.ChildNodes[0] as IElement; + Assert.AreEqual(9, documentawPurchaseOrder0.ChildNodes.Length); + Assert.AreEqual(3, documentawPurchaseOrder0.Attributes.Count()); + Assert.AreEqual("aw:PurchaseOrder", documentawPurchaseOrder0.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0.NodeType); + + Assert.AreEqual("99503", documentawPurchaseOrder0.GetAttribute("aw:PurchaseOrderNumber")); + Assert.AreEqual("1999-10-20", documentawPurchaseOrder0.GetAttribute("aw:OrderDate")); + Assert.AreEqual("http://www.adventure-works.com", documentawPurchaseOrder0.GetAttribute("xmlns:aw")); + + var documentawPurchaseOrder0Text0 = documentawPurchaseOrder0.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0Text0.TextContent); + + var documentawPurchaseOrder0awAddress1 = documentawPurchaseOrder0.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentawPurchaseOrder0awAddress1.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrder0awAddress1.Attributes.Count()); + Assert.AreEqual("aw:Address", documentawPurchaseOrder0awAddress1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress1.NodeType); + + Assert.AreEqual("Shipping", documentawPurchaseOrder0awAddress1.GetAttribute("aw:Type")); + + var documentawPurchaseOrder0awAddress1Text0 = documentawPurchaseOrder0awAddress1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress1Text0.TextContent); + + var documentawPurchaseOrder0awAddress1awName1 = documentawPurchaseOrder0awAddress1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress1awName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress1awName1.Attributes.Count()); + Assert.AreEqual("aw:Name", documentawPurchaseOrder0awAddress1awName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress1awName1.NodeType); + + var documentawPurchaseOrder0awAddress1awName1Text0 = documentawPurchaseOrder0awAddress1awName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1awName1Text0.NodeType); + Assert.AreEqual("Ellen Adams", documentawPurchaseOrder0awAddress1awName1Text0.TextContent); + + var documentawPurchaseOrder0awAddress1Text2 = documentawPurchaseOrder0awAddress1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress1Text2.TextContent); + + var documentawPurchaseOrder0awAddress1awStreet3 = documentawPurchaseOrder0awAddress1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress1awStreet3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress1awStreet3.Attributes.Count()); + Assert.AreEqual("aw:Street", documentawPurchaseOrder0awAddress1awStreet3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress1awStreet3.NodeType); + + var documentawPurchaseOrder0awAddress1awStreet3Text0 = documentawPurchaseOrder0awAddress1awStreet3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1awStreet3Text0.NodeType); + Assert.AreEqual("123 Maple Street", documentawPurchaseOrder0awAddress1awStreet3Text0.TextContent); + + var documentawPurchaseOrder0awAddress1Text4 = documentawPurchaseOrder0awAddress1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress1Text4.TextContent); + + var documentawPurchaseOrder0awAddress1awCity5 = documentawPurchaseOrder0awAddress1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress1awCity5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress1awCity5.Attributes.Count()); + Assert.AreEqual("aw:City", documentawPurchaseOrder0awAddress1awCity5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress1awCity5.NodeType); + + var documentawPurchaseOrder0awAddress1awCity5Text0 = documentawPurchaseOrder0awAddress1awCity5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1awCity5Text0.NodeType); + Assert.AreEqual("Mill Valley", documentawPurchaseOrder0awAddress1awCity5Text0.TextContent); + + var documentawPurchaseOrder0awAddress1Text6 = documentawPurchaseOrder0awAddress1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress1Text6.TextContent); + + var documentawPurchaseOrder0awAddress1awState7 = documentawPurchaseOrder0awAddress1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress1awState7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress1awState7.Attributes.Count()); + Assert.AreEqual("aw:State", documentawPurchaseOrder0awAddress1awState7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress1awState7.NodeType); + + var documentawPurchaseOrder0awAddress1awState7Text0 = documentawPurchaseOrder0awAddress1awState7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1awState7Text0.NodeType); + Assert.AreEqual("CA", documentawPurchaseOrder0awAddress1awState7Text0.TextContent); + + var documentawPurchaseOrder0awAddress1Text8 = documentawPurchaseOrder0awAddress1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress1Text8.TextContent); + + var documentawPurchaseOrder0awAddress1awZip9 = documentawPurchaseOrder0awAddress1.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress1awZip9.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress1awZip9.Attributes.Count()); + Assert.AreEqual("aw:Zip", documentawPurchaseOrder0awAddress1awZip9.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress1awZip9.NodeType); + + var documentawPurchaseOrder0awAddress1awZip9Text0 = documentawPurchaseOrder0awAddress1awZip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1awZip9Text0.NodeType); + Assert.AreEqual("10999", documentawPurchaseOrder0awAddress1awZip9Text0.TextContent); + + var documentawPurchaseOrder0awAddress1Text10 = documentawPurchaseOrder0awAddress1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1Text10.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress1Text10.TextContent); + + var documentawPurchaseOrder0awAddress1awCountry11 = documentawPurchaseOrder0awAddress1.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress1awCountry11.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress1awCountry11.Attributes.Count()); + Assert.AreEqual("aw:Country", documentawPurchaseOrder0awAddress1awCountry11.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress1awCountry11.NodeType); + + var documentawPurchaseOrder0awAddress1awCountry11Text0 = documentawPurchaseOrder0awAddress1awCountry11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1awCountry11Text0.NodeType); + Assert.AreEqual("USA", documentawPurchaseOrder0awAddress1awCountry11Text0.TextContent); + + var documentawPurchaseOrder0awAddress1Text12 = documentawPurchaseOrder0awAddress1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress1Text12.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress1Text12.TextContent); + + var documentawPurchaseOrder0Text2 = documentawPurchaseOrder0.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0Text2.TextContent); + + var documentawPurchaseOrder0awAddress3 = documentawPurchaseOrder0.ChildNodes[3] as IElement; + Assert.AreEqual(13, documentawPurchaseOrder0awAddress3.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrder0awAddress3.Attributes.Count()); + Assert.AreEqual("aw:Address", documentawPurchaseOrder0awAddress3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress3.NodeType); + + Assert.AreEqual("Billing", documentawPurchaseOrder0awAddress3.GetAttribute("aw:Type")); + + var documentawPurchaseOrder0awAddress3Text0 = documentawPurchaseOrder0awAddress3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress3Text0.TextContent); + + var documentawPurchaseOrder0awAddress3awName1 = documentawPurchaseOrder0awAddress3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress3awName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress3awName1.Attributes.Count()); + Assert.AreEqual("aw:Name", documentawPurchaseOrder0awAddress3awName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress3awName1.NodeType); + + var documentawPurchaseOrder0awAddress3awName1Text0 = documentawPurchaseOrder0awAddress3awName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3awName1Text0.NodeType); + Assert.AreEqual("Tai Yee", documentawPurchaseOrder0awAddress3awName1Text0.TextContent); + + var documentawPurchaseOrder0awAddress3Text2 = documentawPurchaseOrder0awAddress3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress3Text2.TextContent); + + var documentawPurchaseOrder0awAddress3awStreet3 = documentawPurchaseOrder0awAddress3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress3awStreet3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress3awStreet3.Attributes.Count()); + Assert.AreEqual("aw:Street", documentawPurchaseOrder0awAddress3awStreet3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress3awStreet3.NodeType); + + var documentawPurchaseOrder0awAddress3awStreet3Text0 = documentawPurchaseOrder0awAddress3awStreet3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3awStreet3Text0.NodeType); + Assert.AreEqual("8 Oak Avenue", documentawPurchaseOrder0awAddress3awStreet3Text0.TextContent); + + var documentawPurchaseOrder0awAddress3Text4 = documentawPurchaseOrder0awAddress3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress3Text4.TextContent); + + var documentawPurchaseOrder0awAddress3awCity5 = documentawPurchaseOrder0awAddress3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress3awCity5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress3awCity5.Attributes.Count()); + Assert.AreEqual("aw:City", documentawPurchaseOrder0awAddress3awCity5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress3awCity5.NodeType); + + var documentawPurchaseOrder0awAddress3awCity5Text0 = documentawPurchaseOrder0awAddress3awCity5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3awCity5Text0.NodeType); + Assert.AreEqual("Old Town", documentawPurchaseOrder0awAddress3awCity5Text0.TextContent); + + var documentawPurchaseOrder0awAddress3Text6 = documentawPurchaseOrder0awAddress3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress3Text6.TextContent); + + var documentawPurchaseOrder0awAddress3awState7 = documentawPurchaseOrder0awAddress3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress3awState7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress3awState7.Attributes.Count()); + Assert.AreEqual("aw:State", documentawPurchaseOrder0awAddress3awState7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress3awState7.NodeType); + + var documentawPurchaseOrder0awAddress3awState7Text0 = documentawPurchaseOrder0awAddress3awState7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3awState7Text0.NodeType); + Assert.AreEqual("PA", documentawPurchaseOrder0awAddress3awState7Text0.TextContent); + + var documentawPurchaseOrder0awAddress3Text8 = documentawPurchaseOrder0awAddress3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress3Text8.TextContent); + + var documentawPurchaseOrder0awAddress3awZip9 = documentawPurchaseOrder0awAddress3.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress3awZip9.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress3awZip9.Attributes.Count()); + Assert.AreEqual("aw:Zip", documentawPurchaseOrder0awAddress3awZip9.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress3awZip9.NodeType); + + var documentawPurchaseOrder0awAddress3awZip9Text0 = documentawPurchaseOrder0awAddress3awZip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3awZip9Text0.NodeType); + Assert.AreEqual("95819", documentawPurchaseOrder0awAddress3awZip9Text0.TextContent); + + var documentawPurchaseOrder0awAddress3Text10 = documentawPurchaseOrder0awAddress3.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3Text10.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress3Text10.TextContent); + + var documentawPurchaseOrder0awAddress3awCountry11 = documentawPurchaseOrder0awAddress3.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awAddress3awCountry11.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awAddress3awCountry11.Attributes.Count()); + Assert.AreEqual("aw:Country", documentawPurchaseOrder0awAddress3awCountry11.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awAddress3awCountry11.NodeType); + + var documentawPurchaseOrder0awAddress3awCountry11Text0 = documentawPurchaseOrder0awAddress3awCountry11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3awCountry11Text0.NodeType); + Assert.AreEqual("USA", documentawPurchaseOrder0awAddress3awCountry11Text0.TextContent); + + var documentawPurchaseOrder0awAddress3Text12 = documentawPurchaseOrder0awAddress3.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awAddress3Text12.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awAddress3Text12.TextContent); + + var documentawPurchaseOrder0Text4 = documentawPurchaseOrder0.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0Text4.TextContent); + + var documentawPurchaseOrder0awDeliveryNotes5 = documentawPurchaseOrder0.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awDeliveryNotes5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awDeliveryNotes5.Attributes.Count()); + Assert.AreEqual("aw:DeliveryNotes", documentawPurchaseOrder0awDeliveryNotes5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awDeliveryNotes5.NodeType); + + var documentawPurchaseOrder0awDeliveryNotes5Text0 = documentawPurchaseOrder0awDeliveryNotes5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awDeliveryNotes5Text0.NodeType); + Assert.AreEqual("Please leave packages in shed by driveway.", documentawPurchaseOrder0awDeliveryNotes5Text0.TextContent); + + var documentawPurchaseOrder0Text6 = documentawPurchaseOrder0.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0Text6.TextContent); + + var documentawPurchaseOrder0awItems7 = documentawPurchaseOrder0.ChildNodes[7] as IElement; + Assert.AreEqual(5, documentawPurchaseOrder0awItems7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7.Attributes.Count()); + Assert.AreEqual("aw:Items", documentawPurchaseOrder0awItems7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7.NodeType); + + var documentawPurchaseOrder0awItems7Text0 = documentawPurchaseOrder0awItems7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem1 = documentawPurchaseOrder0awItems7.ChildNodes[1] as IElement; + Assert.AreEqual(9, documentawPurchaseOrder0awItems7awItem1.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem1.Attributes.Count()); + Assert.AreEqual("aw:Item", documentawPurchaseOrder0awItems7awItem1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem1.NodeType); + + Assert.AreEqual("872-AA", documentawPurchaseOrder0awItems7awItem1.GetAttribute("aw:PartNumber")); + + var documentawPurchaseOrder0awItems7awItem1Text0 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem1Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem1awProductName1 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem1awProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7awItem1awProductName1.Attributes.Count()); + Assert.AreEqual("aw:ProductName", documentawPurchaseOrder0awItems7awItem1awProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem1awProductName1.NodeType); + + var documentawPurchaseOrder0awItems7awItem1awProductName1Text0 = documentawPurchaseOrder0awItems7awItem1awProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1awProductName1Text0.NodeType); + Assert.AreEqual("Lawnmower", documentawPurchaseOrder0awItems7awItem1awProductName1Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem1Text2 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem1Text2.TextContent); + + var documentawPurchaseOrder0awItems7awItem1awQuantity3 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem1awQuantity3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7awItem1awQuantity3.Attributes.Count()); + Assert.AreEqual("aw:Quantity", documentawPurchaseOrder0awItems7awItem1awQuantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem1awQuantity3.NodeType); + + var documentawPurchaseOrder0awItems7awItem1awQuantity3Text0 = documentawPurchaseOrder0awItems7awItem1awQuantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1awQuantity3Text0.NodeType); + Assert.AreEqual("1", documentawPurchaseOrder0awItems7awItem1awQuantity3Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem1Text4 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem1Text4.TextContent); + + var documentawPurchaseOrder0awItems7awItem1awUSPrice5 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem1awUSPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7awItem1awUSPrice5.Attributes.Count()); + Assert.AreEqual("aw:USPrice", documentawPurchaseOrder0awItems7awItem1awUSPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem1awUSPrice5.NodeType); + + var documentawPurchaseOrder0awItems7awItem1awUSPrice5Text0 = documentawPurchaseOrder0awItems7awItem1awUSPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1awUSPrice5Text0.NodeType); + Assert.AreEqual("148.95", documentawPurchaseOrder0awItems7awItem1awUSPrice5Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem1Text6 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem1Text6.TextContent); + + var documentawPurchaseOrder0awItems7awItem1awComment7 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem1awComment7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7awItem1awComment7.Attributes.Count()); + Assert.AreEqual("aw:Comment", documentawPurchaseOrder0awItems7awItem1awComment7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem1awComment7.NodeType); + + var documentawPurchaseOrder0awItems7awItem1awComment7Text0 = documentawPurchaseOrder0awItems7awItem1awComment7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1awComment7Text0.NodeType); + Assert.AreEqual("Confirm this is electric", documentawPurchaseOrder0awItems7awItem1awComment7Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem1Text8 = documentawPurchaseOrder0awItems7awItem1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem1Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem1Text8.TextContent); + + var documentawPurchaseOrder0awItems7Text2 = documentawPurchaseOrder0awItems7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7Text2.TextContent); + + var documentawPurchaseOrder0awItems7awItem3 = documentawPurchaseOrder0awItems7.ChildNodes[3] as IElement; + Assert.AreEqual(9, documentawPurchaseOrder0awItems7awItem3.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem3.Attributes.Count()); + Assert.AreEqual("aw:Item", documentawPurchaseOrder0awItems7awItem3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem3.NodeType); + + Assert.AreEqual("926-AA", documentawPurchaseOrder0awItems7awItem3.GetAttribute("aw:PartNumber")); + + var documentawPurchaseOrder0awItems7awItem3Text0 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem3Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem3awProductName1 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem3awProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7awItem3awProductName1.Attributes.Count()); + Assert.AreEqual("aw:ProductName", documentawPurchaseOrder0awItems7awItem3awProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem3awProductName1.NodeType); + + var documentawPurchaseOrder0awItems7awItem3awProductName1Text0 = documentawPurchaseOrder0awItems7awItem3awProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3awProductName1Text0.NodeType); + Assert.AreEqual("Baby Monitor", documentawPurchaseOrder0awItems7awItem3awProductName1Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem3Text2 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem3Text2.TextContent); + + var documentawPurchaseOrder0awItems7awItem3awQuantity3 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem3awQuantity3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7awItem3awQuantity3.Attributes.Count()); + Assert.AreEqual("aw:Quantity", documentawPurchaseOrder0awItems7awItem3awQuantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem3awQuantity3.NodeType); + + var documentawPurchaseOrder0awItems7awItem3awQuantity3Text0 = documentawPurchaseOrder0awItems7awItem3awQuantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3awQuantity3Text0.NodeType); + Assert.AreEqual("2", documentawPurchaseOrder0awItems7awItem3awQuantity3Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem3Text4 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem3Text4.TextContent); + + var documentawPurchaseOrder0awItems7awItem3awUSPrice5 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem3awUSPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7awItem3awUSPrice5.Attributes.Count()); + Assert.AreEqual("aw:USPrice", documentawPurchaseOrder0awItems7awItem3awUSPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem3awUSPrice5.NodeType); + + var documentawPurchaseOrder0awItems7awItem3awUSPrice5Text0 = documentawPurchaseOrder0awItems7awItem3awUSPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3awUSPrice5Text0.NodeType); + Assert.AreEqual("39.98", documentawPurchaseOrder0awItems7awItem3awUSPrice5Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem3Text6 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem3Text6.TextContent); + + var documentawPurchaseOrder0awItems7awItem3awShipDate7 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrder0awItems7awItem3awShipDate7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrder0awItems7awItem3awShipDate7.Attributes.Count()); + Assert.AreEqual("aw:ShipDate", documentawPurchaseOrder0awItems7awItem3awShipDate7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrder0awItems7awItem3awShipDate7.NodeType); + + var documentawPurchaseOrder0awItems7awItem3awShipDate7Text0 = documentawPurchaseOrder0awItems7awItem3awShipDate7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3awShipDate7Text0.NodeType); + Assert.AreEqual("1999-05-21", documentawPurchaseOrder0awItems7awItem3awShipDate7Text0.TextContent); + + var documentawPurchaseOrder0awItems7awItem3Text8 = documentawPurchaseOrder0awItems7awItem3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7awItem3Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7awItem3Text8.TextContent); + + var documentawPurchaseOrder0awItems7Text4 = documentawPurchaseOrder0awItems7.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0awItems7Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrder0awItems7Text4.TextContent); + + var documentawPurchaseOrder0Text8 = documentawPurchaseOrder0.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrder0Text8.NodeType); + Assert.AreEqual("\n", documentawPurchaseOrder0Text8.TextContent); + } + + [Test] + public void XmlMultiplePurchaseOrder() + { + var document = (@" + + +
+ Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA +
+
+ Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA +
+ Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + +
+ +
+ Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA +
+
+ Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA +
+ Please notify me before shipping. + + + Power Supply + 1 + 45.99 + + +
+ +
+ Jessica Arnold + 4055 Madison Ave + Seattle + WA + 98112 + USA +
+
+ Jessica Arnold + 4055 Madison Ave + Buffalo + NY + 98112 + USA +
+ + + Computer Keyboard + 1 + 29.99 + + + Wireless Mouse + 1 + 14.99 + + +
+
").ToXmlDocument(); + + var documentPurchaseOrders0 = document.ChildNodes[0] as IElement; + Assert.AreEqual(7, documentPurchaseOrders0.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0.Attributes.Count()); + Assert.AreEqual("PurchaseOrders", documentPurchaseOrders0.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0.NodeType); + + var documentPurchaseOrders0Text0 = documentPurchaseOrders0.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1 = documentPurchaseOrders0.ChildNodes[1] as IElement; + Assert.AreEqual(9, documentPurchaseOrders0PurchaseOrder1.ChildNodes.Length); + Assert.AreEqual(2, documentPurchaseOrders0PurchaseOrder1.Attributes.Count()); + Assert.AreEqual("PurchaseOrder", documentPurchaseOrders0PurchaseOrder1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1.NodeType); + Assert.AreEqual("99503", documentPurchaseOrders0PurchaseOrder1.GetAttribute("PurchaseOrderNumber")); + Assert.AreEqual("1999-10-20", documentPurchaseOrders0PurchaseOrder1.GetAttribute("OrderDate")); + + var documentPurchaseOrders0PurchaseOrder1Text0 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address1.Attributes.Count()); + Assert.AreEqual("Address", documentPurchaseOrders0PurchaseOrder1Address1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address1.NodeType); + Assert.AreEqual("Shipping", documentPurchaseOrders0PurchaseOrder1Address1.GetAttribute("Type")); + + var documentPurchaseOrders0PurchaseOrder1Address1Text0 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Name1 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address1Name1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address1Name1.Attributes.Count()); + Assert.AreEqual("Name", documentPurchaseOrders0PurchaseOrder1Address1Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address1Name1.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address1Name1Text0 = documentPurchaseOrders0PurchaseOrder1Address1Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Name1Text0.NodeType); + Assert.AreEqual("Ellen Adams", documentPurchaseOrders0PurchaseOrder1Address1Name1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Text2 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address1Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Street3 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address1Street3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address1Street3.Attributes.Count()); + Assert.AreEqual("Street", documentPurchaseOrders0PurchaseOrder1Address1Street3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address1Street3.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address1Street3Text0 = documentPurchaseOrders0PurchaseOrder1Address1Street3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Street3Text0.NodeType); + Assert.AreEqual("123 Maple Street", documentPurchaseOrders0PurchaseOrder1Address1Street3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Text4 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address1Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1City5 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address1City5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address1City5.Attributes.Count()); + Assert.AreEqual("City", documentPurchaseOrders0PurchaseOrder1Address1City5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address1City5.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address1City5Text0 = documentPurchaseOrders0PurchaseOrder1Address1City5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1City5Text0.NodeType); + Assert.AreEqual("Mill Valley", documentPurchaseOrders0PurchaseOrder1Address1City5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Text6 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address1Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1State7 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address1State7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address1State7.Attributes.Count()); + Assert.AreEqual("State", documentPurchaseOrders0PurchaseOrder1Address1State7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address1State7.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address1State7Text0 = documentPurchaseOrders0PurchaseOrder1Address1State7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1State7Text0.NodeType); + Assert.AreEqual("CA", documentPurchaseOrders0PurchaseOrder1Address1State7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Text8 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address1Text8.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Zip9 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address1Zip9.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address1Zip9.Attributes.Count()); + Assert.AreEqual("Zip", documentPurchaseOrders0PurchaseOrder1Address1Zip9.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address1Zip9.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address1Zip9Text0 = documentPurchaseOrders0PurchaseOrder1Address1Zip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Zip9Text0.NodeType); + Assert.AreEqual("10999", documentPurchaseOrders0PurchaseOrder1Address1Zip9Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Text10 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Text10.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address1Text10.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Country11 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address1Country11.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address1Country11.Attributes.Count()); + Assert.AreEqual("Country", documentPurchaseOrders0PurchaseOrder1Address1Country11.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address1Country11.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address1Country11Text0 = documentPurchaseOrders0PurchaseOrder1Address1Country11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Country11Text0.NodeType); + Assert.AreEqual("USA", documentPurchaseOrders0PurchaseOrder1Address1Country11Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address1Text12 = documentPurchaseOrders0PurchaseOrder1Address1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address1Text12.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address1Text12.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Text2 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[3] as IElement; + Assert.AreEqual(13, documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address3.Attributes.Count()); + Assert.AreEqual("Address", documentPurchaseOrders0PurchaseOrder1Address3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address3.NodeType); + Assert.AreEqual("Billing", documentPurchaseOrders0PurchaseOrder1Address3.GetAttribute("Type")); + + var documentPurchaseOrders0PurchaseOrder1Address3Text0 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Name1 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address3Name1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address3Name1.Attributes.Count()); + Assert.AreEqual("Name", documentPurchaseOrders0PurchaseOrder1Address3Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address3Name1.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address3Name1Text0 = documentPurchaseOrders0PurchaseOrder1Address3Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Name1Text0.NodeType); + Assert.AreEqual("Tai Yee", documentPurchaseOrders0PurchaseOrder1Address3Name1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Text2 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address3Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Street3 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address3Street3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address3Street3.Attributes.Count()); + Assert.AreEqual("Street", documentPurchaseOrders0PurchaseOrder1Address3Street3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address3Street3.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address3Street3Text0 = documentPurchaseOrders0PurchaseOrder1Address3Street3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Street3Text0.NodeType); + Assert.AreEqual("8 Oak Avenue", documentPurchaseOrders0PurchaseOrder1Address3Street3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Text4 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address3Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3City5 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address3City5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address3City5.Attributes.Count()); + Assert.AreEqual("City", documentPurchaseOrders0PurchaseOrder1Address3City5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address3City5.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address3City5Text0 = documentPurchaseOrders0PurchaseOrder1Address3City5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3City5Text0.NodeType); + Assert.AreEqual("Old Town", documentPurchaseOrders0PurchaseOrder1Address3City5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Text6 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address3Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3State7 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address3State7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address3State7.Attributes.Count()); + Assert.AreEqual("State", documentPurchaseOrders0PurchaseOrder1Address3State7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address3State7.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address3State7Text0 = documentPurchaseOrders0PurchaseOrder1Address3State7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3State7Text0.NodeType); + Assert.AreEqual("PA", documentPurchaseOrders0PurchaseOrder1Address3State7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Text8 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address3Text8.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Zip9 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address3Zip9.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address3Zip9.Attributes.Count()); + Assert.AreEqual("Zip", documentPurchaseOrders0PurchaseOrder1Address3Zip9.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address3Zip9.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address3Zip9Text0 = documentPurchaseOrders0PurchaseOrder1Address3Zip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Zip9Text0.NodeType); + Assert.AreEqual("95819", documentPurchaseOrders0PurchaseOrder1Address3Zip9Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Text10 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Text10.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address3Text10.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Country11 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Address3Country11.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Address3Country11.Attributes.Count()); + Assert.AreEqual("Country", documentPurchaseOrders0PurchaseOrder1Address3Country11.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Address3Country11.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Address3Country11Text0 = documentPurchaseOrders0PurchaseOrder1Address3Country11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Country11Text0.NodeType); + Assert.AreEqual("USA", documentPurchaseOrders0PurchaseOrder1Address3Country11Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Address3Text12 = documentPurchaseOrders0PurchaseOrder1Address3.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Address3Text12.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Address3Text12.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Text4 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder1DeliveryNotes5 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1DeliveryNotes5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1DeliveryNotes5.Attributes.Count()); + Assert.AreEqual("DeliveryNotes", documentPurchaseOrders0PurchaseOrder1DeliveryNotes5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1DeliveryNotes5.NodeType); + + var documentPurchaseOrders0PurchaseOrder1DeliveryNotes5Text0 = documentPurchaseOrders0PurchaseOrder1DeliveryNotes5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1DeliveryNotes5Text0.NodeType); + Assert.AreEqual("Please leave packages in shed by driveway.", documentPurchaseOrders0PurchaseOrder1DeliveryNotes5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Text6 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[7] as IElement; + Assert.AreEqual(5, documentPurchaseOrders0PurchaseOrder1Items7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7.Attributes.Count()); + Assert.AreEqual("Items", documentPurchaseOrders0PurchaseOrder1Items7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Text0 = documentPurchaseOrders0PurchaseOrder1Items7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1 = documentPurchaseOrders0PurchaseOrder1Items7.ChildNodes[1] as IElement; + Assert.AreEqual(9, documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item1.Attributes.Count()); + Assert.AreEqual("Item", documentPurchaseOrders0PurchaseOrder1Items7Item1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item1.NodeType); + Assert.AreEqual("872-AA", documentPurchaseOrders0PurchaseOrder1Items7Item1.GetAttribute("PartNumber")); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1.Attributes.Count()); + Assert.AreEqual("ProductName", documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1Text0.NodeType); + Assert.AreEqual("Lawnmower", documentPurchaseOrders0PurchaseOrder1Items7Item1ProductName1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Text2 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item1Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3Text0.NodeType); + Assert.AreEqual("1", documentPurchaseOrders0PurchaseOrder1Items7Item1Quantity3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Text4 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item1Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5.Attributes.Count()); + Assert.AreEqual("USPrice", documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5Text0.NodeType); + Assert.AreEqual("148.95", documentPurchaseOrders0PurchaseOrder1Items7Item1USPrice5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Text6 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item1Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7.Attributes.Count()); + Assert.AreEqual("Comment", documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7Text0.NodeType); + Assert.AreEqual("Confirm this is electric", documentPurchaseOrders0PurchaseOrder1Items7Item1Comment7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item1Text8 = documentPurchaseOrders0PurchaseOrder1Items7Item1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item1Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item1Text8.TextContent); + + + var documentPurchaseOrders0PurchaseOrder1Items7Text2 = documentPurchaseOrders0PurchaseOrder1Items7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3 = documentPurchaseOrders0PurchaseOrder1Items7.ChildNodes[3] as IElement; + Assert.AreEqual(9, documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item3.Attributes.Count()); + Assert.AreEqual("Item", documentPurchaseOrders0PurchaseOrder1Items7Item3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item3.NodeType); + Assert.AreEqual("926-AA", documentPurchaseOrders0PurchaseOrder1Items7Item3.GetAttribute("PartNumber")); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1.Attributes.Count()); + Assert.AreEqual("ProductName", documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1Text0.NodeType); + Assert.AreEqual("Baby Monitor", documentPurchaseOrders0PurchaseOrder1Items7Item3ProductName1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3Text2 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item3Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3Text0.NodeType); + Assert.AreEqual("2", documentPurchaseOrders0PurchaseOrder1Items7Item3Quantity3Text0.TextContent); + + + var documentPurchaseOrders0PurchaseOrder1Items7Item3Text4 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item3Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5.Attributes.Count()); + Assert.AreEqual("USPrice", documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5Text0.NodeType); + Assert.AreEqual("39.98", documentPurchaseOrders0PurchaseOrder1Items7Item3USPrice5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3Text6 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item3Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7.Attributes.Count()); + Assert.AreEqual("ShipDate", documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7.NodeType); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7Text0 = documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7Text0.NodeType); + Assert.AreEqual("1999-05-21", documentPurchaseOrders0PurchaseOrder1Items7Item3ShipDate7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Item3Text8 = documentPurchaseOrders0PurchaseOrder1Items7Item3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Item3Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Item3Text8.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Items7Text4 = documentPurchaseOrders0PurchaseOrder1Items7.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Items7Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Items7Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder1Text8 = documentPurchaseOrders0PurchaseOrder1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder1Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder1Text8.TextContent); + + var documentPurchaseOrders0Text2 = documentPurchaseOrders0.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder3 = documentPurchaseOrders0.ChildNodes[3] as IElement; + Assert.AreEqual(9, documentPurchaseOrders0PurchaseOrder3.ChildNodes.Length); + Assert.AreEqual(2, documentPurchaseOrders0PurchaseOrder3.Attributes.Count()); + Assert.AreEqual("PurchaseOrder", documentPurchaseOrders0PurchaseOrder3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3.NodeType); + Assert.AreEqual("99505", documentPurchaseOrders0PurchaseOrder3.GetAttribute("PurchaseOrderNumber")); + Assert.AreEqual("1999-10-22", documentPurchaseOrders0PurchaseOrder3.GetAttribute("OrderDate")); + + var documentPurchaseOrders0PurchaseOrder3Text0 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address1.Attributes.Count()); + Assert.AreEqual("Address", documentPurchaseOrders0PurchaseOrder3Address1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address1.NodeType); + Assert.AreEqual("Shipping", documentPurchaseOrders0PurchaseOrder3Address1.GetAttribute("Type")); + + var documentPurchaseOrders0PurchaseOrder3Address1Text0 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Name1 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address1Name1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address1Name1.Attributes.Count()); + Assert.AreEqual("Name", documentPurchaseOrders0PurchaseOrder3Address1Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address1Name1.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address1Name1Text0 = documentPurchaseOrders0PurchaseOrder3Address1Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Name1Text0.NodeType); + Assert.AreEqual("Cristian Osorio", documentPurchaseOrders0PurchaseOrder3Address1Name1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Text2 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address1Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Street3 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address1Street3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address1Street3.Attributes.Count()); + Assert.AreEqual("Street", documentPurchaseOrders0PurchaseOrder3Address1Street3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address1Street3.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address1Street3Text0 = documentPurchaseOrders0PurchaseOrder3Address1Street3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Street3Text0.NodeType); + Assert.AreEqual("456 Main Street", documentPurchaseOrders0PurchaseOrder3Address1Street3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Text4 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address1Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1City5 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address1City5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address1City5.Attributes.Count()); + Assert.AreEqual("City", documentPurchaseOrders0PurchaseOrder3Address1City5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address1City5.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address1City5Text0 = documentPurchaseOrders0PurchaseOrder3Address1City5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1City5Text0.NodeType); + Assert.AreEqual("Buffalo", documentPurchaseOrders0PurchaseOrder3Address1City5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Text6 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address1Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1State7 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address1State7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address1State7.Attributes.Count()); + Assert.AreEqual("State", documentPurchaseOrders0PurchaseOrder3Address1State7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address1State7.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address1State7Text0 = documentPurchaseOrders0PurchaseOrder3Address1State7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1State7Text0.NodeType); + Assert.AreEqual("NY", documentPurchaseOrders0PurchaseOrder3Address1State7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Text8 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address1Text8.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Zip9 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address1Zip9.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address1Zip9.Attributes.Count()); + Assert.AreEqual("Zip", documentPurchaseOrders0PurchaseOrder3Address1Zip9.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address1Zip9.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address1Zip9Text0 = documentPurchaseOrders0PurchaseOrder3Address1Zip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Zip9Text0.NodeType); + Assert.AreEqual("98112", documentPurchaseOrders0PurchaseOrder3Address1Zip9Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Text10 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Text10.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address1Text10.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Country11 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address1Country11.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address1Country11.Attributes.Count()); + Assert.AreEqual("Country", documentPurchaseOrders0PurchaseOrder3Address1Country11.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address1Country11.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address1Country11Text0 = documentPurchaseOrders0PurchaseOrder3Address1Country11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Country11Text0.NodeType); + Assert.AreEqual("USA", documentPurchaseOrders0PurchaseOrder3Address1Country11Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address1Text12 = documentPurchaseOrders0PurchaseOrder3Address1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address1Text12.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address1Text12.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Text2 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[3] as IElement; + Assert.AreEqual(13, documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address3.Attributes.Count()); + Assert.AreEqual("Address", documentPurchaseOrders0PurchaseOrder3Address3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address3.NodeType); + Assert.AreEqual("Billing", documentPurchaseOrders0PurchaseOrder3Address3.GetAttribute("Type")); + + var documentPurchaseOrders0PurchaseOrder3Address3Text0 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Name1 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address3Name1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address3Name1.Attributes.Count()); + Assert.AreEqual("Name", documentPurchaseOrders0PurchaseOrder3Address3Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address3Name1.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address3Name1Text0 = documentPurchaseOrders0PurchaseOrder3Address3Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Name1Text0.NodeType); + Assert.AreEqual("Cristian Osorio", documentPurchaseOrders0PurchaseOrder3Address3Name1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Text2 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address3Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Street3 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address3Street3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address3Street3.Attributes.Count()); + Assert.AreEqual("Street", documentPurchaseOrders0PurchaseOrder3Address3Street3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address3Street3.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address3Street3Text0 = documentPurchaseOrders0PurchaseOrder3Address3Street3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Street3Text0.NodeType); + Assert.AreEqual("456 Main Street", documentPurchaseOrders0PurchaseOrder3Address3Street3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Text4 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address3Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3City5 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address3City5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address3City5.Attributes.Count()); + Assert.AreEqual("City", documentPurchaseOrders0PurchaseOrder3Address3City5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address3City5.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address3City5Text0 = documentPurchaseOrders0PurchaseOrder3Address3City5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3City5Text0.NodeType); + Assert.AreEqual("Buffalo", documentPurchaseOrders0PurchaseOrder3Address3City5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Text6 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address3Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3State7 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address3State7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address3State7.Attributes.Count()); + Assert.AreEqual("State", documentPurchaseOrders0PurchaseOrder3Address3State7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address3State7.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address3State7Text0 = documentPurchaseOrders0PurchaseOrder3Address3State7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3State7Text0.NodeType); + Assert.AreEqual("NY", documentPurchaseOrders0PurchaseOrder3Address3State7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Text8 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address3Text8.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Zip9 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address3Zip9.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address3Zip9.Attributes.Count()); + Assert.AreEqual("Zip", documentPurchaseOrders0PurchaseOrder3Address3Zip9.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address3Zip9.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address3Zip9Text0 = documentPurchaseOrders0PurchaseOrder3Address3Zip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Zip9Text0.NodeType); + Assert.AreEqual("98112", documentPurchaseOrders0PurchaseOrder3Address3Zip9Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Text10 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Text10.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address3Text10.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Country11 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Address3Country11.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Address3Country11.Attributes.Count()); + Assert.AreEqual("Country", documentPurchaseOrders0PurchaseOrder3Address3Country11.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Address3Country11.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Address3Country11Text0 = documentPurchaseOrders0PurchaseOrder3Address3Country11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Country11Text0.NodeType); + Assert.AreEqual("USA", documentPurchaseOrders0PurchaseOrder3Address3Country11Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Address3Text12 = documentPurchaseOrders0PurchaseOrder3Address3.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Address3Text12.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Address3Text12.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Text4 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder3DeliveryNotes5 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3DeliveryNotes5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3DeliveryNotes5.Attributes.Count()); + Assert.AreEqual("DeliveryNotes", documentPurchaseOrders0PurchaseOrder3DeliveryNotes5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3DeliveryNotes5.NodeType); + + var documentPurchaseOrders0PurchaseOrder3DeliveryNotes5Text0 = documentPurchaseOrders0PurchaseOrder3DeliveryNotes5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3DeliveryNotes5Text0.NodeType); + Assert.AreEqual("Please notify me before shipping.", documentPurchaseOrders0PurchaseOrder3DeliveryNotes5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Text6 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[7] as IElement; + Assert.AreEqual(3, documentPurchaseOrders0PurchaseOrder3Items7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Items7.Attributes.Count()); + Assert.AreEqual("Items", documentPurchaseOrders0PurchaseOrder3Items7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Items7.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Items7Text0 = documentPurchaseOrders0PurchaseOrder3Items7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Items7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1 = documentPurchaseOrders0PurchaseOrder3Items7.ChildNodes[1] as IElement; + Assert.AreEqual(7, documentPurchaseOrders0PurchaseOrder3Items7Item1.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Items7Item1.Attributes.Count()); + Assert.AreEqual("Item", documentPurchaseOrders0PurchaseOrder3Items7Item1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Items7Item1.NodeType); + Assert.AreEqual("456-NM", documentPurchaseOrders0PurchaseOrder3Items7Item1.GetAttribute("PartNumber")); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1Text0 = documentPurchaseOrders0PurchaseOrder3Items7Item1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Item1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Items7Item1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1 = documentPurchaseOrders0PurchaseOrder3Items7Item1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1.Attributes.Count()); + Assert.AreEqual("ProductName", documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1Text0 = documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1Text0.NodeType); + Assert.AreEqual("Power Supply", documentPurchaseOrders0PurchaseOrder3Items7Item1ProductName1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1Text2 = documentPurchaseOrders0PurchaseOrder3Items7Item1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Item1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Items7Item1Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3 = documentPurchaseOrders0PurchaseOrder3Items7Item1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3Text0 = documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3Text0.NodeType); + Assert.AreEqual("1", documentPurchaseOrders0PurchaseOrder3Items7Item1Quantity3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1Text4 = documentPurchaseOrders0PurchaseOrder3Items7Item1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Item1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Items7Item1Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5 = documentPurchaseOrders0PurchaseOrder3Items7Item1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5.Attributes.Count()); + Assert.AreEqual("USPrice", documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5.NodeType); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5Text0 = documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5Text0.NodeType); + Assert.AreEqual("45.99", documentPurchaseOrders0PurchaseOrder3Items7Item1USPrice5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7Item1Text6 = documentPurchaseOrders0PurchaseOrder3Items7Item1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Item1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Items7Item1Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Items7Text2 = documentPurchaseOrders0PurchaseOrder3Items7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Items7Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Items7Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder3Text8 = documentPurchaseOrders0PurchaseOrder3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder3Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder3Text8.TextContent); + + var documentPurchaseOrders0Text4 = documentPurchaseOrders0.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder5 = documentPurchaseOrders0.ChildNodes[5] as IElement; + Assert.AreEqual(7, documentPurchaseOrders0PurchaseOrder5.ChildNodes.Length); + Assert.AreEqual(2, documentPurchaseOrders0PurchaseOrder5.Attributes.Count()); + Assert.AreEqual("PurchaseOrder", documentPurchaseOrders0PurchaseOrder5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5.NodeType); + Assert.AreEqual("99504", documentPurchaseOrders0PurchaseOrder5.GetAttribute("PurchaseOrderNumber")); + Assert.AreEqual("1999-10-22", documentPurchaseOrders0PurchaseOrder5.GetAttribute("OrderDate")); + + var documentPurchaseOrders0PurchaseOrder5Text0 = documentPurchaseOrders0PurchaseOrder5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1 = documentPurchaseOrders0PurchaseOrder5.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address1.Attributes.Count()); + Assert.AreEqual("Address", documentPurchaseOrders0PurchaseOrder5Address1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address1.NodeType); + Assert.AreEqual("Shipping", documentPurchaseOrders0PurchaseOrder5Address1.GetAttribute("Type")); + + var documentPurchaseOrders0PurchaseOrder5Address1Text0 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Name1 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address1Name1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address1Name1.Attributes.Count()); + Assert.AreEqual("Name", documentPurchaseOrders0PurchaseOrder5Address1Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address1Name1.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address1Name1Text0 = documentPurchaseOrders0PurchaseOrder5Address1Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Name1Text0.NodeType); + Assert.AreEqual("Jessica Arnold", documentPurchaseOrders0PurchaseOrder5Address1Name1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Text2 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address1Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Street3 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address1Street3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address1Street3.Attributes.Count()); + Assert.AreEqual("Street", documentPurchaseOrders0PurchaseOrder5Address1Street3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address1Street3.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address1Street3Text0 = documentPurchaseOrders0PurchaseOrder5Address1Street3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Street3Text0.NodeType); + Assert.AreEqual("4055 Madison Ave", documentPurchaseOrders0PurchaseOrder5Address1Street3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Text4 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address1Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1City5 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address1City5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address1City5.Attributes.Count()); + Assert.AreEqual("City", documentPurchaseOrders0PurchaseOrder5Address1City5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address1City5.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address1City5Text0 = documentPurchaseOrders0PurchaseOrder5Address1City5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1City5Text0.NodeType); + Assert.AreEqual("Seattle", documentPurchaseOrders0PurchaseOrder5Address1City5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Text6 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address1Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1State7 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address1State7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address1State7.Attributes.Count()); + Assert.AreEqual("State", documentPurchaseOrders0PurchaseOrder5Address1State7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address1State7.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address1State7Text0 = documentPurchaseOrders0PurchaseOrder5Address1State7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1State7Text0.NodeType); + Assert.AreEqual("WA", documentPurchaseOrders0PurchaseOrder5Address1State7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Text8 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address1Text8.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Zip9 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address1Zip9.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address1Zip9.Attributes.Count()); + Assert.AreEqual("Zip", documentPurchaseOrders0PurchaseOrder5Address1Zip9.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address1Zip9.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address1Zip9Text0 = documentPurchaseOrders0PurchaseOrder5Address1Zip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Zip9Text0.NodeType); + Assert.AreEqual("98112", documentPurchaseOrders0PurchaseOrder5Address1Zip9Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Text10 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Text10.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address1Text10.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Country11 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address1Country11.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address1Country11.Attributes.Count()); + Assert.AreEqual("Country", documentPurchaseOrders0PurchaseOrder5Address1Country11.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address1Country11.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address1Country11Text0 = documentPurchaseOrders0PurchaseOrder5Address1Country11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Country11Text0.NodeType); + Assert.AreEqual("USA", documentPurchaseOrders0PurchaseOrder5Address1Country11Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address1Text12 = documentPurchaseOrders0PurchaseOrder5Address1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address1Text12.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address1Text12.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Text2 = documentPurchaseOrders0PurchaseOrder5.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3 = documentPurchaseOrders0PurchaseOrder5.ChildNodes[3] as IElement; + Assert.AreEqual(13, documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address3.Attributes.Count()); + Assert.AreEqual("Address", documentPurchaseOrders0PurchaseOrder5Address3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address3.NodeType); + Assert.AreEqual("Billing", documentPurchaseOrders0PurchaseOrder5Address3.GetAttribute("Type")); + + var documentPurchaseOrders0PurchaseOrder5Address3Text0 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Name1 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address3Name1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address3Name1.Attributes.Count()); + Assert.AreEqual("Name", documentPurchaseOrders0PurchaseOrder5Address3Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address3Name1.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address3Name1Text0 = documentPurchaseOrders0PurchaseOrder5Address3Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Name1Text0.NodeType); + Assert.AreEqual("Jessica Arnold", documentPurchaseOrders0PurchaseOrder5Address3Name1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Text2 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address3Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Street3 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address3Street3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address3Street3.Attributes.Count()); + Assert.AreEqual("Street", documentPurchaseOrders0PurchaseOrder5Address3Street3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address3Street3.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address3Street3Text0 = documentPurchaseOrders0PurchaseOrder5Address3Street3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Street3Text0.NodeType); + Assert.AreEqual("4055 Madison Ave", documentPurchaseOrders0PurchaseOrder5Address3Street3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Text4 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address3Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3City5 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address3City5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address3City5.Attributes.Count()); + Assert.AreEqual("City", documentPurchaseOrders0PurchaseOrder5Address3City5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address3City5.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address3City5Text0 = documentPurchaseOrders0PurchaseOrder5Address3City5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3City5Text0.NodeType); + Assert.AreEqual("Buffalo", documentPurchaseOrders0PurchaseOrder5Address3City5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Text6 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address3Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3State7 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address3State7.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address3State7.Attributes.Count()); + Assert.AreEqual("State", documentPurchaseOrders0PurchaseOrder5Address3State7.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address3State7.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address3State7Text0 = documentPurchaseOrders0PurchaseOrder5Address3State7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3State7Text0.NodeType); + Assert.AreEqual("NY", documentPurchaseOrders0PurchaseOrder5Address3State7Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Text8 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Text8.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address3Text8.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Zip9 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address3Zip9.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address3Zip9.Attributes.Count()); + Assert.AreEqual("Zip", documentPurchaseOrders0PurchaseOrder5Address3Zip9.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address3Zip9.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address3Zip9Text0 = documentPurchaseOrders0PurchaseOrder5Address3Zip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Zip9Text0.NodeType); + Assert.AreEqual("98112", documentPurchaseOrders0PurchaseOrder5Address3Zip9Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Text10 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Text10.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address3Text10.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Country11 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Address3Country11.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Address3Country11.Attributes.Count()); + Assert.AreEqual("Country", documentPurchaseOrders0PurchaseOrder5Address3Country11.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Address3Country11.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Address3Country11Text0 = documentPurchaseOrders0PurchaseOrder5Address3Country11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Country11Text0.NodeType); + Assert.AreEqual("USA", documentPurchaseOrders0PurchaseOrder5Address3Country11Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Address3Text12 = documentPurchaseOrders0PurchaseOrder5Address3.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Address3Text12.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Address3Text12.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Text4 = documentPurchaseOrders0PurchaseOrder5.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5 = documentPurchaseOrders0PurchaseOrder5.ChildNodes[5] as IElement; + Assert.AreEqual(5, documentPurchaseOrders0PurchaseOrder5Items5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Items5.Attributes.Count()); + Assert.AreEqual("Items", documentPurchaseOrders0PurchaseOrder5Items5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Items5Text0 = documentPurchaseOrders0PurchaseOrder5Items5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1 = documentPurchaseOrders0PurchaseOrder5Items5.ChildNodes[1] as IElement; + Assert.AreEqual(7, documentPurchaseOrders0PurchaseOrder5Items5Item1.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Items5Item1.Attributes.Count()); + Assert.AreEqual("Item", documentPurchaseOrders0PurchaseOrder5Items5Item1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5Item1.NodeType); + Assert.AreEqual("898-AZ", documentPurchaseOrders0PurchaseOrder5Items5Item1.GetAttribute("PartNumber")); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1Text0 = documentPurchaseOrders0PurchaseOrder5Items5Item1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item1Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Item1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1 = documentPurchaseOrders0PurchaseOrder5Items5Item1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1.Attributes.Count()); + Assert.AreEqual("ProductName", documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1Text0 = documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1Text0.NodeType); + Assert.AreEqual("Computer Keyboard", documentPurchaseOrders0PurchaseOrder5Items5Item1ProductName1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1Text2 = documentPurchaseOrders0PurchaseOrder5Items5Item1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item1Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Item1Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3 = documentPurchaseOrders0PurchaseOrder5Items5Item1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3Text0 = documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3Text0.NodeType); + Assert.AreEqual("1", documentPurchaseOrders0PurchaseOrder5Items5Item1Quantity3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1Text4 = documentPurchaseOrders0PurchaseOrder5Items5Item1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item1Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Item1Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5 = documentPurchaseOrders0PurchaseOrder5Items5Item1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5.Attributes.Count()); + Assert.AreEqual("USPrice", documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5Text0 = documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5Text0.NodeType); + Assert.AreEqual("29.99", documentPurchaseOrders0PurchaseOrder5Items5Item1USPrice5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item1Text6 = documentPurchaseOrders0PurchaseOrder5Items5Item1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item1Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Item1Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Text2 = documentPurchaseOrders0PurchaseOrder5Items5.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3 = documentPurchaseOrders0PurchaseOrder5Items5.ChildNodes[3] as IElement; + Assert.AreEqual(7, documentPurchaseOrders0PurchaseOrder5Items5Item3.ChildNodes.Length); + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Items5Item3.Attributes.Count()); + Assert.AreEqual("Item", documentPurchaseOrders0PurchaseOrder5Items5Item3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5Item3.NodeType); + Assert.AreEqual("898-AM", documentPurchaseOrders0PurchaseOrder5Items5Item3.GetAttribute("PartNumber")); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3Text0 = documentPurchaseOrders0PurchaseOrder5Items5Item3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item3Text0.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Item3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1 = documentPurchaseOrders0PurchaseOrder5Items5Item3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1.Attributes.Count()); + Assert.AreEqual("ProductName", documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1Text0 = documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1Text0.NodeType); + Assert.AreEqual("Wireless Mouse", documentPurchaseOrders0PurchaseOrder5Items5Item3ProductName1Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3Text2 = documentPurchaseOrders0PurchaseOrder5Items5Item3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item3Text2.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Item3Text2.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3 = documentPurchaseOrders0PurchaseOrder5Items5Item3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3Text0 = documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3Text0.NodeType); + Assert.AreEqual("1", documentPurchaseOrders0PurchaseOrder5Items5Item3Quantity3Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3Text4 = documentPurchaseOrders0PurchaseOrder5Items5Item3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item3Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Item3Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5 = documentPurchaseOrders0PurchaseOrder5Items5Item3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5.Attributes.Count()); + Assert.AreEqual("USPrice", documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5.NodeType); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5Text0 = documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5Text0.NodeType); + Assert.AreEqual("14.99", documentPurchaseOrders0PurchaseOrder5Items5Item3USPrice5Text0.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Item3Text6 = documentPurchaseOrders0PurchaseOrder5Items5Item3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Item3Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Item3Text6.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Items5Text4 = documentPurchaseOrders0PurchaseOrder5Items5.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Items5Text4.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Items5Text4.TextContent); + + var documentPurchaseOrders0PurchaseOrder5Text6 = documentPurchaseOrders0PurchaseOrder5.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0PurchaseOrder5Text6.NodeType); + Assert.AreEqual("\n ", documentPurchaseOrders0PurchaseOrder5Text6.TextContent); + + var documentPurchaseOrders0Text6 = documentPurchaseOrders0.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentPurchaseOrders0Text6.NodeType); + Assert.AreEqual("\n", documentPurchaseOrders0Text6.TextContent); + } + + [Test] + public void XmlMultiplePurchaseOrderInNamespace() + { + var document = (@" + + + + Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA + + + Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA + + Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + + + + + Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA + + + Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA + + Please notify me before shipping. + + + Power Supply + 1 + 45.99 + + + + + + Jessica Arnold + 4055 Madison Ave + Seattle + WA + 98112 + USA + + + Jessica Arnold + 4055 Madison Ave + Buffalo + NY + 98112 + USA + + + + Computer Keyboard + 1 + 29.99 + + + Wireless Mouse + 1 + 14.99 + + + +").ToXmlDocument(); + + var documentawPurchaseOrders0 = document.ChildNodes[0] as IElement; + Assert.AreEqual(7, documentawPurchaseOrders0.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0.Attributes.Count()); + Assert.AreEqual("aw:PurchaseOrders", documentawPurchaseOrders0.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0.NodeType); + Assert.AreEqual("http://www.adventure-works.com", documentawPurchaseOrders0.GetAttribute("xmlns:aw")); + + var documentawPurchaseOrders0Text0 = documentawPurchaseOrders0.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1 = documentawPurchaseOrders0.ChildNodes[1] as IElement; + Assert.AreEqual(9, documentawPurchaseOrders0awPurchaseOrder1.ChildNodes.Length); + Assert.AreEqual(2, documentawPurchaseOrders0awPurchaseOrder1.Attributes.Count()); + Assert.AreEqual("aw:PurchaseOrder", documentawPurchaseOrders0awPurchaseOrder1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1.NodeType); + Assert.AreEqual("99503", documentawPurchaseOrders0awPurchaseOrder1.GetAttribute("aw:PurchaseOrderNumber")); + Assert.AreEqual("1999-10-20", documentawPurchaseOrders0awPurchaseOrder1.GetAttribute("aw:OrderDate")); + + var documentawPurchaseOrders0awPurchaseOrder1Text0 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress1.Attributes.Count()); + Assert.AreEqual("aw:Address", documentawPurchaseOrders0awPurchaseOrder1awAddress1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress1.NodeType); + Assert.AreEqual("Shipping", documentawPurchaseOrders0awPurchaseOrder1awAddress1.GetAttribute("aw:Type")); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1.Attributes.Count()); + Assert.AreEqual("aw:Name", documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1Text0.NodeType); + Assert.AreEqual("Ellen Adams", documentawPurchaseOrders0awPurchaseOrder1awAddress1awName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1Text2 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress1Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3.Attributes.Count()); + Assert.AreEqual("aw:Street", documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3Text0.NodeType); + Assert.AreEqual("123 Maple Street", documentawPurchaseOrders0awPurchaseOrder1awAddress1awStreet3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1Text4 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress1Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5.Attributes.Count()); + Assert.AreEqual("aw:City", documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5Text0.NodeType); + Assert.AreEqual("Mill Valley", documentawPurchaseOrders0awPurchaseOrder1awAddress1awCity5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1Text6 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress1Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7.Attributes.Count()); + Assert.AreEqual("aw:State", documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7Text0.NodeType); + Assert.AreEqual("CA", documentawPurchaseOrders0awPurchaseOrder1awAddress1awState7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1Text8 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress1Text8.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9.Attributes.Count()); + Assert.AreEqual("aw:Zip", documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9Text0.NodeType); + Assert.AreEqual("10999", documentawPurchaseOrders0awPurchaseOrder1awAddress1awZip9Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1Text10 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1Text10.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress1Text10.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11.Attributes.Count()); + Assert.AreEqual("aw:Country", documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11Text0.NodeType); + Assert.AreEqual("USA", documentawPurchaseOrders0awPurchaseOrder1awAddress1awCountry11Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress1Text12 = documentawPurchaseOrders0awPurchaseOrder1awAddress1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress1Text12.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress1Text12.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1Text2 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[3] as IElement; + Assert.AreEqual(13, documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress3.Attributes.Count()); + Assert.AreEqual("aw:Address", documentawPurchaseOrders0awPurchaseOrder1awAddress3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress3.NodeType); + Assert.AreEqual("Billing", documentawPurchaseOrders0awPurchaseOrder1awAddress3.GetAttribute("aw:Type")); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1.Attributes.Count()); + Assert.AreEqual("aw:Name", documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1Text0.NodeType); + Assert.AreEqual("Tai Yee", documentawPurchaseOrders0awPurchaseOrder1awAddress3awName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3Text2 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress3Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3.Attributes.Count()); + Assert.AreEqual("aw:Street", documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3Text0.NodeType); + Assert.AreEqual("8 Oak Avenue", documentawPurchaseOrders0awPurchaseOrder1awAddress3awStreet3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3Text4 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress3Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5.Attributes.Count()); + Assert.AreEqual("aw:City", documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5Text0.NodeType); + Assert.AreEqual("Old Town", documentawPurchaseOrders0awPurchaseOrder1awAddress3awCity5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3Text6 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress3Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7.Attributes.Count()); + Assert.AreEqual("aw:State", documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7Text0.NodeType); + Assert.AreEqual("PA", documentawPurchaseOrders0awPurchaseOrder1awAddress3awState7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3Text8 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress3Text8.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9.Attributes.Count()); + Assert.AreEqual("aw:Zip", documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9Text0.NodeType); + Assert.AreEqual("95819", documentawPurchaseOrders0awPurchaseOrder1awAddress3awZip9Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3Text10 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3Text10.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress3Text10.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11.Attributes.Count()); + Assert.AreEqual("aw:Country", documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11Text0 = documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11Text0.NodeType); + Assert.AreEqual("USA", documentawPurchaseOrders0awPurchaseOrder1awAddress3awCountry11Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awAddress3Text12 = documentawPurchaseOrders0awPurchaseOrder1awAddress3.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awAddress3Text12.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awAddress3Text12.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1Text4 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5.Attributes.Count()); + Assert.AreEqual("aw:DeliveryNotes", documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5Text0 = documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5Text0.NodeType); + Assert.AreEqual("Please leave packages in shed by driveway.", documentawPurchaseOrders0awPurchaseOrder1awDeliveryNotes5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1Text6 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[7] as IElement; + Assert.AreEqual(5, documentawPurchaseOrders0awPurchaseOrder1awItems7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7.Attributes.Count()); + Assert.AreEqual("aw:Items", documentawPurchaseOrders0awPurchaseOrder1awItems7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1 = documentawPurchaseOrders0awPurchaseOrder1awItems7.ChildNodes[1] as IElement; + Assert.AreEqual(9, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.Attributes.Count()); + Assert.AreEqual("aw:Item", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.NodeType); + Assert.AreEqual("872-AA", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.GetAttribute("aw:PartNumber")); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1.Attributes.Count()); + Assert.AreEqual("aw:ProductName", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1Text0.NodeType); + Assert.AreEqual("Lawnmower", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awProductName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text2 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3.Attributes.Count()); + Assert.AreEqual("aw:Quantity", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3Text0.NodeType); + Assert.AreEqual("1", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awQuantity3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text4 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5.Attributes.Count()); + Assert.AreEqual("aw:USPrice", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5Text0.NodeType); + Assert.AreEqual("148.95", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awUSPrice5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text6 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7.Attributes.Count()); + Assert.AreEqual("aw:Comment", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7Text0.NodeType); + Assert.AreEqual("Confirm this is electric", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1awComment7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text8 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem1Text8.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7Text2 = documentawPurchaseOrders0awPurchaseOrder1awItems7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3 = documentawPurchaseOrders0awPurchaseOrder1awItems7.ChildNodes[3] as IElement; + Assert.AreEqual(9, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.Attributes.Count()); + Assert.AreEqual("aw:Item", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.NodeType); + Assert.AreEqual("926-AA", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.GetAttribute("aw:PartNumber")); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1.Attributes.Count()); + Assert.AreEqual("aw:ProductName", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1Text0.NodeType); + Assert.AreEqual("Baby Monitor", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awProductName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text2 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3.Attributes.Count()); + Assert.AreEqual("aw:Quantity", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3Text0.NodeType); + Assert.AreEqual("2", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awQuantity3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text4 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5.Attributes.Count()); + Assert.AreEqual("aw:USPrice", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5Text0.NodeType); + Assert.AreEqual("39.98", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awUSPrice5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text6 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7.Attributes.Count()); + Assert.AreEqual("aw:ShipDate", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7Text0 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7Text0.NodeType); + Assert.AreEqual("1999-05-21", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3awShipDate7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text8 = documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7awItem3Text8.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1awItems7Text4 = documentawPurchaseOrders0awPurchaseOrder1awItems7.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1awItems7Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1awItems7Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder1Text8 = documentawPurchaseOrders0awPurchaseOrder1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder1Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder1Text8.TextContent); + + var documentawPurchaseOrders0Text2 = documentawPurchaseOrders0.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3 = documentawPurchaseOrders0.ChildNodes[3] as IElement; + Assert.AreEqual(9, documentawPurchaseOrders0awPurchaseOrder3.ChildNodes.Length); + Assert.AreEqual(2, documentawPurchaseOrders0awPurchaseOrder3.Attributes.Count()); + Assert.AreEqual("aw:PurchaseOrder", documentawPurchaseOrders0awPurchaseOrder3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3.NodeType); + Assert.AreEqual("99505", documentawPurchaseOrders0awPurchaseOrder3.GetAttribute("aw:PurchaseOrderNumber")); + Assert.AreEqual("1999-10-22", documentawPurchaseOrders0awPurchaseOrder3.GetAttribute("aw:OrderDate")); + + var documentawPurchaseOrders0awPurchaseOrder3Text0 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress1.Attributes.Count()); + Assert.AreEqual("aw:Address", documentawPurchaseOrders0awPurchaseOrder3awAddress1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress1.NodeType); + Assert.AreEqual("Shipping", documentawPurchaseOrders0awPurchaseOrder3awAddress1.GetAttribute("aw:Type")); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1.Attributes.Count()); + Assert.AreEqual("aw:Name", documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1Text0.NodeType); + Assert.AreEqual("Cristian Osorio", documentawPurchaseOrders0awPurchaseOrder3awAddress1awName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1Text2 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress1Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3.Attributes.Count()); + Assert.AreEqual("aw:Street", documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3Text0.NodeType); + Assert.AreEqual("456 Main Street", documentawPurchaseOrders0awPurchaseOrder3awAddress1awStreet3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1Text4 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress1Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5.Attributes.Count()); + Assert.AreEqual("aw:City", documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5Text0.NodeType); + Assert.AreEqual("Buffalo", documentawPurchaseOrders0awPurchaseOrder3awAddress1awCity5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1Text6 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress1Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7.Attributes.Count()); + Assert.AreEqual("aw:State", documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7Text0.NodeType); + Assert.AreEqual("NY", documentawPurchaseOrders0awPurchaseOrder3awAddress1awState7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1Text8 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress1Text8.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9.Attributes.Count()); + Assert.AreEqual("aw:Zip", documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9Text0.NodeType); + Assert.AreEqual("98112", documentawPurchaseOrders0awPurchaseOrder3awAddress1awZip9Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1Text10 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1Text10.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress1Text10.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11.Attributes.Count()); + Assert.AreEqual("aw:Country", documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11Text0.NodeType); + Assert.AreEqual("USA", documentawPurchaseOrders0awPurchaseOrder3awAddress1awCountry11Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress1Text12 = documentawPurchaseOrders0awPurchaseOrder3awAddress1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress1Text12.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress1Text12.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3Text2 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[3] as IElement; + Assert.AreEqual(13, documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress3.Attributes.Count()); + Assert.AreEqual("aw:Address", documentawPurchaseOrders0awPurchaseOrder3awAddress3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress3.NodeType); + Assert.AreEqual("Billing", documentawPurchaseOrders0awPurchaseOrder3awAddress3.GetAttribute("aw:Type")); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1.Attributes.Count()); + Assert.AreEqual("aw:Name", documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1Text0.NodeType); + Assert.AreEqual("Cristian Osorio", documentawPurchaseOrders0awPurchaseOrder3awAddress3awName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3Text2 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress3Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3.Attributes.Count()); + Assert.AreEqual("aw:Street", documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3Text0.NodeType); + Assert.AreEqual("456 Main Street", documentawPurchaseOrders0awPurchaseOrder3awAddress3awStreet3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3Text4 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress3Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5.Attributes.Count()); + Assert.AreEqual("aw:City", documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5Text0.NodeType); + Assert.AreEqual("Buffalo", documentawPurchaseOrders0awPurchaseOrder3awAddress3awCity5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3Text6 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress3Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7.Attributes.Count()); + Assert.AreEqual("aw:State", documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7Text0.NodeType); + Assert.AreEqual("NY", documentawPurchaseOrders0awPurchaseOrder3awAddress3awState7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3Text8 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress3Text8.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9.Attributes.Count()); + Assert.AreEqual("aw:Zip", documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9Text0.NodeType); + Assert.AreEqual("98112", documentawPurchaseOrders0awPurchaseOrder3awAddress3awZip9Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3Text10 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3Text10.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress3Text10.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11.Attributes.Count()); + Assert.AreEqual("aw:Country", documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11Text0 = documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11Text0.NodeType); + Assert.AreEqual("USA", documentawPurchaseOrders0awPurchaseOrder3awAddress3awCountry11Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awAddress3Text12 = documentawPurchaseOrders0awPurchaseOrder3awAddress3.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awAddress3Text12.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awAddress3Text12.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3Text4 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5.Attributes.Count()); + Assert.AreEqual("aw:DeliveryNotes", documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5Text0 = documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5Text0.NodeType); + Assert.AreEqual("Please notify me before shipping.", documentawPurchaseOrders0awPurchaseOrder3awDeliveryNotes5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3Text6 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[7] as IElement; + Assert.AreEqual(3, documentawPurchaseOrders0awPurchaseOrder3awItems7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awItems7.Attributes.Count()); + Assert.AreEqual("aw:Items", documentawPurchaseOrders0awPurchaseOrder3awItems7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awItems7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7Text0 = documentawPurchaseOrders0awPurchaseOrder3awItems7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awItems7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1 = documentawPurchaseOrders0awPurchaseOrder3awItems7.ChildNodes[1] as IElement; + Assert.AreEqual(7, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.Attributes.Count()); + Assert.AreEqual("aw:Item", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.NodeType); + Assert.AreEqual("456-NM", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.GetAttribute("aw:PartNumber")); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text0 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1.Attributes.Count()); + Assert.AreEqual("aw:ProductName", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1Text0 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1Text0.NodeType); + Assert.AreEqual("Power Supply", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awProductName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text2 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3.Attributes.Count()); + Assert.AreEqual("aw:Quantity", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3Text0 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3Text0.NodeType); + Assert.AreEqual("1", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awQuantity3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text4 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5.Attributes.Count()); + Assert.AreEqual("aw:USPrice", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5Text0 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5Text0.NodeType); + Assert.AreEqual("45.99", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1awUSPrice5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text6 = documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awItems7awItem1Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3awItems7Text2 = documentawPurchaseOrders0awPurchaseOrder3awItems7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3awItems7Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3awItems7Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder3Text8 = documentawPurchaseOrders0awPurchaseOrder3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder3Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder3Text8.TextContent); + + var documentawPurchaseOrders0Text4 = documentawPurchaseOrders0.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5 = documentawPurchaseOrders0.ChildNodes[5] as IElement; + Assert.AreEqual(7, documentawPurchaseOrders0awPurchaseOrder5.ChildNodes.Length); + Assert.AreEqual(2, documentawPurchaseOrders0awPurchaseOrder5.Attributes.Count()); + Assert.AreEqual("aw:PurchaseOrder", documentawPurchaseOrders0awPurchaseOrder5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5.NodeType); + Assert.AreEqual("99504", documentawPurchaseOrders0awPurchaseOrder5.GetAttribute("aw:PurchaseOrderNumber")); + Assert.AreEqual("1999-10-22", documentawPurchaseOrders0awPurchaseOrder5.GetAttribute("aw:OrderDate")); + + var documentawPurchaseOrders0awPurchaseOrder5Text0 = documentawPurchaseOrders0awPurchaseOrder5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1 = documentawPurchaseOrders0awPurchaseOrder5.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress1.Attributes.Count()); + Assert.AreEqual("aw:Address", documentawPurchaseOrders0awPurchaseOrder5awAddress1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress1.NodeType); + Assert.AreEqual("Shipping", documentawPurchaseOrders0awPurchaseOrder5awAddress1.GetAttribute("aw:Type")); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1.Attributes.Count()); + Assert.AreEqual("aw:Name", documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1Text0.NodeType); + Assert.AreEqual("Jessica Arnold", documentawPurchaseOrders0awPurchaseOrder5awAddress1awName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1Text2 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress1Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3.Attributes.Count()); + Assert.AreEqual("aw:Street", documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3Text0.NodeType); + Assert.AreEqual("4055 Madison Ave", documentawPurchaseOrders0awPurchaseOrder5awAddress1awStreet3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1Text4 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress1Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5.Attributes.Count()); + Assert.AreEqual("aw:City", documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5Text0.NodeType); + Assert.AreEqual("Seattle", documentawPurchaseOrders0awPurchaseOrder5awAddress1awCity5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1Text6 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress1Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7.Attributes.Count()); + Assert.AreEqual("aw:State", documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7Text0.NodeType); + Assert.AreEqual("WA", documentawPurchaseOrders0awPurchaseOrder5awAddress1awState7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1Text8 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress1Text8.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9.Attributes.Count()); + Assert.AreEqual("aw:Zip", documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9Text0.NodeType); + Assert.AreEqual("98112", documentawPurchaseOrders0awPurchaseOrder5awAddress1awZip9Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1Text10 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1Text10.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress1Text10.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11.Attributes.Count()); + Assert.AreEqual("aw:Country", documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11Text0.NodeType); + Assert.AreEqual("USA", documentawPurchaseOrders0awPurchaseOrder5awAddress1awCountry11Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress1Text12 = documentawPurchaseOrders0awPurchaseOrder5awAddress1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress1Text12.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress1Text12.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5Text2 = documentawPurchaseOrders0awPurchaseOrder5.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3 = documentawPurchaseOrders0awPurchaseOrder5.ChildNodes[3] as IElement; + Assert.AreEqual(13, documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress3.Attributes.Count()); + Assert.AreEqual("aw:Address", documentawPurchaseOrders0awPurchaseOrder5awAddress3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress3.NodeType); + Assert.AreEqual("Billing", documentawPurchaseOrders0awPurchaseOrder5awAddress3.GetAttribute("aw:Type")); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1.Attributes.Count()); + Assert.AreEqual("aw:Name", documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1Text0.NodeType); + Assert.AreEqual("Jessica Arnold", documentawPurchaseOrders0awPurchaseOrder5awAddress3awName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3Text2 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress3Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3.Attributes.Count()); + Assert.AreEqual("aw:Street", documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3Text0.NodeType); + Assert.AreEqual("4055 Madison Ave", documentawPurchaseOrders0awPurchaseOrder5awAddress3awStreet3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3Text4 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress3Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5.Attributes.Count()); + Assert.AreEqual("aw:City", documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5Text0.NodeType); + Assert.AreEqual("Buffalo", documentawPurchaseOrders0awPurchaseOrder5awAddress3awCity5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3Text6 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress3Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7.Attributes.Count()); + Assert.AreEqual("aw:State", documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7Text0.NodeType); + Assert.AreEqual("NY", documentawPurchaseOrders0awPurchaseOrder5awAddress3awState7Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3Text8 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3Text8.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress3Text8.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[9] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9.Attributes.Count()); + Assert.AreEqual("aw:Zip", documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9Text0.NodeType); + Assert.AreEqual("98112", documentawPurchaseOrders0awPurchaseOrder5awAddress3awZip9Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3Text10 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3Text10.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress3Text10.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[11] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11.Attributes.Count()); + Assert.AreEqual("aw:Country", documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11Text0 = documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11Text0.NodeType); + Assert.AreEqual("USA", documentawPurchaseOrders0awPurchaseOrder5awAddress3awCountry11Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awAddress3Text12 = documentawPurchaseOrders0awPurchaseOrder5awAddress3.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awAddress3Text12.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awAddress3Text12.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5Text4 = documentawPurchaseOrders0awPurchaseOrder5.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5 = documentawPurchaseOrders0awPurchaseOrder5.ChildNodes[5] as IElement; + Assert.AreEqual(5, documentawPurchaseOrders0awPurchaseOrder5awItems5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awItems5.Attributes.Count()); + Assert.AreEqual("aw:Items", documentawPurchaseOrders0awPurchaseOrder5awItems5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1 = documentawPurchaseOrders0awPurchaseOrder5awItems5.ChildNodes[1] as IElement; + Assert.AreEqual(7, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.Attributes.Count()); + Assert.AreEqual("aw:Item", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.NodeType); + Assert.AreEqual("898-AZ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.GetAttribute("aw:PartNumber")); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1.Attributes.Count()); + Assert.AreEqual("aw:ProductName", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1Text0.NodeType); + Assert.AreEqual("Computer Keyboard", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awProductName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text2 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3.Attributes.Count()); + Assert.AreEqual("aw:Quantity", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3Text0.NodeType); + Assert.AreEqual("1", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awQuantity3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text4 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5.Attributes.Count()); + Assert.AreEqual("aw:USPrice", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5Text0.NodeType); + Assert.AreEqual("29.99", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1awUSPrice5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text6 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem1Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5Text2 = documentawPurchaseOrders0awPurchaseOrder5awItems5.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3 = documentawPurchaseOrders0awPurchaseOrder5awItems5.ChildNodes[3] as IElement; + Assert.AreEqual(7, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.ChildNodes.Length); + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.Attributes.Count()); + Assert.AreEqual("aw:Item", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.NodeType); + Assert.AreEqual("898-AM", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.GetAttribute("aw:PartNumber")); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text0.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1.Attributes.Count()); + Assert.AreEqual("aw:ProductName", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1Text0.NodeType); + Assert.AreEqual("Wireless Mouse", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awProductName1Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text2 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text2.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text2.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3.Attributes.Count()); + Assert.AreEqual("aw:Quantity", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3Text0.NodeType); + Assert.AreEqual("1", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awQuantity3Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text4 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5.ChildNodes.Length); + Assert.AreEqual(0, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5.Attributes.Count()); + Assert.AreEqual("aw:USPrice", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5.NodeName); + Assert.AreEqual(NodeType.Element, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5.NodeType); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5Text0 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5Text0.NodeType); + Assert.AreEqual("14.99", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3awUSPrice5Text0.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text6 = documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5awItem3Text6.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5awItems5Text4 = documentawPurchaseOrders0awPurchaseOrder5awItems5.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5awItems5Text4.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5awItems5Text4.TextContent); + + var documentawPurchaseOrders0awPurchaseOrder5Text6 = documentawPurchaseOrders0awPurchaseOrder5.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0awPurchaseOrder5Text6.NodeType); + Assert.AreEqual("\n ", documentawPurchaseOrders0awPurchaseOrder5Text6.TextContent); + + var documentawPurchaseOrders0Text6 = documentawPurchaseOrders0.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentawPurchaseOrders0Text6.NodeType); + Assert.AreEqual("\n", documentawPurchaseOrders0Text6.TextContent); + } + + [Test] + public void XmlTestConfiguration() + { + var document = (@" + + + Convert number to string + Examp1.EXE + 1 + One + + + Find succeeding characters + Examp2.EXE + abc + def + + + Convert multiple numbers to strings + Examp2.EXE /Verbose + 123 + One Two Three + + + Find correlated key + Examp3.EXE + a1 + b1 + + + Count characters + FinalExamp.EXE + This is a test + 14 + + + Another Test + Examp2.EXE + Test Input + 10 + +").ToXmlDocument(); + + var documentTests0 = document.ChildNodes[0] as IElement; + Assert.AreEqual(13, documentTests0.ChildNodes.Length); + Assert.AreEqual(0, documentTests0.Attributes.Count()); + Assert.AreEqual("Tests", documentTests0.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0.NodeType); + + var documentTests0Text0 = documentTests0.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Text0.NodeType); + Assert.AreEqual("\n ", documentTests0Text0.TextContent); + + var documentTests0Test1 = documentTests0.ChildNodes[1] as IElement; + Assert.AreEqual(9, documentTests0Test1.ChildNodes.Length); + Assert.AreEqual(2, documentTests0Test1.Attributes.Count()); + Assert.AreEqual("Test", documentTests0Test1.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test1.NodeType); + Assert.AreEqual("0001", documentTests0Test1.GetAttribute("TestId")); + Assert.AreEqual("CMD", documentTests0Test1.GetAttribute("TestType")); + + var documentTests0Test1Text0 = documentTests0Test1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test1Text0.NodeType); + Assert.AreEqual("\n ", documentTests0Test1Text0.TextContent); + + var documentTests0Test1Name1 = documentTests0Test1.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentTests0Test1Name1.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test1Name1.Attributes.Count()); + Assert.AreEqual("Name", documentTests0Test1Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test1Name1.NodeType); + + var documentTests0Test1Name1Text0 = documentTests0Test1Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test1Name1Text0.NodeType); + Assert.AreEqual("Convert number to string", documentTests0Test1Name1Text0.TextContent); + + var documentTests0Test1Text2 = documentTests0Test1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentTests0Test1Text2.NodeType); + Assert.AreEqual("\n ", documentTests0Test1Text2.TextContent); + + var documentTests0Test1CommandLine3 = documentTests0Test1.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentTests0Test1CommandLine3.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test1CommandLine3.Attributes.Count()); + Assert.AreEqual("CommandLine", documentTests0Test1CommandLine3.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test1CommandLine3.NodeType); + + var documentTests0Test1CommandLine3Text0 = documentTests0Test1CommandLine3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test1CommandLine3Text0.NodeType); + Assert.AreEqual("Examp1.EXE", documentTests0Test1CommandLine3Text0.TextContent); + + var documentTests0Test1Text4 = documentTests0Test1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentTests0Test1Text4.NodeType); + Assert.AreEqual("\n ", documentTests0Test1Text4.TextContent); + + var documentTests0Test1Input5 = documentTests0Test1.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentTests0Test1Input5.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test1Input5.Attributes.Count()); + Assert.AreEqual("Input", documentTests0Test1Input5.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test1Input5.NodeType); + + var documentTests0Test1Input5Text0 = documentTests0Test1Input5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test1Input5Text0.NodeType); + Assert.AreEqual("1", documentTests0Test1Input5Text0.TextContent); + + var documentTests0Test1Text6 = documentTests0Test1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentTests0Test1Text6.NodeType); + Assert.AreEqual("\n ", documentTests0Test1Text6.TextContent); + + var documentTests0Test1Output7 = documentTests0Test1.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentTests0Test1Output7.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test1Output7.Attributes.Count()); + Assert.AreEqual("Output", documentTests0Test1Output7.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test1Output7.NodeType); + + var documentTests0Test1Output7Text0 = documentTests0Test1Output7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test1Output7Text0.NodeType); + Assert.AreEqual("One", documentTests0Test1Output7Text0.TextContent); + + var documentTests0Test1Text8 = documentTests0Test1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentTests0Test1Text8.NodeType); + Assert.AreEqual("\n ", documentTests0Test1Text8.TextContent); + + var documentTests0Text2 = documentTests0.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentTests0Text2.NodeType); + Assert.AreEqual("\n ", documentTests0Text2.TextContent); + + var documentTests0Test3 = documentTests0.ChildNodes[3] as IElement; + Assert.AreEqual(9, documentTests0Test3.ChildNodes.Length); + Assert.AreEqual(2, documentTests0Test3.Attributes.Count()); + Assert.AreEqual("Test", documentTests0Test3.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test3.NodeType); + Assert.AreEqual("0002", documentTests0Test3.GetAttribute("TestId")); + Assert.AreEqual("CMD", documentTests0Test3.GetAttribute("TestType")); + + var documentTests0Test3Text0 = documentTests0Test3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test3Text0.NodeType); + Assert.AreEqual("\n ", documentTests0Test3Text0.TextContent); + + var documentTests0Test3Name1 = documentTests0Test3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentTests0Test3Name1.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test3Name1.Attributes.Count()); + Assert.AreEqual("Name", documentTests0Test3Name1.NodeName); + + Assert.AreEqual(NodeType.Element, documentTests0Test3Name1.NodeType); + var documentTests0Test3Name1Text0 = documentTests0Test3Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test3Name1Text0.NodeType); + Assert.AreEqual("Find succeeding characters", documentTests0Test3Name1Text0.TextContent); + + var documentTests0Test3Text2 = documentTests0Test3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentTests0Test3Text2.NodeType); + Assert.AreEqual("\n ", documentTests0Test3Text2.TextContent); + + var documentTests0Test3CommandLine3 = documentTests0Test3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentTests0Test3CommandLine3.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test3CommandLine3.Attributes.Count()); + Assert.AreEqual("CommandLine", documentTests0Test3CommandLine3.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test3CommandLine3.NodeType); + + var documentTests0Test3CommandLine3Text0 = documentTests0Test3CommandLine3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test3CommandLine3Text0.NodeType); + Assert.AreEqual("Examp2.EXE", documentTests0Test3CommandLine3Text0.TextContent); + + var documentTests0Test3Text4 = documentTests0Test3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentTests0Test3Text4.NodeType); + Assert.AreEqual("\n ", documentTests0Test3Text4.TextContent); + + var documentTests0Test3Input5 = documentTests0Test3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentTests0Test3Input5.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test3Input5.Attributes.Count()); + Assert.AreEqual("Input", documentTests0Test3Input5.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test3Input5.NodeType); + + var documentTests0Test3Input5Text0 = documentTests0Test3Input5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test3Input5Text0.NodeType); + Assert.AreEqual("abc", documentTests0Test3Input5Text0.TextContent); + + var documentTests0Test3Text6 = documentTests0Test3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentTests0Test3Text6.NodeType); + Assert.AreEqual("\n ", documentTests0Test3Text6.TextContent); + + var documentTests0Test3Output7 = documentTests0Test3.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentTests0Test3Output7.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test3Output7.Attributes.Count()); + Assert.AreEqual("Output", documentTests0Test3Output7.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test3Output7.NodeType); + + var documentTests0Test3Output7Text0 = documentTests0Test3Output7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test3Output7Text0.NodeType); + Assert.AreEqual("def", documentTests0Test3Output7Text0.TextContent); + + var documentTests0Test3Text8 = documentTests0Test3.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentTests0Test3Text8.NodeType); + Assert.AreEqual("\n ", documentTests0Test3Text8.TextContent); + + var documentTests0Text4 = documentTests0.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentTests0Text4.NodeType); + Assert.AreEqual("\n ", documentTests0Text4.TextContent); + + var documentTests0Test5 = documentTests0.ChildNodes[5] as IElement; + Assert.AreEqual(9, documentTests0Test5.ChildNodes.Length); + Assert.AreEqual(2, documentTests0Test5.Attributes.Count()); + Assert.AreEqual("Test", documentTests0Test5.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test5.NodeType); + Assert.AreEqual("0003", documentTests0Test5.GetAttribute("TestId")); + Assert.AreEqual("GUI", documentTests0Test5.GetAttribute("TestType")); + + var documentTests0Test5Text0 = documentTests0Test5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test5Text0.NodeType); + Assert.AreEqual("\n ", documentTests0Test5Text0.TextContent); + + var documentTests0Test5Name1 = documentTests0Test5.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentTests0Test5Name1.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test5Name1.Attributes.Count()); + Assert.AreEqual("Name", documentTests0Test5Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test5Name1.NodeType); + + var documentTests0Test5Name1Text0 = documentTests0Test5Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test5Name1Text0.NodeType); + Assert.AreEqual("Convert multiple numbers to strings", documentTests0Test5Name1Text0.TextContent); + + var documentTests0Test5Text2 = documentTests0Test5.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentTests0Test5Text2.NodeType); + Assert.AreEqual("\n ", documentTests0Test5Text2.TextContent); + + var documentTests0Test5CommandLine3 = documentTests0Test5.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentTests0Test5CommandLine3.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test5CommandLine3.Attributes.Count()); + Assert.AreEqual("CommandLine", documentTests0Test5CommandLine3.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test5CommandLine3.NodeType); + + var documentTests0Test5CommandLine3Text0 = documentTests0Test5CommandLine3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test5CommandLine3Text0.NodeType); + Assert.AreEqual("Examp2.EXE /Verbose", documentTests0Test5CommandLine3Text0.TextContent); + + var documentTests0Test5Text4 = documentTests0Test5.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentTests0Test5Text4.NodeType); + Assert.AreEqual("\n ", documentTests0Test5Text4.TextContent); + + var documentTests0Test5Input5 = documentTests0Test5.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentTests0Test5Input5.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test5Input5.Attributes.Count()); + Assert.AreEqual("Input", documentTests0Test5Input5.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test5Input5.NodeType); + + var documentTests0Test5Input5Text0 = documentTests0Test5Input5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test5Input5Text0.NodeType); + Assert.AreEqual("123", documentTests0Test5Input5Text0.TextContent); + + var documentTests0Test5Text6 = documentTests0Test5.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentTests0Test5Text6.NodeType); + Assert.AreEqual("\n ", documentTests0Test5Text6.TextContent); + + var documentTests0Test5Output7 = documentTests0Test5.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentTests0Test5Output7.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test5Output7.Attributes.Count()); + Assert.AreEqual("Output", documentTests0Test5Output7.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test5Output7.NodeType); + + var documentTests0Test5Output7Text0 = documentTests0Test5Output7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test5Output7Text0.NodeType); + Assert.AreEqual("One Two Three", documentTests0Test5Output7Text0.TextContent); + + var documentTests0Test5Text8 = documentTests0Test5.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentTests0Test5Text8.NodeType); + Assert.AreEqual("\n ", documentTests0Test5Text8.TextContent); + + var documentTests0Text6 = documentTests0.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentTests0Text6.NodeType); + Assert.AreEqual("\n ", documentTests0Text6.TextContent); + + var documentTests0Test7 = documentTests0.ChildNodes[7] as IElement; + Assert.AreEqual(9, documentTests0Test7.ChildNodes.Length); + Assert.AreEqual(2, documentTests0Test7.Attributes.Count()); + Assert.AreEqual("Test", documentTests0Test7.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test7.NodeType); + Assert.AreEqual("0004", documentTests0Test7.GetAttribute("TestId")); + Assert.AreEqual("GUI", documentTests0Test7.GetAttribute("TestType")); + + var documentTests0Test7Text0 = documentTests0Test7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test7Text0.NodeType); + Assert.AreEqual("\n ", documentTests0Test7Text0.TextContent); + + var documentTests0Test7Name1 = documentTests0Test7.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentTests0Test7Name1.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test7Name1.Attributes.Count()); + Assert.AreEqual("Name", documentTests0Test7Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test7Name1.NodeType); + + var documentTests0Test7Name1Text0 = documentTests0Test7Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test7Name1Text0.NodeType); + Assert.AreEqual("Find correlated key", documentTests0Test7Name1Text0.TextContent); + + var documentTests0Test7Text2 = documentTests0Test7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentTests0Test7Text2.NodeType); + Assert.AreEqual("\n ", documentTests0Test7Text2.TextContent); + + var documentTests0Test7CommandLine3 = documentTests0Test7.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentTests0Test7CommandLine3.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test7CommandLine3.Attributes.Count()); + Assert.AreEqual("CommandLine", documentTests0Test7CommandLine3.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test7CommandLine3.NodeType); + + var documentTests0Test7CommandLine3Text0 = documentTests0Test7CommandLine3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test7CommandLine3Text0.NodeType); + Assert.AreEqual("Examp3.EXE", documentTests0Test7CommandLine3Text0.TextContent); + + var documentTests0Test7Text4 = documentTests0Test7.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentTests0Test7Text4.NodeType); + Assert.AreEqual("\n ", documentTests0Test7Text4.TextContent); + + var documentTests0Test7Input5 = documentTests0Test7.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentTests0Test7Input5.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test7Input5.Attributes.Count()); + Assert.AreEqual("Input", documentTests0Test7Input5.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test7Input5.NodeType); + + var documentTests0Test7Input5Text0 = documentTests0Test7Input5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test7Input5Text0.NodeType); + Assert.AreEqual("a1", documentTests0Test7Input5Text0.TextContent); + + var documentTests0Test7Text6 = documentTests0Test7.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentTests0Test7Text6.NodeType); + Assert.AreEqual("\n ", documentTests0Test7Text6.TextContent); + + var documentTests0Test7Output7 = documentTests0Test7.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentTests0Test7Output7.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test7Output7.Attributes.Count()); + Assert.AreEqual("Output", documentTests0Test7Output7.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test7Output7.NodeType); + + var documentTests0Test7Output7Text0 = documentTests0Test7Output7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test7Output7Text0.NodeType); + Assert.AreEqual("b1", documentTests0Test7Output7Text0.TextContent); + + var documentTests0Test7Text8 = documentTests0Test7.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentTests0Test7Text8.NodeType); + Assert.AreEqual("\n ", documentTests0Test7Text8.TextContent); + + var documentTests0Text8 = documentTests0.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentTests0Text8.NodeType); + Assert.AreEqual("\n ", documentTests0Text8.TextContent); + + var documentTests0Test9 = documentTests0.ChildNodes[9] as IElement; + Assert.AreEqual(9, documentTests0Test9.ChildNodes.Length); + Assert.AreEqual(2, documentTests0Test9.Attributes.Count()); + Assert.AreEqual("Test", documentTests0Test9.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test9.NodeType); + Assert.AreEqual("0005", documentTests0Test9.GetAttribute("TestId")); + Assert.AreEqual("GUI", documentTests0Test9.GetAttribute("TestType")); + + var documentTests0Test9Text0 = documentTests0Test9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test9Text0.NodeType); + Assert.AreEqual("\n ", documentTests0Test9Text0.TextContent); + + var documentTests0Test9Name1 = documentTests0Test9.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentTests0Test9Name1.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test9Name1.Attributes.Count()); + Assert.AreEqual("Name", documentTests0Test9Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test9Name1.NodeType); + + var documentTests0Test9Name1Text0 = documentTests0Test9Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test9Name1Text0.NodeType); + Assert.AreEqual("Count characters", documentTests0Test9Name1Text0.TextContent); + + var documentTests0Test9Text2 = documentTests0Test9.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentTests0Test9Text2.NodeType); + Assert.AreEqual("\n ", documentTests0Test9Text2.TextContent); + + var documentTests0Test9CommandLine3 = documentTests0Test9.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentTests0Test9CommandLine3.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test9CommandLine3.Attributes.Count()); + Assert.AreEqual("CommandLine", documentTests0Test9CommandLine3.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test9CommandLine3.NodeType); + + var documentTests0Test9CommandLine3Text0 = documentTests0Test9CommandLine3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test9CommandLine3Text0.NodeType); + Assert.AreEqual("FinalExamp.EXE", documentTests0Test9CommandLine3Text0.TextContent); + + var documentTests0Test9Text4 = documentTests0Test9.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentTests0Test9Text4.NodeType); + Assert.AreEqual("\n ", documentTests0Test9Text4.TextContent); + + var documentTests0Test9Input5 = documentTests0Test9.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentTests0Test9Input5.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test9Input5.Attributes.Count()); + Assert.AreEqual("Input", documentTests0Test9Input5.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test9Input5.NodeType); + + var documentTests0Test9Input5Text0 = documentTests0Test9Input5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test9Input5Text0.NodeType); + Assert.AreEqual("This is a test", documentTests0Test9Input5Text0.TextContent); + + var documentTests0Test9Text6 = documentTests0Test9.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentTests0Test9Text6.NodeType); + Assert.AreEqual("\n ", documentTests0Test9Text6.TextContent); + + var documentTests0Test9Output7 = documentTests0Test9.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentTests0Test9Output7.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test9Output7.Attributes.Count()); + Assert.AreEqual("Output", documentTests0Test9Output7.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test9Output7.NodeType); + + var documentTests0Test9Output7Text0 = documentTests0Test9Output7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test9Output7Text0.NodeType); + Assert.AreEqual("14", documentTests0Test9Output7Text0.TextContent); + + var documentTests0Test9Text8 = documentTests0Test9.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentTests0Test9Text8.NodeType); + Assert.AreEqual("\n ", documentTests0Test9Text8.TextContent); + + var documentTests0Text10 = documentTests0.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentTests0Text10.NodeType); + Assert.AreEqual("\n ", documentTests0Text10.TextContent); + + var documentTests0Test11 = documentTests0.ChildNodes[11] as IElement; + Assert.AreEqual(9, documentTests0Test11.ChildNodes.Length); + Assert.AreEqual(2, documentTests0Test11.Attributes.Count()); + Assert.AreEqual("Test", documentTests0Test11.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test11.NodeType); + Assert.AreEqual("0006", documentTests0Test11.GetAttribute("TestId")); + Assert.AreEqual("GUI", documentTests0Test11.GetAttribute("TestType")); + + var documentTests0Test11Text0 = documentTests0Test11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test11Text0.NodeType); + Assert.AreEqual("\n ", documentTests0Test11Text0.TextContent); + + var documentTests0Test11Name1 = documentTests0Test11.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentTests0Test11Name1.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test11Name1.Attributes.Count()); + Assert.AreEqual("Name", documentTests0Test11Name1.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test11Name1.NodeType); + + var documentTests0Test11Name1Text0 = documentTests0Test11Name1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test11Name1Text0.NodeType); + Assert.AreEqual("Another Test", documentTests0Test11Name1Text0.TextContent); + + var documentTests0Test11Text2 = documentTests0Test11.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentTests0Test11Text2.NodeType); + Assert.AreEqual("\n ", documentTests0Test11Text2.TextContent); + + var documentTests0Test11CommandLine3 = documentTests0Test11.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentTests0Test11CommandLine3.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test11CommandLine3.Attributes.Count()); + Assert.AreEqual("CommandLine", documentTests0Test11CommandLine3.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test11CommandLine3.NodeType); + + var documentTests0Test11CommandLine3Text0 = documentTests0Test11CommandLine3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test11CommandLine3Text0.NodeType); + Assert.AreEqual("Examp2.EXE", documentTests0Test11CommandLine3Text0.TextContent); + + var documentTests0Test11Text4 = documentTests0Test11.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentTests0Test11Text4.NodeType); + Assert.AreEqual("\n ", documentTests0Test11Text4.TextContent); + + var documentTests0Test11Input5 = documentTests0Test11.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentTests0Test11Input5.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test11Input5.Attributes.Count()); + Assert.AreEqual("Input", documentTests0Test11Input5.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test11Input5.NodeType); + + var documentTests0Test11Input5Text0 = documentTests0Test11Input5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test11Input5Text0.NodeType); + Assert.AreEqual("Test Input", documentTests0Test11Input5Text0.TextContent); + + var documentTests0Test11Text6 = documentTests0Test11.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentTests0Test11Text6.NodeType); + Assert.AreEqual("\n ", documentTests0Test11Text6.TextContent); + + var documentTests0Test11Output7 = documentTests0Test11.ChildNodes[7] as IElement; + Assert.AreEqual(1, documentTests0Test11Output7.ChildNodes.Length); + Assert.AreEqual(0, documentTests0Test11Output7.Attributes.Count()); + Assert.AreEqual("Output", documentTests0Test11Output7.NodeName); + Assert.AreEqual(NodeType.Element, documentTests0Test11Output7.NodeType); + + var documentTests0Test11Output7Text0 = documentTests0Test11Output7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentTests0Test11Output7Text0.NodeType); + Assert.AreEqual("10", documentTests0Test11Output7Text0.TextContent); + + var documentTests0Test11Text8 = documentTests0Test11.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentTests0Test11Text8.NodeType); + Assert.AreEqual("\n ", documentTests0Test11Text8.TextContent); + + var documentTests0Text12 = documentTests0.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentTests0Text12.NodeType); + Assert.AreEqual("\n", documentTests0Text12.TextContent); + } + + [Test] + public void XmlCustomersAndOrders() + { + var document = (@" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +").ToXmlDocument(); + var documentxsschema0 = document.ChildNodes[0] as IElement; + Assert.AreEqual(11, documentxsschema0.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0.Attributes.Count()); + Assert.AreEqual("xs:schema", documentxsschema0.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0.NodeType); + Assert.AreEqual("http://www.w3.org/2001/XMLSchema", documentxsschema0.GetAttribute("xmlns:xs")); + + var documentxsschema0Text0 = documentxsschema0.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0Text0.TextContent); + + var documentxsschema0xselement1 = documentxsschema0.ChildNodes[1] as IElement; + Assert.AreEqual(7, documentxsschema0xselement1.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xselement1.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xselement1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1.NodeType); + Assert.AreEqual("Root", documentxsschema0xselement1.GetAttribute("name")); + + var documentxsschema0xselement1Text0 = documentxsschema0xselement1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1 = documentxsschema0xselement1.ChildNodes[1] as IElement; + Assert.AreEqual(3, documentxsschema0xselement1xscomplexType1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xselement1xscomplexType1.Attributes.Count()); + Assert.AreEqual("xs:complexType", documentxsschema0xselement1xscomplexType1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1.NodeType); + + var documentxsschema0xselement1xscomplexType1Text0 = documentxsschema0xselement1xscomplexType1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1 = documentxsschema0xselement1xscomplexType1.ChildNodes[1] as IElement; + Assert.AreEqual(5, documentxsschema0xselement1xscomplexType1xssequence1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xselement1xscomplexType1xssequence1.Attributes.Count()); + Assert.AreEqual("xs:sequence", documentxsschema0xselement1xscomplexType1xssequence1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1.NodeType); + + var documentxsschema0xselement1xscomplexType1xssequence1Text0 = documentxsschema0xselement1xscomplexType1xssequence1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1 = documentxsschema0xselement1xscomplexType1xssequence1.ChildNodes[1] as IElement; + Assert.AreEqual(3, documentxsschema0xselement1xscomplexType1xssequence1xselement1.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xselement1xscomplexType1xssequence1xselement1.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xselement1xscomplexType1xssequence1xselement1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1xselement1.NodeType); + Assert.AreEqual("Customers", documentxsschema0xselement1xscomplexType1xssequence1xselement1.GetAttribute("name")); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1Text0 = documentxsschema0xselement1xscomplexType1xssequence1xselement1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement1Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1 = documentxsschema0xselement1xscomplexType1xssequence1xselement1.ChildNodes[1] as IElement; + Assert.AreEqual(3, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1.Attributes.Count()); + Assert.AreEqual("xs:complexType", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1.NodeType); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1Text0 = documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1 = documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1.ChildNodes[1] as IElement; + Assert.AreEqual(3, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1.Attributes.Count()); + Assert.AreEqual("xs:sequence", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1.NodeType); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1Text0 = documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1 = documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1.ChildNodes[1] as IElement; + Assert.AreEqual(0, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1.ChildNodes.Length); + Assert.AreEqual(4, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1.NodeType); + Assert.AreEqual("Customer", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1.GetAttribute("name")); + Assert.AreEqual("CustomerType", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1.GetAttribute("type")); + Assert.AreEqual("0", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1.GetAttribute("minOccurs")); + Assert.AreEqual("unbounded", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1xselement1.GetAttribute("maxOccurs")); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1Text2 = documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1xssequence1Text2.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1Text2 = documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement1xscomplexType1Text2.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement1Text2 = documentxsschema0xselement1xscomplexType1xssequence1xselement1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement1Text2.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1Text2 = documentxsschema0xselement1xscomplexType1xssequence1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1Text2.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3 = documentxsschema0xselement1xscomplexType1xssequence1.ChildNodes[3] as IElement; + Assert.AreEqual(3, documentxsschema0xselement1xscomplexType1xssequence1xselement3.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xselement1xscomplexType1xssequence1xselement3.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xselement1xscomplexType1xssequence1xselement3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1xselement3.NodeType); + Assert.AreEqual("Orders", documentxsschema0xselement1xscomplexType1xssequence1xselement3.GetAttribute("name")); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3Text0 = documentxsschema0xselement1xscomplexType1xssequence1xselement3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement3Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement3Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1 = documentxsschema0xselement1xscomplexType1xssequence1xselement3.ChildNodes[1] as IElement; + Assert.AreEqual(3, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1.Attributes.Count()); + Assert.AreEqual("xs:complexType", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1.NodeType); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1Text0 = documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1 = documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1.ChildNodes[1] as IElement; + Assert.AreEqual(3, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1.Attributes.Count()); + Assert.AreEqual("xs:sequence", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1.NodeType); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1Text0 = documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1Text0.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1 = documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1.ChildNodes[1] as IElement; + Assert.AreEqual(0, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1.ChildNodes.Length); + Assert.AreEqual(4, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1.NodeType); + Assert.AreEqual("Order", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1.GetAttribute("name")); + Assert.AreEqual("OrderType", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1.GetAttribute("type")); + Assert.AreEqual("0", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1.GetAttribute("minOccurs")); + Assert.AreEqual("unbounded", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1xselement1.GetAttribute("maxOccurs")); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1Text2 = documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1xssequence1Text2.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1Text2 = documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement3xscomplexType1Text2.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1xselement3Text2 = documentxsschema0xselement1xscomplexType1xssequence1xselement3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1xselement3Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1xselement3Text2.TextContent); + + var documentxsschema0xselement1xscomplexType1xssequence1Text4 = documentxsschema0xselement1xscomplexType1xssequence1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1xssequence1Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1xssequence1Text4.TextContent); + + var documentxsschema0xselement1xscomplexType1Text2 = documentxsschema0xselement1xscomplexType1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xscomplexType1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xscomplexType1Text2.TextContent); + + var documentxsschema0xselement1Text2 = documentxsschema0xselement1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1Text2.TextContent); + + var documentxsschema0xselement1xskey3 = documentxsschema0xselement1.ChildNodes[3] as IElement; + Assert.AreEqual(5, documentxsschema0xselement1xskey3.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xselement1xskey3.Attributes.Count()); + Assert.AreEqual("xs:key", documentxsschema0xselement1xskey3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xskey3.NodeType); + Assert.AreEqual("CustomerIDKey", documentxsschema0xselement1xskey3.GetAttribute("name")); + + var documentxsschema0xselement1xskey3Text0 = documentxsschema0xselement1xskey3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xskey3Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xskey3Text0.TextContent); + + var documentxsschema0xselement1xskey3xsselector1 = documentxsschema0xselement1xskey3.ChildNodes[1] as IElement; + Assert.AreEqual(0, documentxsschema0xselement1xskey3xsselector1.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xselement1xskey3xsselector1.Attributes.Count()); + Assert.AreEqual("xs:selector", documentxsschema0xselement1xskey3xsselector1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xskey3xsselector1.NodeType); + Assert.AreEqual("Customers/Customer", documentxsschema0xselement1xskey3xsselector1.GetAttribute("xpath")); + + var documentxsschema0xselement1xskey3Text2 = documentxsschema0xselement1xskey3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xskey3Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xskey3Text2.TextContent); + + var documentxsschema0xselement1xskey3xsfield3 = documentxsschema0xselement1xskey3.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xselement1xskey3xsfield3.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xselement1xskey3xsfield3.Attributes.Count()); + Assert.AreEqual("xs:field", documentxsschema0xselement1xskey3xsfield3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xskey3xsfield3.NodeType); + Assert.AreEqual("@CustomerID", documentxsschema0xselement1xskey3xsfield3.GetAttribute("xpath")); + + var documentxsschema0xselement1xskey3Text4 = documentxsschema0xselement1xskey3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xskey3Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xskey3Text4.TextContent); + + var documentxsschema0xselement1Text4 = documentxsschema0xselement1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1Text4.TextContent); + + var documentxsschema0xselement1xskeyref5 = documentxsschema0xselement1.ChildNodes[5] as IElement; + Assert.AreEqual(5, documentxsschema0xselement1xskeyref5.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xselement1xskeyref5.Attributes.Count()); + Assert.AreEqual("xs:keyref", documentxsschema0xselement1xskeyref5.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xskeyref5.NodeType); + Assert.AreEqual("CustomerIDKeyRef", documentxsschema0xselement1xskeyref5.GetAttribute("name")); + Assert.AreEqual("CustomerIDKey", documentxsschema0xselement1xskeyref5.GetAttribute("refer")); + + var documentxsschema0xselement1xskeyref5Text0 = documentxsschema0xselement1xskeyref5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xskeyref5Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xskeyref5Text0.TextContent); + + var documentxsschema0xselement1xskeyref5xsselector1 = documentxsschema0xselement1xskeyref5.ChildNodes[1] as IElement; + Assert.AreEqual(0, documentxsschema0xselement1xskeyref5xsselector1.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xselement1xskeyref5xsselector1.Attributes.Count()); + Assert.AreEqual("xs:selector", documentxsschema0xselement1xskeyref5xsselector1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xskeyref5xsselector1.NodeType); + Assert.AreEqual("Orders/Order", documentxsschema0xselement1xskeyref5xsselector1.GetAttribute("xpath")); + + var documentxsschema0xselement1xskeyref5Text2 = documentxsschema0xselement1xskeyref5.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xskeyref5Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xskeyref5Text2.TextContent); + + var documentxsschema0xselement1xskeyref5xsfield3 = documentxsschema0xselement1xskeyref5.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xselement1xskeyref5xsfield3.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xselement1xskeyref5xsfield3.Attributes.Count()); + Assert.AreEqual("xs:field", documentxsschema0xselement1xskeyref5xsfield3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xselement1xskeyref5xsfield3.NodeType); + Assert.AreEqual("CustomerID", documentxsschema0xselement1xskeyref5xsfield3.GetAttribute("xpath")); + + var documentxsschema0xselement1xskeyref5Text4 = documentxsschema0xselement1xskeyref5.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1xskeyref5Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1xskeyref5Text4.TextContent); + + var documentxsschema0xselement1Text6 = documentxsschema0xselement1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentxsschema0xselement1Text6.NodeType); + Assert.AreEqual("\n ", documentxsschema0xselement1Text6.TextContent); + + var documentxsschema0Text2 = documentxsschema0.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0Text2.TextContent); + + var documentxsschema0xscomplexType3 = documentxsschema0.ChildNodes[3] as IElement; + Assert.AreEqual(5, documentxsschema0xscomplexType3.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xscomplexType3.Attributes.Count()); + Assert.AreEqual("xs:complexType", documentxsschema0xscomplexType3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3.NodeType); + Assert.AreEqual("CustomerType", documentxsschema0xscomplexType3.GetAttribute("name")); + + var documentxsschema0xscomplexType3Text0 = documentxsschema0xscomplexType3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3Text0.TextContent); + + var documentxsschema0xscomplexType3xssequence1 = documentxsschema0xscomplexType3.ChildNodes[1] as IElement; + Assert.AreEqual(13, documentxsschema0xscomplexType3xssequence1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xscomplexType3xssequence1.Attributes.Count()); + Assert.AreEqual("xs:sequence", documentxsschema0xscomplexType3xssequence1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3xssequence1.NodeType); + + var documentxsschema0xscomplexType3xssequence1Text0 = documentxsschema0xscomplexType3xssequence1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3xssequence1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3xssequence1Text0.TextContent); + + var documentxsschema0xscomplexType3xssequence1xselement1 = documentxsschema0xscomplexType3xssequence1.ChildNodes[1] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType3xssequence1xselement1.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType3xssequence1xselement1.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType3xssequence1xselement1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3xssequence1xselement1.NodeType); + Assert.AreEqual("CompanyName", documentxsschema0xscomplexType3xssequence1xselement1.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType3xssequence1xselement1.GetAttribute("type")); + + var documentxsschema0xscomplexType3xssequence1Text2 = documentxsschema0xscomplexType3xssequence1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3xssequence1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3xssequence1Text2.TextContent); + + var documentxsschema0xscomplexType3xssequence1xselement3 = documentxsschema0xscomplexType3xssequence1.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType3xssequence1xselement3.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType3xssequence1xselement3.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType3xssequence1xselement3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3xssequence1xselement3.NodeType); + Assert.AreEqual("ContactName", documentxsschema0xscomplexType3xssequence1xselement3.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType3xssequence1xselement3.GetAttribute("type")); + + var documentxsschema0xscomplexType3xssequence1Text4 = documentxsschema0xscomplexType3xssequence1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3xssequence1Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3xssequence1Text4.TextContent); + + var documentxsschema0xscomplexType3xssequence1xselement5 = documentxsschema0xscomplexType3xssequence1.ChildNodes[5] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType3xssequence1xselement5.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType3xssequence1xselement5.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType3xssequence1xselement5.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3xssequence1xselement5.NodeType); + Assert.AreEqual("ContactTitle", documentxsschema0xscomplexType3xssequence1xselement5.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType3xssequence1xselement5.GetAttribute("type")); + + var documentxsschema0xscomplexType3xssequence1Text6 = documentxsschema0xscomplexType3xssequence1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3xssequence1Text6.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3xssequence1Text6.TextContent); + + var documentxsschema0xscomplexType3xssequence1xselement7 = documentxsschema0xscomplexType3xssequence1.ChildNodes[7] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType3xssequence1xselement7.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType3xssequence1xselement7.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType3xssequence1xselement7.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3xssequence1xselement7.NodeType); + Assert.AreEqual("Phone", documentxsschema0xscomplexType3xssequence1xselement7.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType3xssequence1xselement7.GetAttribute("type")); + + var documentxsschema0xscomplexType3xssequence1Text8 = documentxsschema0xscomplexType3xssequence1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3xssequence1Text8.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3xssequence1Text8.TextContent); + + var documentxsschema0xscomplexType3xssequence1xselement9 = documentxsschema0xscomplexType3xssequence1.ChildNodes[9] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType3xssequence1xselement9.ChildNodes.Length); + Assert.AreEqual(3, documentxsschema0xscomplexType3xssequence1xselement9.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType3xssequence1xselement9.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3xssequence1xselement9.NodeType); + Assert.AreEqual("Fax", documentxsschema0xscomplexType3xssequence1xselement9.GetAttribute("name")); + Assert.AreEqual("0", documentxsschema0xscomplexType3xssequence1xselement9.GetAttribute("minOccurs")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType3xssequence1xselement9.GetAttribute("type")); + + var documentxsschema0xscomplexType3xssequence1Text10 = documentxsschema0xscomplexType3xssequence1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3xssequence1Text10.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3xssequence1Text10.TextContent); + + var documentxsschema0xscomplexType3xssequence1xselement11 = documentxsschema0xscomplexType3xssequence1.ChildNodes[11] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType3xssequence1xselement11.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType3xssequence1xselement11.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType3xssequence1xselement11.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3xssequence1xselement11.NodeType); + Assert.AreEqual("FullAddress", documentxsschema0xscomplexType3xssequence1xselement11.GetAttribute("name")); + Assert.AreEqual("AddressType", documentxsschema0xscomplexType3xssequence1xselement11.GetAttribute("type")); + + var documentxsschema0xscomplexType3xssequence1Text12 = documentxsschema0xscomplexType3xssequence1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3xssequence1Text12.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3xssequence1Text12.TextContent); + + var documentxsschema0xscomplexType3Text2 = documentxsschema0xscomplexType3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3Text2.TextContent); + + var documentxsschema0xscomplexType3xsattribute3 = documentxsschema0xscomplexType3.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType3xsattribute3.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType3xsattribute3.Attributes.Count()); + Assert.AreEqual("xs:attribute", documentxsschema0xscomplexType3xsattribute3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType3xsattribute3.NodeType); + Assert.AreEqual("CustomerID", documentxsschema0xscomplexType3xsattribute3.GetAttribute("name")); + Assert.AreEqual("xs:token", documentxsschema0xscomplexType3xsattribute3.GetAttribute("type")); + + var documentxsschema0xscomplexType3Text4 = documentxsschema0xscomplexType3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType3Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType3Text4.TextContent); + + var documentxsschema0Text4 = documentxsschema0.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0Text4.TextContent); + + var documentxsschema0xscomplexType5 = documentxsschema0.ChildNodes[5] as IElement; + Assert.AreEqual(5, documentxsschema0xscomplexType5.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xscomplexType5.Attributes.Count()); + Assert.AreEqual("xs:complexType", documentxsschema0xscomplexType5.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType5.NodeType); + Assert.AreEqual("AddressType", documentxsschema0xscomplexType5.GetAttribute("name")); + + var documentxsschema0xscomplexType5Text0 = documentxsschema0xscomplexType5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5Text0.TextContent); + + var documentxsschema0xscomplexType5xssequence1 = documentxsschema0xscomplexType5.ChildNodes[1] as IElement; + Assert.AreEqual(11, documentxsschema0xscomplexType5xssequence1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xscomplexType5xssequence1.Attributes.Count()); + Assert.AreEqual("xs:sequence", documentxsschema0xscomplexType5xssequence1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType5xssequence1.NodeType); + + var documentxsschema0xscomplexType5xssequence1Text0 = documentxsschema0xscomplexType5xssequence1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5xssequence1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5xssequence1Text0.TextContent); + + var documentxsschema0xscomplexType5xssequence1xselement1 = documentxsschema0xscomplexType5xssequence1.ChildNodes[1] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType5xssequence1xselement1.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType5xssequence1xselement1.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType5xssequence1xselement1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType5xssequence1xselement1.NodeType); + Assert.AreEqual("Address", documentxsschema0xscomplexType5xssequence1xselement1.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType5xssequence1xselement1.GetAttribute("type")); + + var documentxsschema0xscomplexType5xssequence1Text2 = documentxsschema0xscomplexType5xssequence1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5xssequence1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5xssequence1Text2.TextContent); + + var documentxsschema0xscomplexType5xssequence1xselement3 = documentxsschema0xscomplexType5xssequence1.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType5xssequence1xselement3.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType5xssequence1xselement3.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType5xssequence1xselement3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType5xssequence1xselement3.NodeType); + Assert.AreEqual("City", documentxsschema0xscomplexType5xssequence1xselement3.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType5xssequence1xselement3.GetAttribute("type")); + + var documentxsschema0xscomplexType5xssequence1Text4 = documentxsschema0xscomplexType5xssequence1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5xssequence1Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5xssequence1Text4.TextContent); + + var documentxsschema0xscomplexType5xssequence1xselement5 = documentxsschema0xscomplexType5xssequence1.ChildNodes[5] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType5xssequence1xselement5.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType5xssequence1xselement5.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType5xssequence1xselement5.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType5xssequence1xselement5.NodeType); + Assert.AreEqual("Region", documentxsschema0xscomplexType5xssequence1xselement5.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType5xssequence1xselement5.GetAttribute("type")); + + var documentxsschema0xscomplexType5xssequence1Text6 = documentxsschema0xscomplexType5xssequence1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5xssequence1Text6.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5xssequence1Text6.TextContent); + + var documentxsschema0xscomplexType5xssequence1xselement7 = documentxsschema0xscomplexType5xssequence1.ChildNodes[7] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType5xssequence1xselement7.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType5xssequence1xselement7.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType5xssequence1xselement7.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType5xssequence1xselement7.NodeType); + Assert.AreEqual("PostalCode", documentxsschema0xscomplexType5xssequence1xselement7.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType5xssequence1xselement7.GetAttribute("type")); + + var documentxsschema0xscomplexType5xssequence1Text8 = documentxsschema0xscomplexType5xssequence1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5xssequence1Text8.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5xssequence1Text8.TextContent); + + var documentxsschema0xscomplexType5xssequence1xselement9 = documentxsschema0xscomplexType5xssequence1.ChildNodes[9] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType5xssequence1xselement9.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType5xssequence1xselement9.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType5xssequence1xselement9.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType5xssequence1xselement9.NodeType); + Assert.AreEqual("Country", documentxsschema0xscomplexType5xssequence1xselement9.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType5xssequence1xselement9.GetAttribute("type")); + + var documentxsschema0xscomplexType5xssequence1Text10 = documentxsschema0xscomplexType5xssequence1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5xssequence1Text10.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5xssequence1Text10.TextContent); + + var documentxsschema0xscomplexType5Text2 = documentxsschema0xscomplexType5.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5Text2.TextContent); + + var documentxsschema0xscomplexType5xsattribute3 = documentxsschema0xscomplexType5.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType5xsattribute3.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType5xsattribute3.Attributes.Count()); + Assert.AreEqual("xs:attribute", documentxsschema0xscomplexType5xsattribute3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType5xsattribute3.NodeType); + Assert.AreEqual("CustomerID", documentxsschema0xscomplexType5xsattribute3.GetAttribute("name")); + Assert.AreEqual("xs:token", documentxsschema0xscomplexType5xsattribute3.GetAttribute("type")); + + var documentxsschema0xscomplexType5Text4 = documentxsschema0xscomplexType5.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType5Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType5Text4.TextContent); + + var documentxsschema0Text6 = documentxsschema0.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentxsschema0Text6.NodeType); + Assert.AreEqual("\n ", documentxsschema0Text6.TextContent); + + var documentxsschema0xscomplexType7 = documentxsschema0.ChildNodes[7] as IElement; + Assert.AreEqual(3, documentxsschema0xscomplexType7.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xscomplexType7.Attributes.Count()); + Assert.AreEqual("xs:complexType", documentxsschema0xscomplexType7.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType7.NodeType); + Assert.AreEqual("OrderType", documentxsschema0xscomplexType7.GetAttribute("name")); + + var documentxsschema0xscomplexType7Text0 = documentxsschema0xscomplexType7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType7Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType7Text0.TextContent); + + var documentxsschema0xscomplexType7xssequence1 = documentxsschema0xscomplexType7.ChildNodes[1] as IElement; + Assert.AreEqual(11, documentxsschema0xscomplexType7xssequence1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xscomplexType7xssequence1.Attributes.Count()); + Assert.AreEqual("xs:sequence", documentxsschema0xscomplexType7xssequence1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType7xssequence1.NodeType); + + var documentxsschema0xscomplexType7xssequence1Text0 = documentxsschema0xscomplexType7xssequence1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType7xssequence1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType7xssequence1Text0.TextContent); + + var documentxsschema0xscomplexType7xssequence1xselement1 = documentxsschema0xscomplexType7xssequence1.ChildNodes[1] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType7xssequence1xselement1.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType7xssequence1xselement1.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType7xssequence1xselement1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType7xssequence1xselement1.NodeType); + Assert.AreEqual("CustomerID", documentxsschema0xscomplexType7xssequence1xselement1.GetAttribute("name")); + Assert.AreEqual("xs:token", documentxsschema0xscomplexType7xssequence1xselement1.GetAttribute("type")); + + var documentxsschema0xscomplexType7xssequence1Text2 = documentxsschema0xscomplexType7xssequence1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType7xssequence1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType7xssequence1Text2.TextContent); + + var documentxsschema0xscomplexType7xssequence1xselement3 = documentxsschema0xscomplexType7xssequence1.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType7xssequence1xselement3.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType7xssequence1xselement3.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType7xssequence1xselement3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType7xssequence1xselement3.NodeType); + Assert.AreEqual("EmployeeID", documentxsschema0xscomplexType7xssequence1xselement3.GetAttribute("name")); + Assert.AreEqual("xs:token", documentxsschema0xscomplexType7xssequence1xselement3.GetAttribute("type")); + + var documentxsschema0xscomplexType7xssequence1Text4 = documentxsschema0xscomplexType7xssequence1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType7xssequence1Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType7xssequence1Text4.TextContent); + + var documentxsschema0xscomplexType7xssequence1xselement5 = documentxsschema0xscomplexType7xssequence1.ChildNodes[5] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType7xssequence1xselement5.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType7xssequence1xselement5.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType7xssequence1xselement5.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType7xssequence1xselement5.NodeType); + Assert.AreEqual("OrderDate", documentxsschema0xscomplexType7xssequence1xselement5.GetAttribute("name")); + Assert.AreEqual("xs:dateTime", documentxsschema0xscomplexType7xssequence1xselement5.GetAttribute("type")); + + var documentxsschema0xscomplexType7xssequence1Text6 = documentxsschema0xscomplexType7xssequence1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType7xssequence1Text6.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType7xssequence1Text6.TextContent); + + var documentxsschema0xscomplexType7xssequence1xselement7 = documentxsschema0xscomplexType7xssequence1.ChildNodes[7] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType7xssequence1xselement7.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType7xssequence1xselement7.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType7xssequence1xselement7.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType7xssequence1xselement7.NodeType); + Assert.AreEqual("RequiredDate", documentxsschema0xscomplexType7xssequence1xselement7.GetAttribute("name")); + Assert.AreEqual("xs:dateTime", documentxsschema0xscomplexType7xssequence1xselement7.GetAttribute("type")); + + var documentxsschema0xscomplexType7xssequence1Text8 = documentxsschema0xscomplexType7xssequence1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType7xssequence1Text8.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType7xssequence1Text8.TextContent); + + var documentxsschema0xscomplexType7xssequence1xselement9 = documentxsschema0xscomplexType7xssequence1.ChildNodes[9] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType7xssequence1xselement9.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType7xssequence1xselement9.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType7xssequence1xselement9.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType7xssequence1xselement9.NodeType); + Assert.AreEqual("ShipInfo", documentxsschema0xscomplexType7xssequence1xselement9.GetAttribute("name")); + Assert.AreEqual("ShipInfoType", documentxsschema0xscomplexType7xssequence1xselement9.GetAttribute("type")); + + var documentxsschema0xscomplexType7xssequence1Text10 = documentxsschema0xscomplexType7xssequence1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType7xssequence1Text10.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType7xssequence1Text10.TextContent); + + var documentxsschema0xscomplexType7Text2 = documentxsschema0xscomplexType7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType7Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType7Text2.TextContent); + + var documentxsschema0Text8 = documentxsschema0.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentxsschema0Text8.NodeType); + Assert.AreEqual("\n ", documentxsschema0Text8.TextContent); + + var documentxsschema0xscomplexType9 = documentxsschema0.ChildNodes[9] as IElement; + Assert.AreEqual(5, documentxsschema0xscomplexType9.ChildNodes.Length); + Assert.AreEqual(1, documentxsschema0xscomplexType9.Attributes.Count()); + Assert.AreEqual("xs:complexType", documentxsschema0xscomplexType9.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9.NodeType); + Assert.AreEqual("ShipInfoType", documentxsschema0xscomplexType9.GetAttribute("name")); + + var documentxsschema0xscomplexType9Text0 = documentxsschema0xscomplexType9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9Text0.TextContent); + + var documentxsschema0xscomplexType9xssequence1 = documentxsschema0xscomplexType9.ChildNodes[1] as IElement; + Assert.AreEqual(17, documentxsschema0xscomplexType9xssequence1.ChildNodes.Length); + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1.Attributes.Count()); + Assert.AreEqual("xs:sequence", documentxsschema0xscomplexType9xssequence1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1.NodeType); + + var documentxsschema0xscomplexType9xssequence1Text0 = documentxsschema0xscomplexType9xssequence1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text0.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text0.TextContent); + + var documentxsschema0xscomplexType9xssequence1xselement1 = documentxsschema0xscomplexType9xssequence1.ChildNodes[1] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1xselement1.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xssequence1xselement1.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType9xssequence1xselement1.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1xselement1.NodeType); + Assert.AreEqual("ShipVia", documentxsschema0xscomplexType9xssequence1xselement1.GetAttribute("name")); + Assert.AreEqual("xs:integer", documentxsschema0xscomplexType9xssequence1xselement1.GetAttribute("type")); + + var documentxsschema0xscomplexType9xssequence1Text2 = documentxsschema0xscomplexType9xssequence1.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text2.TextContent); + + var documentxsschema0xscomplexType9xssequence1xselement3 = documentxsschema0xscomplexType9xssequence1.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1xselement3.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xssequence1xselement3.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType9xssequence1xselement3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1xselement3.NodeType); + Assert.AreEqual("Freight", documentxsschema0xscomplexType9xssequence1xselement3.GetAttribute("name")); + Assert.AreEqual("xs:decimal", documentxsschema0xscomplexType9xssequence1xselement3.GetAttribute("type")); + + var documentxsschema0xscomplexType9xssequence1Text4 = documentxsschema0xscomplexType9xssequence1.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text4.TextContent); + + var documentxsschema0xscomplexType9xssequence1xselement5 = documentxsschema0xscomplexType9xssequence1.ChildNodes[5] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1xselement5.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xssequence1xselement5.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType9xssequence1xselement5.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1xselement5.NodeType); + Assert.AreEqual("ShipName", documentxsschema0xscomplexType9xssequence1xselement5.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType9xssequence1xselement5.GetAttribute("type")); + + var documentxsschema0xscomplexType9xssequence1Text6 = documentxsschema0xscomplexType9xssequence1.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text6.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text6.TextContent); + + var documentxsschema0xscomplexType9xssequence1xselement7 = documentxsschema0xscomplexType9xssequence1.ChildNodes[7] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1xselement7.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xssequence1xselement7.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType9xssequence1xselement7.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1xselement7.NodeType); + Assert.AreEqual("ShipAddress", documentxsschema0xscomplexType9xssequence1xselement7.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType9xssequence1xselement7.GetAttribute("type")); + + var documentxsschema0xscomplexType9xssequence1Text8 = documentxsschema0xscomplexType9xssequence1.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text8.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text8.TextContent); + + var documentxsschema0xscomplexType9xssequence1xselement9 = documentxsschema0xscomplexType9xssequence1.ChildNodes[9] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1xselement9.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xssequence1xselement9.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType9xssequence1xselement9.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1xselement9.NodeType); + Assert.AreEqual("ShipCity", documentxsschema0xscomplexType9xssequence1xselement9.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType9xssequence1xselement9.GetAttribute("type")); + + var documentxsschema0xscomplexType9xssequence1Text10 = documentxsschema0xscomplexType9xssequence1.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text10.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text10.TextContent); + + var documentxsschema0xscomplexType9xssequence1xselement11 = documentxsschema0xscomplexType9xssequence1.ChildNodes[11] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1xselement11.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xssequence1xselement11.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType9xssequence1xselement11.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1xselement11.NodeType); + Assert.AreEqual("ShipRegion", documentxsschema0xscomplexType9xssequence1xselement11.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType9xssequence1xselement11.GetAttribute("type")); + + var documentxsschema0xscomplexType9xssequence1Text12 = documentxsschema0xscomplexType9xssequence1.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text12.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text12.TextContent); + + var documentxsschema0xscomplexType9xssequence1xselement13 = documentxsschema0xscomplexType9xssequence1.ChildNodes[13] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1xselement13.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xssequence1xselement13.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType9xssequence1xselement13.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1xselement13.NodeType); + Assert.AreEqual("ShipPostalCode", documentxsschema0xscomplexType9xssequence1xselement13.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType9xssequence1xselement13.GetAttribute("type")); + + var documentxsschema0xscomplexType9xssequence1Text14 = documentxsschema0xscomplexType9xssequence1.ChildNodes[14]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text14.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text14.TextContent); + + var documentxsschema0xscomplexType9xssequence1xselement15 = documentxsschema0xscomplexType9xssequence1.ChildNodes[15] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xssequence1xselement15.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xssequence1xselement15.Attributes.Count()); + Assert.AreEqual("xs:element", documentxsschema0xscomplexType9xssequence1xselement15.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xssequence1xselement15.NodeType); + Assert.AreEqual("ShipCountry", documentxsschema0xscomplexType9xssequence1xselement15.GetAttribute("name")); + Assert.AreEqual("xs:string", documentxsschema0xscomplexType9xssequence1xselement15.GetAttribute("type")); + + var documentxsschema0xscomplexType9xssequence1Text16 = documentxsschema0xscomplexType9xssequence1.ChildNodes[16]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9xssequence1Text16.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9xssequence1Text16.TextContent); + + var documentxsschema0xscomplexType9Text2 = documentxsschema0xscomplexType9.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9Text2.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9Text2.TextContent); + + var documentxsschema0xscomplexType9xsattribute3 = documentxsschema0xscomplexType9.ChildNodes[3] as IElement; + Assert.AreEqual(0, documentxsschema0xscomplexType9xsattribute3.ChildNodes.Length); + Assert.AreEqual(2, documentxsschema0xscomplexType9xsattribute3.Attributes.Count()); + Assert.AreEqual("xs:attribute", documentxsschema0xscomplexType9xsattribute3.NodeName); + Assert.AreEqual(NodeType.Element, documentxsschema0xscomplexType9xsattribute3.NodeType); + Assert.AreEqual("ShippedDate", documentxsschema0xscomplexType9xsattribute3.GetAttribute("name")); + Assert.AreEqual("xs:dateTime", documentxsschema0xscomplexType9xsattribute3.GetAttribute("type")); + + var documentxsschema0xscomplexType9Text4 = documentxsschema0xscomplexType9.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentxsschema0xscomplexType9Text4.NodeType); + Assert.AreEqual("\n ", documentxsschema0xscomplexType9Text4.TextContent); + + var documentxsschema0Text10 = documentxsschema0.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentxsschema0Text10.NodeType); + Assert.AreEqual("\n", documentxsschema0Text10.TextContent); + } + + [Test] + public void XmlNumericalData() + { + var document = (@" + 7.25 + + A + 3 + 24.50 + + + B + 1 + 89.99 + + + A + 5 + 4.95 + + + A + 3 + 66.00 + + + B + 10 + .99 + + + A + 15 + 29.00 + + + B + 8 + 6.99 + +").ToXmlDocument(); + + var documentRoot0 = document.ChildNodes[0] as IElement; + Assert.AreEqual(17, documentRoot0.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0.Attributes.Count()); + Assert.AreEqual("Root", documentRoot0.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0.NodeType); + + var documentRoot0Text0 = documentRoot0.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Text0.NodeType); + Assert.AreEqual("\n ", documentRoot0Text0.TextContent); + + var documentRoot0TaxRate1 = documentRoot0.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentRoot0TaxRate1.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0TaxRate1.Attributes.Count()); + Assert.AreEqual("TaxRate", documentRoot0TaxRate1.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0TaxRate1.NodeType); + + var documentRoot0TaxRate1Text0 = documentRoot0TaxRate1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0TaxRate1Text0.NodeType); + Assert.AreEqual("7.25", documentRoot0TaxRate1Text0.TextContent); + + var documentRoot0Text2 = documentRoot0.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentRoot0Text2.NodeType); + Assert.AreEqual("\n ", documentRoot0Text2.TextContent); + + var documentRoot0Data3 = documentRoot0.ChildNodes[3] as IElement; + Assert.AreEqual(7, documentRoot0Data3.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data3.Attributes.Count()); + Assert.AreEqual("Data", documentRoot0Data3.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data3.NodeType); + + var documentRoot0Data3Text0 = documentRoot0Data3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data3Text0.NodeType); + Assert.AreEqual("\n ", documentRoot0Data3Text0.TextContent); + + var documentRoot0Data3Category1 = documentRoot0Data3.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentRoot0Data3Category1.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data3Category1.Attributes.Count()); + Assert.AreEqual("Category", documentRoot0Data3Category1.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data3Category1.NodeType); + + var documentRoot0Data3Category1Text0 = documentRoot0Data3Category1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data3Category1Text0.NodeType); + Assert.AreEqual("A", documentRoot0Data3Category1Text0.TextContent); + + var documentRoot0Data3Text2 = documentRoot0Data3.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentRoot0Data3Text2.NodeType); + Assert.AreEqual("\n ", documentRoot0Data3Text2.TextContent); + + var documentRoot0Data3Quantity3 = documentRoot0Data3.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentRoot0Data3Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data3Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentRoot0Data3Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data3Quantity3.NodeType); + + var documentRoot0Data3Quantity3Text0 = documentRoot0Data3Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data3Quantity3Text0.NodeType); + Assert.AreEqual("3", documentRoot0Data3Quantity3Text0.TextContent); + + var documentRoot0Data3Text4 = documentRoot0Data3.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentRoot0Data3Text4.NodeType); + Assert.AreEqual("\n ", documentRoot0Data3Text4.TextContent); + + var documentRoot0Data3Price5 = documentRoot0Data3.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentRoot0Data3Price5.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data3Price5.Attributes.Count()); + Assert.AreEqual("Price", documentRoot0Data3Price5.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data3Price5.NodeType); + + var documentRoot0Data3Price5Text0 = documentRoot0Data3Price5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data3Price5Text0.NodeType); + Assert.AreEqual("24.50", documentRoot0Data3Price5Text0.TextContent); + + var documentRoot0Data3Text6 = documentRoot0Data3.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentRoot0Data3Text6.NodeType); + Assert.AreEqual("\n ", documentRoot0Data3Text6.TextContent); + + var documentRoot0Text4 = documentRoot0.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentRoot0Text4.NodeType); + Assert.AreEqual("\n ", documentRoot0Text4.TextContent); + + var documentRoot0Data5 = documentRoot0.ChildNodes[5] as IElement; + Assert.AreEqual(7, documentRoot0Data5.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data5.Attributes.Count()); + Assert.AreEqual("Data", documentRoot0Data5.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data5.NodeType); + + var documentRoot0Data5Text0 = documentRoot0Data5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data5Text0.NodeType); + Assert.AreEqual("\n ", documentRoot0Data5Text0.TextContent); + + var documentRoot0Data5Category1 = documentRoot0Data5.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentRoot0Data5Category1.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data5Category1.Attributes.Count()); + Assert.AreEqual("Category", documentRoot0Data5Category1.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data5Category1.NodeType); + + var documentRoot0Data5Category1Text0 = documentRoot0Data5Category1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data5Category1Text0.NodeType); + Assert.AreEqual("B", documentRoot0Data5Category1Text0.TextContent); + + var documentRoot0Data5Text2 = documentRoot0Data5.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentRoot0Data5Text2.NodeType); + Assert.AreEqual("\n ", documentRoot0Data5Text2.TextContent); + + var documentRoot0Data5Quantity3 = documentRoot0Data5.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentRoot0Data5Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data5Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentRoot0Data5Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data5Quantity3.NodeType); + + var documentRoot0Data5Quantity3Text0 = documentRoot0Data5Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data5Quantity3Text0.NodeType); + Assert.AreEqual("1", documentRoot0Data5Quantity3Text0.TextContent); + + var documentRoot0Data5Text4 = documentRoot0Data5.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentRoot0Data5Text4.NodeType); + Assert.AreEqual("\n ", documentRoot0Data5Text4.TextContent); + + var documentRoot0Data5Price5 = documentRoot0Data5.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentRoot0Data5Price5.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data5Price5.Attributes.Count()); + Assert.AreEqual("Price", documentRoot0Data5Price5.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data5Price5.NodeType); + + var documentRoot0Data5Price5Text0 = documentRoot0Data5Price5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data5Price5Text0.NodeType); + Assert.AreEqual("89.99", documentRoot0Data5Price5Text0.TextContent); + + var documentRoot0Data5Text6 = documentRoot0Data5.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentRoot0Data5Text6.NodeType); + Assert.AreEqual("\n ", documentRoot0Data5Text6.TextContent); + + var documentRoot0Text6 = documentRoot0.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentRoot0Text6.NodeType); + Assert.AreEqual("\n ", documentRoot0Text6.TextContent); + + var documentRoot0Data7 = documentRoot0.ChildNodes[7] as IElement; + Assert.AreEqual(7, documentRoot0Data7.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data7.Attributes.Count()); + Assert.AreEqual("Data", documentRoot0Data7.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data7.NodeType); + + var documentRoot0Data7Text0 = documentRoot0Data7.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data7Text0.NodeType); + Assert.AreEqual("\n ", documentRoot0Data7Text0.TextContent); + + var documentRoot0Data7Category1 = documentRoot0Data7.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentRoot0Data7Category1.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data7Category1.Attributes.Count()); + Assert.AreEqual("Category", documentRoot0Data7Category1.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data7Category1.NodeType); + + var documentRoot0Data7Category1Text0 = documentRoot0Data7Category1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data7Category1Text0.NodeType); + Assert.AreEqual("A", documentRoot0Data7Category1Text0.TextContent); + + var documentRoot0Data7Text2 = documentRoot0Data7.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentRoot0Data7Text2.NodeType); + Assert.AreEqual("\n ", documentRoot0Data7Text2.TextContent); + + var documentRoot0Data7Quantity3 = documentRoot0Data7.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentRoot0Data7Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data7Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentRoot0Data7Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data7Quantity3.NodeType); + + var documentRoot0Data7Quantity3Text0 = documentRoot0Data7Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data7Quantity3Text0.NodeType); + Assert.AreEqual("5", documentRoot0Data7Quantity3Text0.TextContent); + + var documentRoot0Data7Text4 = documentRoot0Data7.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentRoot0Data7Text4.NodeType); + Assert.AreEqual("\n ", documentRoot0Data7Text4.TextContent); + + var documentRoot0Data7Price5 = documentRoot0Data7.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentRoot0Data7Price5.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data7Price5.Attributes.Count()); + Assert.AreEqual("Price", documentRoot0Data7Price5.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data7Price5.NodeType); + + var documentRoot0Data7Price5Text0 = documentRoot0Data7Price5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data7Price5Text0.NodeType); + Assert.AreEqual("4.95", documentRoot0Data7Price5Text0.TextContent); + + var documentRoot0Data7Text6 = documentRoot0Data7.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentRoot0Data7Text6.NodeType); + Assert.AreEqual("\n ", documentRoot0Data7Text6.TextContent); + + var documentRoot0Text8 = documentRoot0.ChildNodes[8]; + Assert.AreEqual(NodeType.Text, documentRoot0Text8.NodeType); + Assert.AreEqual("\n ", documentRoot0Text8.TextContent); + + var documentRoot0Data9 = documentRoot0.ChildNodes[9] as IElement; + Assert.AreEqual(7, documentRoot0Data9.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data9.Attributes.Count()); + Assert.AreEqual("Data", documentRoot0Data9.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data9.NodeType); + + var documentRoot0Data9Text0 = documentRoot0Data9.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data9Text0.NodeType); + Assert.AreEqual("\n ", documentRoot0Data9Text0.TextContent); + + var documentRoot0Data9Category1 = documentRoot0Data9.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentRoot0Data9Category1.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data9Category1.Attributes.Count()); + Assert.AreEqual("Category", documentRoot0Data9Category1.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data9Category1.NodeType); + + var documentRoot0Data9Category1Text0 = documentRoot0Data9Category1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data9Category1Text0.NodeType); + Assert.AreEqual("A", documentRoot0Data9Category1Text0.TextContent); + + var documentRoot0Data9Text2 = documentRoot0Data9.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentRoot0Data9Text2.NodeType); + Assert.AreEqual("\n ", documentRoot0Data9Text2.TextContent); + + var documentRoot0Data9Quantity3 = documentRoot0Data9.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentRoot0Data9Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data9Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentRoot0Data9Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data9Quantity3.NodeType); + + var documentRoot0Data9Quantity3Text0 = documentRoot0Data9Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data9Quantity3Text0.NodeType); + Assert.AreEqual("3", documentRoot0Data9Quantity3Text0.TextContent); + + var documentRoot0Data9Text4 = documentRoot0Data9.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentRoot0Data9Text4.NodeType); + Assert.AreEqual("\n ", documentRoot0Data9Text4.TextContent); + + var documentRoot0Data9Price5 = documentRoot0Data9.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentRoot0Data9Price5.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data9Price5.Attributes.Count()); + Assert.AreEqual("Price", documentRoot0Data9Price5.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data9Price5.NodeType); + + var documentRoot0Data9Price5Text0 = documentRoot0Data9Price5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data9Price5Text0.NodeType); + Assert.AreEqual("66.00", documentRoot0Data9Price5Text0.TextContent); + + var documentRoot0Data9Text6 = documentRoot0Data9.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentRoot0Data9Text6.NodeType); + Assert.AreEqual("\n ", documentRoot0Data9Text6.TextContent); + + var documentRoot0Text10 = documentRoot0.ChildNodes[10]; + Assert.AreEqual(NodeType.Text, documentRoot0Text10.NodeType); + Assert.AreEqual("\n ", documentRoot0Text10.TextContent); + + var documentRoot0Data11 = documentRoot0.ChildNodes[11] as IElement; + Assert.AreEqual(7, documentRoot0Data11.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data11.Attributes.Count()); + Assert.AreEqual("Data", documentRoot0Data11.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data11.NodeType); + + var documentRoot0Data11Text0 = documentRoot0Data11.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data11Text0.NodeType); + Assert.AreEqual("\n ", documentRoot0Data11Text0.TextContent); + + var documentRoot0Data11Category1 = documentRoot0Data11.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentRoot0Data11Category1.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data11Category1.Attributes.Count()); + Assert.AreEqual("Category", documentRoot0Data11Category1.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data11Category1.NodeType); + + var documentRoot0Data11Category1Text0 = documentRoot0Data11Category1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data11Category1Text0.NodeType); + Assert.AreEqual("B", documentRoot0Data11Category1Text0.TextContent); + + var documentRoot0Data11Text2 = documentRoot0Data11.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentRoot0Data11Text2.NodeType); + Assert.AreEqual("\n ", documentRoot0Data11Text2.TextContent); + + var documentRoot0Data11Quantity3 = documentRoot0Data11.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentRoot0Data11Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data11Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentRoot0Data11Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data11Quantity3.NodeType); + + var documentRoot0Data11Quantity3Text0 = documentRoot0Data11Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data11Quantity3Text0.NodeType); + Assert.AreEqual("10", documentRoot0Data11Quantity3Text0.TextContent); + + var documentRoot0Data11Text4 = documentRoot0Data11.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentRoot0Data11Text4.NodeType); + Assert.AreEqual("\n ", documentRoot0Data11Text4.TextContent); + + var documentRoot0Data11Price5 = documentRoot0Data11.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentRoot0Data11Price5.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data11Price5.Attributes.Count()); + Assert.AreEqual("Price", documentRoot0Data11Price5.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data11Price5.NodeType); + + var documentRoot0Data11Price5Text0 = documentRoot0Data11Price5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data11Price5Text0.NodeType); + Assert.AreEqual(".99", documentRoot0Data11Price5Text0.TextContent); + + var documentRoot0Data11Text6 = documentRoot0Data11.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentRoot0Data11Text6.NodeType); + Assert.AreEqual("\n ", documentRoot0Data11Text6.TextContent); + + var documentRoot0Text12 = documentRoot0.ChildNodes[12]; + Assert.AreEqual(NodeType.Text, documentRoot0Text12.NodeType); + Assert.AreEqual("\n ", documentRoot0Text12.TextContent); + + var documentRoot0Data13 = documentRoot0.ChildNodes[13] as IElement; + Assert.AreEqual(7, documentRoot0Data13.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data13.Attributes.Count()); + Assert.AreEqual("Data", documentRoot0Data13.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data13.NodeType); + + var documentRoot0Data13Text0 = documentRoot0Data13.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data13Text0.NodeType); + Assert.AreEqual("\n ", documentRoot0Data13Text0.TextContent); + + var documentRoot0Data13Category1 = documentRoot0Data13.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentRoot0Data13Category1.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data13Category1.Attributes.Count()); + Assert.AreEqual("Category", documentRoot0Data13Category1.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data13Category1.NodeType); + + var documentRoot0Data13Category1Text0 = documentRoot0Data13Category1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data13Category1Text0.NodeType); + Assert.AreEqual("A", documentRoot0Data13Category1Text0.TextContent); + + var documentRoot0Data13Text2 = documentRoot0Data13.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentRoot0Data13Text2.NodeType); + Assert.AreEqual("\n ", documentRoot0Data13Text2.TextContent); + + var documentRoot0Data13Quantity3 = documentRoot0Data13.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentRoot0Data13Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data13Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentRoot0Data13Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data13Quantity3.NodeType); + + var documentRoot0Data13Quantity3Text0 = documentRoot0Data13Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data13Quantity3Text0.NodeType); + Assert.AreEqual("15", documentRoot0Data13Quantity3Text0.TextContent); + + var documentRoot0Data13Text4 = documentRoot0Data13.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentRoot0Data13Text4.NodeType); + Assert.AreEqual("\n ", documentRoot0Data13Text4.TextContent); + + var documentRoot0Data13Price5 = documentRoot0Data13.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentRoot0Data13Price5.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data13Price5.Attributes.Count()); + Assert.AreEqual("Price", documentRoot0Data13Price5.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data13Price5.NodeType); + + var documentRoot0Data13Price5Text0 = documentRoot0Data13Price5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data13Price5Text0.NodeType); + Assert.AreEqual("29.00", documentRoot0Data13Price5Text0.TextContent); + + var documentRoot0Data13Text6 = documentRoot0Data13.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentRoot0Data13Text6.NodeType); + Assert.AreEqual("\n ", documentRoot0Data13Text6.TextContent); + + var documentRoot0Text14 = documentRoot0.ChildNodes[14]; + Assert.AreEqual(NodeType.Text, documentRoot0Text14.NodeType); + Assert.AreEqual("\n ", documentRoot0Text14.TextContent); + + var documentRoot0Data15 = documentRoot0.ChildNodes[15] as IElement; + Assert.AreEqual(7, documentRoot0Data15.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data15.Attributes.Count()); + Assert.AreEqual("Data", documentRoot0Data15.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data15.NodeType); + + var documentRoot0Data15Text0 = documentRoot0Data15.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data15Text0.NodeType); + Assert.AreEqual("\n ", documentRoot0Data15Text0.TextContent); + + var documentRoot0Data15Category1 = documentRoot0Data15.ChildNodes[1] as IElement; + Assert.AreEqual(1, documentRoot0Data15Category1.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data15Category1.Attributes.Count()); + Assert.AreEqual("Category", documentRoot0Data15Category1.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data15Category1.NodeType); + + var documentRoot0Data15Category1Text0 = documentRoot0Data15Category1.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data15Category1Text0.NodeType); + Assert.AreEqual("B", documentRoot0Data15Category1Text0.TextContent); + + var documentRoot0Data15Text2 = documentRoot0Data15.ChildNodes[2]; + Assert.AreEqual(NodeType.Text, documentRoot0Data15Text2.NodeType); + Assert.AreEqual("\n ", documentRoot0Data15Text2.TextContent); + + var documentRoot0Data15Quantity3 = documentRoot0Data15.ChildNodes[3] as IElement; + Assert.AreEqual(1, documentRoot0Data15Quantity3.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data15Quantity3.Attributes.Count()); + Assert.AreEqual("Quantity", documentRoot0Data15Quantity3.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data15Quantity3.NodeType); + + var documentRoot0Data15Quantity3Text0 = documentRoot0Data15Quantity3.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data15Quantity3Text0.NodeType); + Assert.AreEqual("8", documentRoot0Data15Quantity3Text0.TextContent); + + var documentRoot0Data15Text4 = documentRoot0Data15.ChildNodes[4]; + Assert.AreEqual(NodeType.Text, documentRoot0Data15Text4.NodeType); + Assert.AreEqual("\n ", documentRoot0Data15Text4.TextContent); + + var documentRoot0Data15Price5 = documentRoot0Data15.ChildNodes[5] as IElement; + Assert.AreEqual(1, documentRoot0Data15Price5.ChildNodes.Length); + Assert.AreEqual(0, documentRoot0Data15Price5.Attributes.Count()); + Assert.AreEqual("Price", documentRoot0Data15Price5.NodeName); + Assert.AreEqual(NodeType.Element, documentRoot0Data15Price5.NodeType); + + var documentRoot0Data15Price5Text0 = documentRoot0Data15Price5.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, documentRoot0Data15Price5Text0.NodeType); + Assert.AreEqual("6.99", documentRoot0Data15Price5Text0.TextContent); + + var documentRoot0Data15Text6 = documentRoot0Data15.ChildNodes[6]; + Assert.AreEqual(NodeType.Text, documentRoot0Data15Text6.NodeType); + Assert.AreEqual("\n ", documentRoot0Data15Text6.TextContent); + + var documentRoot0Text16 = documentRoot0.ChildNodes[16]; + Assert.AreEqual(NodeType.Text, documentRoot0Text16.NodeType); + Assert.AreEqual("\n", documentRoot0Text16.TextContent); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Dom/XmlTree.cs b/src/AngleSharp.Xml.Tests/Dom/XmlTree.cs new file mode 100644 index 0000000..b2d8eaf --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Dom/XmlTree.cs @@ -0,0 +1,74 @@ +namespace AngleSharp.Core.Tests.Xml +{ + using AngleSharp.Xml.Parser; + using NUnit.Framework; + + [TestFixture] + public class XmlTree + { + [Test] + public void XmlValidDocumentWithoutDocType() + { + var xml = (@" + + + Tove + Jani + Reminder + Don't forget me this weekend! +").ToXmlDocument(); + + Assert.IsNotNull(xml); + Assert.IsNotNull(xml.DocumentElement); + Assert.AreEqual("note", xml.DocumentElement.TagName); + Assert.AreEqual(4, xml.DocumentElement.ChildElementCount); + Assert.AreEqual(4, xml.DocumentElement.Children.Length); + Assert.AreEqual("to", xml.DocumentElement.Children[0].TagName); + Assert.AreEqual("from", xml.DocumentElement.Children[1].TagName); + Assert.AreEqual("heading", xml.DocumentElement.Children[2].TagName); + Assert.AreEqual("body", xml.DocumentElement.Children[3].TagName); + } + + [Test] + public void XmlInvalidDocumentMismatchedEndTag() + { + Assert.Catch(() => (@" + + + Tove + Jani + Reminder + Don't forget me this weekend! +").ToXmlDocument()); + } + + [Test] + public void XmlValidDocumentFoodMenuInnerHTML() + { + var xml = Assets.food.ToXmlDocument(); + + Assert.IsNotNull(xml); + Assert.IsNotNull(xml.DocumentElement); + Assert.AreEqual("breakfast_menu", xml.DocumentElement.TagName); + Assert.AreEqual(5, xml.DocumentElement.ChildElementCount); + Assert.AreEqual(5, xml.DocumentElement.Children.Length); + Assert.AreEqual("food", xml.DocumentElement.Children[0].TagName); + Assert.AreEqual(4, xml.DocumentElement.Children[0].Children.Length); + Assert.AreEqual("name", xml.DocumentElement.Children[0].Children[0].TagName); + Assert.AreEqual("$5.95", xml.DocumentElement.Children[0].Children[1].InnerHtml); + Assert.AreEqual("$7.95", xml.DocumentElement.Children[1].Children[1].InnerHtml); + } + + [Test] + public void XmlValidDocumentBooksTree() + { + var xml = Assets.books.ToXmlDocument(); + + Assert.IsNotNull(xml); + Assert.IsNotNull(xml.DocumentElement); + Assert.AreEqual("catalog", xml.DocumentElement.TagName); + Assert.AreEqual(12, xml.DocumentElement.ChildElementCount); + Assert.AreEqual(6, xml.DocumentElement.Children[2].ChildElementCount); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Key.snk b/src/AngleSharp.Xml.Tests/Key.snk new file mode 100644 index 0000000..d43ce41 Binary files /dev/null and b/src/AngleSharp.Xml.Tests/Key.snk differ diff --git a/src/AngleSharp.Xml.Tests/Parser/XmlInvalidDocuments.cs b/src/AngleSharp.Xml.Tests/Parser/XmlInvalidDocuments.cs new file mode 100644 index 0000000..5aed715 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Parser/XmlInvalidDocuments.cs @@ -0,0 +1,545 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using AngleSharp; + +namespace UnitTests +{ + [TestClass] + public class XmlInvalidDocuments + { + /// + /// Tests the Element Valid VC (clause 4) by including an undeclared child element. + /// Here the section(s) 3 apply. This test is taken from the collection Sun + /// Microsystems XML Tests. + /// + [TestMethod] + public void XmlInvalidEl01() + { + var document = DocumentBuilder.Xml(@" +]> + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Tests the Element Valid VC (clause 1) by including elements in an EMPTY content + /// model. Here the section(s) 3 apply. This test is taken from the collection Sun + /// Microsystems XML Tests. + /// + [TestMethod] + public void XmlInvalidEl02() + { + var document = DocumentBuilder.Xml(@" +]> + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Tests the Element Valid VC (clause 3) by including a child element not permitted + /// by a mixed content model. Here the section(s) 3 apply. This test is taken from the + /// collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlInvalidEl03() + { + var document = DocumentBuilder.Xml(@" + +]> +this is ok this isn't +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Tests the Element Valid VC (clause 1), using one of the predefined internal + /// entities inside an EMPTY content model. Here the section(s) 3 apply. This test + /// is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlInvalidEl06() + { + var document = DocumentBuilder.Xml(@" + +]> +& + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// This test violates VC: Element Valid in P39. Element a is declared empty + /// in DTD, but has content in the document. There is an output test associated + /// with this input file. Here the section(s) 3 apply. This test is taken from the + /// collection IBM XML Conformance Test Suite - Production 39. + /// + [TestMethod] + public void XmlIbmInvalidP39Ibm39i01() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +should not have content here + + content of b element + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// This test violates VC: Element Valid in P39. root is declared only having element + /// children in DTD, but have text content in the document. There is an output test + /// associated with this input file. Here the section(s) 3 apply. This test is taken + /// from the collection IBM XML Conformance Test Suite - Production 39. + /// + [TestMethod] + public void XmlIbmInvalidP39Ibm39i02() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + + root can't have text content + + + content of b element + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// This test violates VC: Element Valid in P39. Illegal elements are inserted in b's + /// content of Mixed type. There is an output test associated with this input file. Here + /// the section(s) 3 apply. This test is taken from the collection IBM XML Conformance Test Suite - Production 39. + /// + [TestMethod] + public void XmlIbmInvalidP39Ibm39i03() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + + + + content of b element + + could not have 'a' as 'b's content + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// This test violates VC: Element Valid in P39. Element c has undeclared element + /// as its content of ANY type There is an output test associated with this input + /// file. Here the section(s) 3 apply. This test is taken from the collection IBM + /// XML Conformance Test Suite - Production 39. + /// + [TestMethod] + public void XmlIbmInvalidP39Ibm39i04() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + + + content of b element + + not declared in dtd + + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// This test violates VC: Attribute Value Type in P41. attr1 for Element + /// b is not declared. There is an output test associated with this input + /// file. Here the section(s) 3.1 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 41. + /// + [TestMethod] + public void XmIbmInvalidP41Ibm41i01() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + + attr1 not declared + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// This test violates VC: Attribute Value Type in P41. attr3 for Element + /// b is given a value that does not match the declaration in the DTD. There + /// is an output test associated with this input file. Here the section(s) 3.1 + /// apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 41. + /// + [TestMethod] + public void XmlIbmInvalidP41Ibm41i02() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + attr3 value not fixed + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Elements content can be empty. Here the section(s) 3.1 [40] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP40pass1() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Whitespace is valid within a Start-tag. Here the section(s) 3.1 [40] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP40pass2() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Whitespace and Multiple Attributes are valid within a Start-tag. Here + /// the section(s) 3.1 [40] apply. This test is taken from the collection + /// OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP40pass4() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Attributes are valid within a Start-tag. Here the section(s) 3.1 [40] [41] + /// apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP40pass3() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Attributes are valid within a Start-tag. Here the section(s) 3.1 [41] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP41pass1() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Whitespace is valid within a Start-tags Attribute. Here the section(s) + /// 3.1 [41] apply. This test is taken from the collection OASIS/NIST TESTS, + /// 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP41pass2() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Test shows proper syntax for an End-tag. Here the section(s) 3.1 [42] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP42pass1() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Whitespace is valid after name in End-tag. Here the section(s) 3.1 [42] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP42pass2() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Valid display of an Empty Element Tag. Here the section(s) 3.1 [44] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP44pass1() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Empty Element Tags can contain an Attribute. Here the section(s) 3.1 [44] + /// apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP44pass2() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Whitespace is valid in an Empty Element Tag following the end of + /// the attribute value. Here the section(s) 3.1 [44] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP44pass3() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Whitespace is valid after the name in an Empty Element Tag. Here the + /// section(s) 3.1 [44] apply. This test is taken from the collection + /// OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP44pass4() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Whitespace and Multiple Attributes are valid in an Empty Element Tag. + /// Here the section(s) 3.1 [44] apply. This test is taken from the collection + /// OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlInvalidOP44pass5() + { + var document = DocumentBuilder.Xml(@""); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Tests the Attribute Value Type (declared) VC for the xml:space attribute. + /// Here the section(s) 3.1 2.10 apply. This test is taken from the collection + /// Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlInvalidInvRequired01() + { + var document = DocumentBuilder.Xml(@" +]> + + + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// PE name immediately followed by ";" Here the section(s) 4.1 [69] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlInvalidDtd03() + { + var document = DocumentBuilder.Xml(@" + + + +]> + + + + + +"); + + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Tests the Attribute Value Type (declared) VC for the xml:lang attribute. + /// Here the section(s) 3.1 2.12 apply. This test is taken from the collection + /// Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlInvalidInvRequired02() + { + var document = DocumentBuilder.Xml(@" +]> + + + + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// Tests the Unique Element Type Declaration VC. Here the section(s) + /// 3.2 apply. This test is taken from the collection Sun Microsystems + /// XML Tests. + /// + [TestMethod] + public void XmlInvalidEl04() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + + /// + /// This test violates VC: Unique Element Type Declaration. Element not_unique + /// has been declared 3 time in the DTD. There is an output test associated with + /// this input file. Here the section(s) 3.2 apply. This test is taken from the + /// collection IBM XML Conformance Test Suite - Production 45. + /// + [TestMethod] + public void XmlIbmInvalidP45Ibm45i01() + { + var document = DocumentBuilder.Xml(@" + + + + + + + + + +]> + + without white space + with a white space + + + + +"); + Assert.IsNotNull(document); + Assert.IsFalse(document.IsValid); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Parser/XmlNamespace.cs b/src/AngleSharp.Xml.Tests/Parser/XmlNamespace.cs new file mode 100644 index 0000000..4a8b461 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Parser/XmlNamespace.cs @@ -0,0 +1,80 @@ +namespace AngleSharp.Core.Tests.Xml +{ + using NUnit.Framework; + using System.Threading.Tasks; + + [TestFixture] + public class XmlNamespaceTests + { + [Test] + public async Task XmlWithoutNamespaceUriShouldBeStandardNamespaceUri() + { + var document = await BrowsingContext.New().OpenAsync(req => + req.Content(@"TEXT") + .Header("Content-Type", "text/xml")); + var root = document.DocumentElement; + Assert.AreEqual(null, root.NamespaceUri); + } + + [Test] + public async Task XmlWithNewNamespaceShouldContainRightNamespaceUri() + { + var document = await BrowsingContext.New().OpenAsync(req => + req.Content(@"TEXT") + .Header("Content-Type", "text/xml")); + var root = document.DocumentElement; + Assert.AreEqual("http://www.w3.org/1999/xhtml", root.NamespaceUri); + } + + [Test] + public async Task XmlWithCustomNamespaceShouldExposeThatNamespaceUri() + { + var document = await BrowsingContext.New().OpenAsync(req => + req.Content(@"TEXT") + .Header("Content-Type", "text/xml")); + var root = document.DocumentElement; + Assert.AreEqual("http://initd.org/ns/tesseract-1.0", root.NamespaceUri); + } + + [Test] + public async Task XmlSubElementsGetTheRightDefaultNamespace() + { + var document = await BrowsingContext.New().OpenAsync(req => + req.Content(@"") + .Header("Content-Type", "text/xml")); + var root = document.DocumentElement; + Assert.AreEqual("http://test.com", root.NamespaceUri); + Assert.AreEqual("http://test.com", root.LookupNamespaceUri("")); + Assert.AreEqual("http://test.com", root.FirstElementChild.NamespaceUri); + Assert.AreEqual("http://test.com", root.FirstElementChild.LookupNamespaceUri("")); + Assert.AreEqual(null, root.FirstElementChild.Attributes["attr"].NamespaceUri); + } + + [Test] + public async Task XmlPrefixRefersToDefinedNamespace() + { + var document = await BrowsingContext.New().OpenAsync(req => + req.Content(@"") + .Header("Content-Type", "text/xml")); + var root = document.DocumentElement; + Assert.AreEqual("http://p1.com", root.FirstElementChild.NamespaceUri); + Assert.AreEqual("http://p1.com", root.LookupNamespaceUri("p1")); + Assert.AreEqual(null, root.FirstElementChild.GetAttribute("attr")); + Assert.AreEqual("http://p1.com", root.FirstElementChild.Attributes["p1:attr"].NamespaceUri); + Assert.AreEqual("http://p2.com", root.FirstElementChild.NextElementSibling.NamespaceUri); + Assert.AreEqual("http://p2.com", root.FirstElementChild.NextElementSibling.LookupNamespaceUri("p2")); + } + + [Test] + public async Task XmlRedefinitionOfPrefixedNamespace() + { + var document = await BrowsingContext.New().OpenAsync(req => + req.Content(@"") + .Header("Content-Type", "text/xml")); + var root = document.DocumentElement; + Assert.AreEqual("http://p.com", root.FirstElementChild.NamespaceUri); + Assert.AreEqual("http://test.com", root.LastElementChild.NamespaceUri); + Assert.AreEqual("http://test.com", root.FirstElementChild.NextElementSibling.LookupNamespaceUri("p")); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Parser/XmlNotWfDocuments.cs b/src/AngleSharp.Xml.Tests/Parser/XmlNotWfDocuments.cs new file mode 100644 index 0000000..0c54b4b --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Parser/XmlNotWfDocuments.cs @@ -0,0 +1,3166 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using AngleSharp; +using AngleSharp.Xml; + +namespace UnitTests +{ + /// + /// (Conformance) Tests taken from + /// http://www.w3.org/XML/Test/xmlconf-20031210.html + [TestClass] + public class XmlNotWfDocuments + { + /// + /// Illegal character " " in encoding name Here the section(s) 4.3.3 [81] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfEncoding01() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// Illegal character "/" in encoding name Here the section(s) 4.3.3 [81] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfEncoding02() + { + var document = DocumentBuilder.Xml(@" + + +"); + } + + /// + /// Illegal character reference in encoding name Here the section(s) 4.3.3 [81] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfEncoding03() + { + var document = DocumentBuilder.Xml(@" + + +"); + } + + /// + /// Illegal character ":" in encoding name Here the section(s) 4.3.3 [81] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfEncoding04() + { + var document = DocumentBuilder.Xml(@" + + +"); + } + + /// + /// Illegal character "@" in encoding name Here the section(s) 4.3.3 [81] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfEncoding05() + { + var document = DocumentBuilder.Xml(@" + + +"); + } + + /// + /// Illegal character "+" in encoding name Here the section(s) 4.3.3 [81] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfEncoding06() + { + var document = DocumentBuilder.Xml(@" + + + + +"); + } + + /// + /// Value is required Here the section(s) 4.2 [73] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP73fail4() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// No NDataDecl without value Here the section(s) 4.2 [73] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP73fail5() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// No NData Decls on parameter entities. Here the section(s) 4.2 [74] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP74fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// value is required Here the section(s) 4.2 [74] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP74fail2() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// only one value Here the section(s) 4.2 [74] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP74fail3() + { + var document = DocumentBuilder.Xml(@""" SYSTEM ""nop.ent""> +]> + +"); + } + + /// + /// S is required after name Here the section(s) 4.2 [72] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP72fail3() + { + var document = DocumentBuilder.Xml(@" +""> +]> + +"); + } + + /// + /// Entity name is a name, not an NMToken Here the section(s) 4.2 [72] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP72fail4() + { + var document = DocumentBuilder.Xml(@" +""> +]> + +"); + } + + /// + /// No typed replacement text. Here the section(s) 4.2 [73] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP73fail1() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// Only one replacement value. Here the section(s) 4.2 [73] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP73fail2() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// No NDataDecl on replacement text. Here the section(s) 4.2 [73] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP73fail3() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// S is required after '%'. Here the section(s) 4.2 [72] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP72fail2() + { + var document = DocumentBuilder.Xml(@" +""> +]> + +"); + } + + /// + /// Notation name is required. Here the section(s) 4.2.2 [76] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP76fail3() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// notation names are Names Here the section(s) 4.2.2 [76] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP76fail4() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + +"); + } + + /// + /// This is neither Here the section(s) 4.2 [70] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP70fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// S is required before EntityDef Here the section(s) 4.2 [71] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP71fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// Entity name is a Name, not an NMToken Here the section(s) 4.2 [71] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP71fail2() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// "SYSTEM" implies only one literal Here the section(s) 4.2.2 [75] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP75fail4() + { + var document = DocumentBuilder.Xml(@" +]> + +"); + } + + /// + /// only one keyword Here the section(s) 4.2.2 [75] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP75fail5() + { + var document = DocumentBuilder.Xml(@" +]> + +"); + } + + /// + /// "PUBLIC" requires two literals (contrast with SGML) Here the section(s) + /// 4.2.2 [75] apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP75fail6() + { + var document = DocumentBuilder.Xml(@" +]> + +"); + } + + /// + /// S is required before "NDATA" Here the section(s) 4.2.2 [76] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP76fail1() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// "NDATA" is upper-case Here the section(s) 4.2.2 [76] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP76fail2() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// S required after "PUBLIC". Here the section(s) 4.2.2 [75] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP75fail1() + { + var document = DocumentBuilder.Xml(@" +]> + +"); + } + + /// + /// S required after "SYSTEM" Here the section(s) 4.2.2 [75] apply + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP75fail2() + { + var document = DocumentBuilder.Xml(@" +]> + +"); + } + + /// + /// S required between literals Here the section(s) 4.2.2 [75] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP75fail3() + { + var document = DocumentBuilder.Xml(@" +]> + +"); + } + + /// + /// terminating ';' is required Here the section(s) 4.1 [69] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP69fail1() + { + var document = DocumentBuilder.Xml(@" +""> +%pe +]> + +"); + } + + /// + /// no S after '%' Here the section(s) 4.1 [69] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP69fail2() + { + var document = DocumentBuilder.Xml(@" +""> +% pe; +]> + +"); + } + + /// + /// no S before ';' Here the section(s) 4.1 [69] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP69fail3() + { + var document = DocumentBuilder.Xml(@" +""> +%pe ; +]> + +"); + } + + /// + /// PUBLIC literal must be quoted Here the section(s) 4.2.2 [75] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfDtd04() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +"); + } + + /// + /// SYSTEM identifier must be quoted Here the section(s) 4.2.2 [75] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfDtd05() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +"); + } + + /// + /// terminating ';' is required Here the section(s) 4.1 [66] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP66fail1() + { + var document = DocumentBuilder.Xml(@"A"); + } + + /// + /// no S after '&#' Here the section(s) 4.1 [66] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP66fail2() + { + var document = DocumentBuilder.Xml(@"&# 65;"); + } + + /// + /// no hex digits in numeric reference Here the section(s) 4.1 [66] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP66fail3() + { + var document = DocumentBuilder.Xml(@"&#A;"); + } + + /// + /// only hex digits in hex references Here the section(s) 4.1 [66] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP66fail4() + { + var document = DocumentBuilder.Xml(@"G;"); + } + + /// + /// No references to non-characters. Here the section(s) 4.1 [66] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP66fail5() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// no references to non-characters Here the section(s) 4.1 [66] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP66fail6() + { + var document = DocumentBuilder.Xml(@"��"); + } + + /// + /// terminating ';' is required Here the section(s) 4.1 [68] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP68fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +&ent + +"); + } + + /// + /// no S after '&' Here the section(s) 4.1 [68] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP68fail2() + { + var document = DocumentBuilder.Xml(@" + +]> + +& ent; + +"); + } + + /// + /// no S before ';' Here the section(s) 4.1 [68] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP68fail3() + { + var document = DocumentBuilder.Xml(@" + +]> + +&ent ; + +"); + } + + /// + /// PE name immediately after "%" Here the section(s) 4.1 [69] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfDtd02() + { + var document = DocumentBuilder.Xml(@" + + ""> + % foo; +]> + + +"); + } + + /// + /// PE name immediately followed by ";" Here the section(s) 4.1 [69] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfDtd03() + { + var document = DocumentBuilder.Xml(@" + + ""> + %foo + ; +]> + + + +"); + } + + /// + /// Must have keyword in conditional sections Here the section(s) 3.4 [61] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfCond02() + { + var document = DocumentBuilder.Xml(@" + + ""> + %foo + ; +]> + + + +"); + } + + /// + /// SGML-ism: omitted end tag for EMPTY content Here the section(s) 3 [39] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml01() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +"); + } + + /// + /// start-tag requires end-tag Here the section(s) 3 [39] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP39fail1() + { + var document = DocumentBuilder.Xml(@"content"); + } + + /// + /// end-tag requires start-tag Here the section(s) 3 [39] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP39fail2() + { + var document = DocumentBuilder.Xml(@"content"); + } + + /// + /// XML documents contain one or more elements. Here the section(s) 3 [39] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP39fail3() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// A name is required. Here the section(s) 3.3 [52] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP52fail1() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// A name is required. Here the section(s) 3.3 [52] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP52fail2() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// S is required before default. Here the section(s) 3.3 [53] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP53fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// S is required before type. Here the section(s) 3.3 [53] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP53fail2() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// Type is required. Here the section(s) 3.3 [53] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP53fail3() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// Default is required. Here the section(s) 3.3 [53] apply. This test is taken from + /// the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP53fail4() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// Name is requried. Here the section(s) 3.3 [53] apply. This test is taken from + /// the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP53fail5() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// Comma doesn't separate enumerations, unlike in SGML. Here the section(s) 3.3.1 [59] + /// apply. This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist03() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + + +"); + } + + /// + /// at least one required Here the section(s) 3.3.1 [59] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP59fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// separator must be "," Here the section(s) 3.3.1 [59] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP59fail2() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// values are unquoted Here the section(s) 3.3.1 [59] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP59fail3() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// keywords must be upper case Here the section(s) 3.3.2 [60] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP60fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// S is required after #FIXED Here the section(s) 3.3.2 [60] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP60fail2() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// only #FIXED has both keyword and value Here the section(s) 3.3.2 [60] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP60fail3() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// #FIXED required value Here the section(s) 3.3.2 [60] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP60fail4() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// only one default type Here the section(s) 3.3.2 [60] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP60fail5() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// ATTLIST declarations apply to only one element, unlike SGML Here the section(s) 3.3 [52] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml04() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + +"); + } + + /// + /// ATTLIST declarations are never global, unlike in SGML Here the section(s) 3.3 [52] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml06() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + + +"); + } + + /// + /// SGML's #CURRENT is not allowed. Here the section(s) 3.3.1 [56] apply. This test is + /// taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist08() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + +"); + } + + /// + /// SGML's #CONREF is not allowed. Here the section(s) 3.3.1 [56] apply. This test + /// is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist09() + { + var document = DocumentBuilder.Xml(@" + + + +]> + + + +"); + } + + /// + /// no IDS type Here the section(s) 3.3.1 [56] apply. This test is taken from + /// the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP56fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// no NUMBER type Here the section(s) 3.3.1 [56] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP56fail2() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// no NAME type Here the section(s) 3.3.1 [56] apply. This test is taken from + /// the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP56fail3() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// no ENTITYS type - types must be upper case Here the section(s) 3.3.1 [56] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP56fail4() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// types must be upper case Here the section(s) 3.3.1 [56] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP56fail5() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// no keyword for NMTOKEN enumeration Here the section(s) 3.3.1 [57] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP57fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// at least one value required Here the section(s) 3.3.1 [58] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP58fail1() + { + var document = DocumentBuilder.Xml(@" + + + +]> + +"); + } + + /// + /// Separator must be '|' Here the section(s) 3.3.1 [58] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP58fail2() + { + var document = DocumentBuilder.Xml(@" + + + +]> + +"); + } + + /// + /// Notations are NAMEs, not NMTOKENs -- note: Leaving the invalid notation undeclared would + /// cause a validating parser to fail without checking the name syntax, so the notation is + /// declared with an invalid name. A parser that reports error positions should report an error + /// at the AttlistDecl on line 6, before reaching the notation declaration. Here the section(s) + /// 3.3.1 [58] apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP58fail3() + { + var document = DocumentBuilder.Xml(@" + + + + + + + +]> + +"); + } + + /// + /// NOTATION must be upper case Here the section(s) 3.3.1 [58] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP58fail4() + { + var document = DocumentBuilder.Xml(@" + + + +]> + +"); + } + + /// + /// S after keyword is required Here the section(s) 3.3.1 [58] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP58fail5() + { + var document = DocumentBuilder.Xml(@" + + + +]> + +"); + } + + /// + /// Parentheses are require Here the section(s) 3.3.1 [58] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP58fail6() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + /// + /// Values are unquoted Here the section(s) 3.3.1 [58] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP58fail7() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// Values are unquoted Here the section(s) 3.3.1 [58] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP58fail8() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// Don't pass unknown attribute types Here the section(s) 3.3.1 [54] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP54fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// Must be upper case Here the section(s) 3.3.1 [55] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP55fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// SGML's NUTOKEN is not allowed. Here the section(s) 3.3.1 [56] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist01() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + +"); + } + + /// + /// SGML's NUTOKENS attribute type is not allowed. Here the section(s) 3.3.1 [56] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist02() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + + +"); + } + + /// + /// SGML's NUMBER attribute type is not allowed. Here the section(s) 3.3.1 [56] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist04() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + + +"); + } + + /// + /// SGML's NUMBERS attribute type is not allowed. Here the section(s) 3.3.1 [56] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist05() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + + +"); + } + + /// + /// SGML's NAME attribute type is not allowed. Here the section(s) 3.3.1 [56] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist06() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + + +"); + } + + /// + /// SGML's NAMES attribute type is not allowed. Here the section(s) 3.3.1 [56] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist07() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + + +"); + } + + /// + /// occurrence on #PCDATA group must be *. Here the section(s) 3.2.2 [51] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP51fail2() + { + var document = DocumentBuilder.Xml(@" +]> +"); + } + + /// + /// #PCDATA must come first. Here the section(s) 3.2.2 [51] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP51fail3() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// occurrence on #PCDATA group must be *. Here the section(s) 3.2.2 [51] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP51fail4() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// Only '|' connectors. Here the section(s) 3.2.2 [51] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP51fail5() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// Only '|' connectors and occurrence on #PCDATA group must be *. Here the section(s) 3.2.2 [51] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP51fail6() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// No nested groups. Here the section(s) 3.2.2 [51] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP51fail7() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// ELEMENT declarations apply to only one element, unlike SGML. Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml05() + { + var document = DocumentBuilder.Xml(@" + + + + + + +]> + + + +"); + } + + /// + /// SGML Tag minimization specifications are not allowed. Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml07() + { + var document = DocumentBuilder.Xml(@" + +]> + + +"); + } + + /// + /// SGML Tag minimization specifications are not allowed. Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml08() + { + var document = DocumentBuilder.Xml(@" + +]> + + + +"); + } + + /// + /// SGML Content model exception specifications are not allowed. Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml09() + { + var document = DocumentBuilder.Xml(@" + + +]> + + + +"); + } + + /// + /// SGML Content model exception specifications are not allowed. Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml10() + { + var document = DocumentBuilder.Xml(@" + +]> + + + +"); + } + + /// + /// ELEMENT must be upper case. Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP45fail1() + { + var document = DocumentBuilder.Xml(@" +]> +"); + } + + /// + /// S before contentspec is required. Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP45fail2() + { + var document = DocumentBuilder.Xml(@" +]> +"); + } + + /// + /// only one content spec Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP45fail3() + { + var document = DocumentBuilder.Xml(@" +]> +"); + } + + /// + /// no comments in declarations (contrast with SGML) Here the section(s) 3.2 [45] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP45fail4() + { + var document = DocumentBuilder.Xml(@" +]> +"); + } + + /// + /// CDATA is not a valid content model spec Here the section(s) 3.2 [46] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml11() + { + var document = DocumentBuilder.Xml(@" + +]> + + + +"); + } + + /// + /// RCDATA is not a valid content model spec Here the section(s) 3.2 [46] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml12() + { + var document = DocumentBuilder.Xml(@" + +]> + + + + +"); + } + + /// + /// No parens on declared content. Here the section(s) 3.2 [46] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP46fail1() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// No inclusions (contrast with SGML). Here the section(s) 3.2 [46] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP46fail2() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// No exclusions (contrast with SGML). Here the section(s) 3.2 [46] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP46fail3() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// No space before occurrence. Here the section(s) 3.2 [46] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP46fail4() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// single group Here the section(s) 3.2 [46] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP46fail5() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// can't be both declared and modeled Here the section(s) 3.2 [46] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP46fail6() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// Illegal comment in Empty element tag. Here the section(s) 3.1 [44] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP44fail3() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// Whitespace required between attributes. Here the section(s) 3.1 [44] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP44fail4() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// Duplicate attribute name is illegal. Here the section(s) 3.1 [44] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP44fail5() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// SGML Unordered content models not allowed Here the section(s) 3.2.1 [47] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml13() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + + + + +"); + } + /// + /// Invalid operator '|' must match previous operator ',' Here the section(s) 3.2.1 [47] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP47fail1() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// Illegal character '-' in Element-content model Here the section(s) 3.2.1 [47] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP47fail2() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// Optional character must follow a name or list Here the section(s) 3.2.1 [47] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP47fail3() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// Illegal space before optional character Here the section(s) 3.2.1 [47] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP47fail4() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// No whitespace before "?" in content model Here the section(s) 3.2.1 [48] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfContent01() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// No whitespace before "*" in content model Here the section(s) 3.2.1 [48] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfContent02() + { + var document = DocumentBuilder.Xml(@" + +]> + + +"); + } + /// + /// No whitespace before "+" in content model Here the section(s) 3.2.1 [48] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfContent03() + { + var document = DocumentBuilder.Xml(@" + +]> + + +"); + } + + /// + /// Illegal space before optional character Here the section(s) 3.2.1 [48] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP48fail1() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// Illegal space before optional character Here the section(s) 3.2.1 [48] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP48fail2() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// connectors must match Here the section(s) 3.2.1 [49] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP49fail1() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// connectors must match Here the section(s) 3.2.1 [50] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP50fail1() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// occurrence on #PCDATA group must be * Here the section(s) 3.2.2 [51] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP51fail1() + { + var document = DocumentBuilder.Xml(@" +]> +"); + } + + /// + /// quote types must match. Here the section(s) 2.9 [32] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP32fail1() + { + var document = DocumentBuilder.Xml(@" + +"); + } + /// + /// quote types must match. Here the section(s) 2.9 [32] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP32fail2() + { + var document = DocumentBuilder.Xml(@" + +"); + } + /// + /// initial S is required. Here the section(s) 2.9 [32] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP32fail3() + { + var document = DocumentBuilder.Xml(@" + +"); + } + /// + /// quotes are required. Here the section(s) 2.9 [32] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP32fail4() + { + var document = DocumentBuilder.Xml(@" + +"); + } + /// + /// yes or no must be lower case. Here the section(s) 2.9 [32] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP32fail5() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// Whitespace required between attributes. Here the section(s) 3.1 [40] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist10() + { + var document = DocumentBuilder.Xml(@" + + +]> + + + +"); + } + + /// + /// S is required between attributes. Here the section(s) 3.1 [40] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP40fail1() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// tags start with names, not nmtokens. Here the section(s) 3.1 [40] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP40fail2() + { + var document = DocumentBuilder.Xml(@"<3notname>"); + } + + /// + /// tags start with names, not nmtokens. Here the section(s) 3.1 [40] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP40fail3() + { + var document = DocumentBuilder.Xml(@"<3notname>"); + } + + /// + /// no space before name. Here the section(s) 3.1 [40] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP40fail4() + { + var document = DocumentBuilder.Xml(@"< doc>"); + } + + /// + /// quotes are required (contrast with SGML) Here the section(s) 3.1 [41] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP41fail1() + { + var document = DocumentBuilder.Xml(@" +]> +"); + } + /// + /// attribute name is required (contrast with SGML). Here the section(s) 3.1 [41] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP41fail2() + { + var document = DocumentBuilder.Xml(@" +]> +"); + } + /// + /// Eq required. Here the section(s) 3.1 [41] apply. This test is taken from the + /// collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP41fail3() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// EOF in middle of incomplete ETAG Here the section(s) 3.1 [42] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfElement00() + { + var document = DocumentBuilder.Xml(@" + Incomplete end tag. + + /// EOF in middle of incomplete ETAG. Here the section(s) 3.1 [42] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfElement01() + { + var document = DocumentBuilder.Xml(@" + Incomplete end tag. + + /// no space before name. Here the section(s) 3.1 [42] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP42fail1() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// cannot end with "/>". Here the section(s) 3.1 [42] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP42fail2() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// no NET (contrast with SGML), Here the section(s) 3.1 [42] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP42fail3() + { + var document = DocumentBuilder.Xml(@" + /// Illegal markup (<%@ ... %>). Here the section(s) 3.1 [43] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfElement02() + { + var document = DocumentBuilder.Xml(@" ]> + + <% @ LANGUAGE=""VBSCRIPT"" %> + +"); + } + + /// + /// Illegal markup (<% ... %>). Here the section(s) 3.1 [43] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfElement03() + { + var document = DocumentBuilder.Xml(@" ]> + + <% document.println (""hello, world""); %> + + +"); + } + + /// + /// Illegal markup (<!ELEMENT ... >). Here the section(s) 3.1 [43] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfElement04() + { + var document = DocumentBuilder.Xml(@" ]> + + + +"); + } + + /// + /// no non-comment declarations. Here the section(s) 3.1 [43] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP43fail1() + { + var document = DocumentBuilder.Xml(@" +CharData""> +]> + + + +"); + } + + /// + /// no conditional sections. Here the section(s) 3.1 [43] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP43fail2() + { + var document = DocumentBuilder.Xml(@" +CharData""> +]> + + + +"); + } + + /// + /// no conditional sections. Here the section(s) 3.1 [43] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP43fail3() + { + var document = DocumentBuilder.Xml(@" +CharData""> +]> + + + +"); + } + + /// + /// Whitespace required between attributes. Here the section(s) 3.1 [44] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfAttlist11() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +"); + } + + /// + /// Illegal space before Empty element tag. Here the section(s) 3.1 [44] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP44fail1() + { + var document = DocumentBuilder.Xml(@"< doc/>"); + } + + /// + /// Illegal space after Empty element tag. Here the section(s) 3.1 [44] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP44fail2() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// no S after "<!". Here the section(s) 4.2 [71] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP71fail3() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// S is required after "<!ENTITY". Here the section(s) 4.2 [71] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP71fail4() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + + /// + /// S is required after "<!ENTITY". Here the section(s) 4.2 [72] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP72fail1() + { + var document = DocumentBuilder.Xml(@" +""> +]> + +"); + } + + /// + /// incomplete character reference. Here the section(s) 2.3 [9] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP09fail3() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// quote types must match. Here the section(s) 2.3 [9] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP09fail4() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// quote types must match. Here the section(s) 2.3 [9] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP09fail5() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// '<' excluded. Here the section(s) 2.4 [14] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP14fail1() + { + var document = DocumentBuilder.Xml(@"< +"); + } + + /// + /// '&' excluded. Here the section(s) 2.4 [14] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP14fail2() + { + var document = DocumentBuilder.Xml(@"& +"); + } + + /// + /// "]]>" excluded. Here the section(s) 2.4 [14] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP14fail3() + { + var document = DocumentBuilder.Xml(@"a]]>b +"); + } + + /// + /// Comments may not contain "--". Here the section(s) 2.5 [15] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml03() + { + var document = DocumentBuilder.Xml(@" ]> + + + +"); + } + + /// + /// comments can't end in '-'. Here the section(s) 2.5 [15] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP15fail1() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// one comment per comment (contrasted with SGML). Here the section(s) 2.5 [15] + /// apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP15fail2() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// can't include 2 or more adjacent '-'s. Here the section(s) 2.5 [15] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP15fail3() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// No space between PI target name and data. Here the section(s) 2.6 [16] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfPi() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// "xml" is an invalid PITarget. Here the section(s) 2.6 [16] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP16fail1() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// a PITarget must be present. Here the section(s) 2.6 [16] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP16fail2() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// no space before "CDATA". Here the section(s) 2.7 [18] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP18fail1() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// no space after "CDATA". Here the section(s) 2.7 [18] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP18fail2() + { + var document = DocumentBuilder.Xml(@""); + } + + /// + /// CDSect's can't nest. Here the section(s) 2.7 [18] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP18fail3() + { + var document = DocumentBuilder.Xml(@" + +]]> +"); + } + + /// + /// This refers to an undefined parameter entity reference within a markup declaration + /// in the internal DTD subset, violating the PEs in Internal Subset WFC. Here the + /// section(s) 2.8 apply. This test is taken from the collection James Clark XMLTEST + /// cases, 18-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfValidSa094() + { + var document = DocumentBuilder.Xml(@" + + +]> + +"); + } + + /// + /// XML declaration must be at the very beginning of a document; it"s not a + /// processing instruction. Here the section(s) 2.8 apply. This test is + /// taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfSgml02() + { + var document = DocumentBuilder.Xml(@" + + ]> + +"); + } + + /// + /// prolog must start with XML decl. Here the section(s) 2.8 [22] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP22fail1() + { + var document = DocumentBuilder.Xml(@" + + +"); + } + + /// + /// prolog must start with XML decl. Here the section(s) 2.8 [22] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP22fail2() + { + var document = DocumentBuilder.Xml(@" +]> + + +"); + } + + /// + /// "xml" must be lower-case. Here the section(s) 2.8 [23] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP23fail1() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// VersionInfo must be supplied. Here the section(s) 2.8 [23] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP23fail2() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// VersionInfo must come first. Here the section(s) 2.8 [23] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP23fail3() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// SDDecl must come last. Here the section(s) 2.8 [23] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP23fail4() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// no SGML-type PIs. Here the section(s) 2.8 [23] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP23fail5() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// XML declarations must be correctly terminated. Here the section(s) 2.8 [23] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP39fail4() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// XML declarations must be correctly terminated. Here the section(s) 2.8 [23] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP39fail5() + { + var document = DocumentBuilder.Xml(@" + +]> + + + +"); + } + + /// + /// quote types must match. Here the section(s) 2.8 [24] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP24fail1() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// quote types must match. Here the section(s) 2.8 [24] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP24fail2() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// Comment is illegal in VersionInfo. Here the section(s) 2.8 [25] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP25fail1() + { + var document = DocumentBuilder.Xml(@" =""1.0""?> + +"); + } + + /// + /// Illegal character in VersionNum. Here the section(s) 2.8 [26] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP26fail1() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// Illegal character in VersionNum. Here the section(s) 2.8 [26] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP26fail2() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// References aren't allowed in Misc, even if they would resolve to valid Misc. + /// Here the section(s) 2.8 [27] apply. This test is taken from the collection + /// OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP27fail1() + { + var document = DocumentBuilder.Xml(@" + + +"); + } + + /// + /// only declarations in DTD. Here the section(s) 2.8 [28] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP28fail1() + { + var document = DocumentBuilder.Xml(@" + +]> +"); + } + + /// + /// A processor must not pass unknown declaration types. Here the section(s) 2.8 + /// [29] apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP29fail1() + { + var document = DocumentBuilder.Xml(@" + +]> + +"); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Parser/XmlNotWfExtDtd.cs b/src/AngleSharp.Xml.Tests/Parser/XmlNotWfExtDtd.cs new file mode 100644 index 0000000..17e43cb --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Parser/XmlNotWfExtDtd.cs @@ -0,0 +1,163 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using AngleSharp; +using AngleSharp.Xml; + +namespace UnitTests +{ + [TestClass] + public class XmlNotWfExtDtd + { + [TestInitialize] + public void SetUp() + { + Configuration.RegisterHttpRequester(); + } + + [TestCleanup] + public void CleanUp() + { + Configuration.UnregisterHttpRequester(); + } + + /// + /// Text declarations (which optionally begin any external entity) are + /// required to have "encoding=...". Here the section(s) 4.3.1 [77] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfDtd07() + { + var document = DocumentBuilder.Xml(@" +]> + +"); + } + + /// + /// Text declarations (which optionally begin any external entity) are required + /// to have "encoding=...". Here the section(s) 4.3.1 [77] apply. This test is taken + /// from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfEncoding07() + { + var document = DocumentBuilder.Xml(@" + + + +]> + +"); + } + + /// + /// Only INCLUDE and IGNORE are conditional section keywords. Here the section(s) 3.4 [61] apply. + /// This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfCond01() + { + var document = DocumentBuilder.Xml(@" +]> + + +"); + } + + /// + /// no other types, including TEMP, which is valid in SGML Here the section(s) 3.4 [61] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP61fail1() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// INCLUDE must be upper case Here the section(s) 3.4 [62] apply. This + /// test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP62fail1() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// no spaces in terminating delimiter Here the section(s) 3.4 [62] apply. This test + /// is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP62fail2() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// IGNORE must be upper case Here the section(s) 3.4 [63] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP63fail1() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// delimiters must be balanced Here the section(s) 3.4 [63] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP63fail2() + { + var document = DocumentBuilder.Xml(@" +"); + } + + /// + /// section delimiters must balance Here the section(s) 3.4 [64] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP64fail1() + { + var document = DocumentBuilder.Xml(@" + +"); + } + + /// + /// section delimiters must balance Here the section(s) 3.4 [64] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + [ExpectedException(typeof(XmlSyntaxException))] + public void XmlNotWfOP64fail2() + { + var document = DocumentBuilder.Xml(@" + +"); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Parser/XmlParsing.cs b/src/AngleSharp.Xml.Tests/Parser/XmlParsing.cs new file mode 100644 index 0000000..406e0d8 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Parser/XmlParsing.cs @@ -0,0 +1,75 @@ +namespace AngleSharp.Core.Tests.Xml +{ + using AngleSharp.Xml.Parser; + using NUnit.Framework; + + [TestFixture] + public class XmlParsing + { + [Test] + public void ParseHtmlStructureInXmlShouldThrowError() + { + var source = @" My Title +

My paragraph

"; + var parser = new XmlParser(); + Assert.Catch(() => parser.ParseDocument(source)); + } + + [Test] + public void ParseHtmlStructureInXmlShouldNotThrowErrorIfSuppressed() + { + var source = @" My Title +

My paragraph

"; + var parser = new XmlParser(new XmlParserOptions + { + IsSuppressingErrors = true + }); + var document = parser.ParseDocument(source); + Assert.AreEqual(1, document.Children.Length); + } + + [Test] + public void ParseHtmlEntityInXmlShouldThrowError() + { + var source = @"  "; + var parser = new XmlParser(); + Assert.Catch(() => parser.ParseDocument(source)); + } + + [Test] + public void ParseHtmlEntityInXmlShouldNotThrowErrorIfSuppressed() + { + var source = @"  "; + var parser = new XmlParser(new XmlParserOptions + { + IsSuppressingErrors = true + }); + var document = parser.ParseDocument(source); + Assert.AreEqual(1, document.Children.Length); + } + + [Test] + public void ParseValidXmlEntityShouldBeRepresentedCorrectly() + { + var source = @" &"; + var parser = new XmlParser(new XmlParserOptions + { + IsSuppressingErrors = true + }); + var document = parser.ParseDocument(source); + Assert.AreEqual("&", document.DocumentElement.TextContent); + } + + [Test] + public void ParseInvalidXmlEntityShouldBeSerialized() + { + var source = @"  "; + var parser = new XmlParser(new XmlParserOptions + { + IsSuppressingErrors = true + }); + var document = parser.ParseDocument(source); + Assert.AreEqual(" ", document.DocumentElement.TextContent); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Parser/XmlValidDocuments.cs b/src/AngleSharp.Xml.Tests/Parser/XmlValidDocuments.cs new file mode 100644 index 0000000..ccf67ac --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Parser/XmlValidDocuments.cs @@ -0,0 +1,3659 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using AngleSharp; +using AngleSharp.DOM; + +namespace UnitTests.Xml +{ + /// + /// (Conformance) Tests taken from + /// http://www.w3.org/XML/Test/xmlconf-20031210.html + /// + [TestClass] + public class XmlValidDocuments + { + /// + /// Tests with a xml document consisting of prolog followed by element then Misc. + /// There is an output test associated with this input file. Here the section(s) 2.1 + /// apply. This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 1. + /// + [TestMethod] + public void XmlIbmValidP01Ibm01v01() + { + var document = DocumentBuilder.Xml(@" + + + + + + + + +]> + + + + + This is a white tiger in Mirage!! + + + + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that although whitespace can be used to set apart + /// markup for greater readability it is not necessary. There is an output + /// test associated with this input file. Here the section(s) 2.10 apply. This + /// test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa084() + { + var document = DocumentBuilder.Xml(@"]> +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that extra whitespace is not indented for inclusion in + /// the delivered version of the document. There is an output test associated + /// with this input file. Here the section(s) 2.10 apply. This test is taken + /// from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa093() + { + var document = DocumentBuilder.Xml(@" +]> + + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that a line break within CDATA will be normalized. There + /// is an output test associated with this input file. Here the section(s) 2.11 + /// apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa116() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// A combination of carriage return line feed in an external entity must be + /// normalized to a single newline. There is an output test associated with + /// this input file. Here the section(s) 2.11 apply. This test is taken from + /// the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidExtSa001() + { + var document = DocumentBuilder.Xml(@" + +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// A carriage return (also CRLF) in an external entity must be normalized + /// to a single newline. There is an output test associated with this input + /// file. Here the section(s) 2.11 apply. This test is taken from the collection + /// James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidExtSa002() + { + var document = DocumentBuilder.Xml(@" + +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// A carriage return (also CRLF) in an external entity must be normalized + /// to a single newline. There is an output test associated with this input + /// file. Here the section(s) 2.11 apply. This test is taken from the + /// collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidExtSa004() + { + var document = DocumentBuilder.Xml(@" + +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// A carriage return (also CRLF) in an external entity must be normalized + /// to a single newline. There is an output test associated with this input + /// file. Here the section(s) 2.11 apply. This test is taken from the + /// collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidExtSa009() + { + var document = DocumentBuilder.Xml(@" + +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// This tests normalization of end-of-line characters (CRLF) within + /// entities to LF, primarily as an output test. There is an output test + /// associated with this input file. Here the section(s) 2.11, 3.3.3 apply. + /// This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa108() + { + var document = DocumentBuilder.Xml(@" + + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests definition of an internal entity holding a carriage return + /// character reference, which must not be normalized before reporting + /// to the application. Line break normalization only occurs when + /// parsing external parsed entities. There is an output test associated + /// with this input file. Here the section(s) 2.11, 4.5 apply. This test + /// is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa068() + { + var document = DocumentBuilder.Xml(@" + +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates the use of optional character and content particles + /// within mixed element content. The test also shows the use of an external + /// entity and that a carriage control line feed in an external entity must + /// be normalized to a single newline. There is an output test associated with + /// this input file. Here the section(s) 2.11 3.2.1 3.2.2 4.2.2 [48] [51] [75] + /// apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidExtSa006() + { + var document = DocumentBuilder.Xml(@" + + +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates the use of a public identifier with and external entity. + /// The test also show that a carriage control line feed combination in an + /// external entity must be normalized to a single newline. There is an output + /// test associated with this input file. Here the section(s) 2.11 4.2.2 [75] + /// apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidExtSa011() + { + var document = DocumentBuilder.Xml(@" + +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests LanguageID with Langcode - Subcode. There is an output test associated + /// with this input file. Here the section(s) 2.12 apply. This test is taken from + /// the collection IBM XML Conformance Test Suite - Production 33. + /// + [TestMethod] + public void XmlIbmValidP33Ibm33v01() + { + var document = DocumentBuilder.Xml(@" + +]> +It is written in English +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Duplicate Test as ibm33v01.xml. There is an output test associated with this + /// input file. Here the section(s) 2.12 apply. This test is taken from the + /// collection IBM XML Conformance Test Suite - Production 34. + /// + [TestMethod] + public void XmlIbmValidP34Ibm34v01() + { + var document = DocumentBuilder.Xml(@" + +]> +It is written in English +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests ISO639Code. There is an output test associated with this input file. + /// Here the section(s) 2.12 apply. This test is taken from the collection IBM + /// XML Conformance Test Suite - Production 35. + /// + [TestMethod] + public void XmlIbmValidP35Ibm35v01() + { + var document = DocumentBuilder.Xml(@" + +]> +It is written in English +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests IanaCode. There is an output test associated with this input file. + /// Here the section(s) 2.12 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 36. + /// + [TestMethod] + public void XmlIbmValidP36Ibm36v01() + { + var document = DocumentBuilder.Xml(@" + +]> +It is written in English +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests UserCode. There is an output test associated with this input file. + /// Here the section(s) 2.12 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 37. + /// + [TestMethod] + public void XmlIbmValidP37Ibm37v01() + { + var document = DocumentBuilder.Xml(@" + +]> +It is written in English +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests SubCode. There is an output test associated with this input file. Here + /// the section(s) 2.12 apply. This test is taken from the collection IBM XML + /// Conformance Test Suite - Production 38. + /// + [TestMethod] + public void XmlIbmValidP38Ibm38v01() + { + var document = DocumentBuilder.Xml(@" + +]> +It is written in English +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests a lowercase ISO language code. There is an output test associated with + /// this input file. Here the section(s) 2.12 [35] apply. This test is taken from + /// the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidVLang01() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests a ISO language code with a subcode. There is an output test associated + /// with this input file. Here the section(s) 2.12 [35] apply. This test is taken + /// from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidVLang02() + { + var document = DocumentBuilder.Xml(@" + +]> + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests an uppercase ISO language code. There is an output test associated with + /// this input file. Here the section(s) 2.12 [35] apply. This test is taken from + /// the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidVLang05() + { + var document = DocumentBuilder.Xml(@" + +]> + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests a IANA language code with a subcode. There is an output test associated + /// with this input file. Here the section(s) 2.12 [36] apply. This test is taken + /// from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidVLang03() + { + var document = DocumentBuilder.Xml(@" + +]> + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests a user language code with a subcode. There is an output test associated + /// with this input file. Here the section(s) 2.12 [37] apply. This test is taken + /// from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidVLang04() + { + var document = DocumentBuilder.Xml(@" + +]> + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests a user language code. There is an output test associated with this input file. + /// Here the section(s) 2.12 [37] apply. This test is taken from the collection Sun + /// Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidVLang06() + { + var document = DocumentBuilder.Xml(@" + +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests Char with 3 characters - 2 boundaries plus 1 in the middle - for each range + /// plus #x20 #x9 #xD #xA Here the section(s) 2.2 apply. This test is taken from the + /// collection IBM XML Conformance Test Suite - Production 2. + /// + [TestMethod] + public void XmlIbmValidP02Ibm02v01() + { + var document = DocumentBuilder.Xml(@" + + + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// various Misc items where they can occur Here the section(s) 2.2 [1] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP01pass2() + { + var document = DocumentBuilder.Xml(@" + + + + + + + + + + +]> + +
+ + + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that characters outside of normal ascii range can be used + /// as element content. There is an output test associated with this input file. + /// Here the section(s) 2.2 [2] apply. This test is taken from the collection + /// James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa049() + { + var document = DocumentBuilder.Xml(@" +]> +£ +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that characters outside of normal ascii range can be used as + /// element content. There is an output test associated with this input file. Here the + /// section(s) 2.2 [2] apply. This test is taken from the collection James Clark + /// XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa050() + { + var document = DocumentBuilder.Xml(@" +]> +เจมส์ +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// The document is encoded in UTF-16 and uses some name characters well outside + /// of the normal ASCII range. There is an output test associated with this input + /// file. Here the section(s) 2.2 [2] apply. This test is taken from the collection + /// James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa051() + { + var document = DocumentBuilder.Xml(@" +]> +<เจมส์> +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// The document is encoded in UTF-8 and the text inside the root + /// element uses two non-ASCII characters, encoded in UTF-8 and each of which + /// expands to a Unicode surrogate pair. There is an output test associated with this + /// input file. Here the section(s) 2.2 [2] apply. This test is taken from the + /// collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa052() + { + var document = DocumentBuilder.Xml(@" +]> +𐀀􏿽 +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests all 4 legal white space characters - #x20 #x9 #xD #xA. Here the + /// section(s) 2.3 apply. This test is taken from the collection IBM XML + /// Conformance Test Suite - Production 3. + /// + [TestMethod] + public void XmlIbmValidP03Ibm03v01() + { + var document = DocumentBuilder.Xml(@" + + + + + + + +]> + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Empty EntityValue is legal. There is an output test associated with + /// this input file. Here the section(s) 2.3 apply. This test is taken + /// from the collection IBM XML Conformance Test Suite - Production 9. + /// + [TestMethod] + public void XmlIbmValidP09Ibm09v01() + { + var document = DocumentBuilder.Xml(@" + + +]> + +My Name is &FullName;. + + + + + + + + + + + + + + ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests a normal EnitityValue. There is an output test associated with + /// this input file. Here the section(s) 2.3 apply. This test is taken + /// from the collection IBM XML Conformance Test Suite - Production 9. + /// + [TestMethod] + public void XmlIbmValidP09Ibm09v02() + { + var document = DocumentBuilder.Xml(@" + + +]> + +My Name is &FullName;. ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests EnitityValue referencing a General Entity. There is an output test associated + /// with this input file. Here the section(s) 2.3 apply. This test is taken from the + /// collection IBM XML Conformance Test Suite - Production 9. + /// + [TestMethod] + public void XmlIbmValidP09Ibm09v04() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + +My Name is &FullName;. ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests empty AttValue with double quotes as the delimiters. There is + /// an output test associated with this input file. Here the section(s) + /// 2.3 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 10. + /// + [TestMethod] + public void XmlIbmValidP10Ibm10v01() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +My Name is Snow &mylast; Man. + + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests empty AttValue with single quotes as the delimiters. There is an output + /// test associated with this input file. Here the section(s) 2.3 apply. This test + /// is taken from the collection IBM XML Conformance Test Suite - Production 10. + /// + [TestMethod] + public void XmlIbmValidP10Ibm10v02() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +My Name is Snow &mylast; Man. + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test AttValue with double quotes as the delimiters and single quote inside. + /// There is an output test associated with this input file. Here the section(s) + /// 2.3 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 10. + /// + [TestMethod] + public void XmlIbmValidP10Ibm10v03() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +My Name is &myfirst; &mylast;. ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test AttValue with single quotes as the delimiters and double quote inside. + /// There is an output test associated with this input file. Here the section(s) + /// 2.3 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 10. + /// + [TestMethod] + public void XmlIbmValidP10Ibm10v04() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +My Name is &myfirst; &mylast;. + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + } + + /// + /// Test AttValue with a GE reference and double quotes as the delimiters. There + /// is an output test associated with this input file. Here the section(s) 2.3 apply. + /// This test is taken from the collection IBM XML Conformance Test Suite - Production 10. + /// + [TestMethod] + public void XmlIbmValidP10Ibm10v05() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +My Name is &mylast;. + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test AttValue with a GE reference and single quotes as the delimiters. There is + /// an output test associated with this input file. Here the section(s) 2.3 apply. + /// This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 10. + /// + [TestMethod] + public void XmlIbmValidP10Ibm10v06() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +My Name is &mylast;. + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// testing AttValue with mixed references and text content in double quotes. There is + /// an output test associated with this input file. Here the section(s) 2.3 apply. + /// This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 10. + /// + [TestMethod] + public void XmlIbmValidP10Ibm10v07() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +My first Name is &myfirst; and my last name is &mylast;. +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests empty systemliteral using the double quotes. There is an output test associated with + /// this input file. Here the section(s) 2.3 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 11. + /// + [TestMethod] + public void XmlIbmValidP11Ibm11v01() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +My Name is SnowMan. + + + + + + + + + ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// testing AttValue with mixed references and text content in single quotes. There is + /// an output test associated with this input file. Here the section(s) 2.3 apply. This + /// test is taken from the collection IBM XML Conformance Test Suite - Production 10. + /// + [TestMethod] + public void XmlIbmValidP10Ibm10v08() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + +My first Name is &myfirst; and my last name is &mylast;. + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests empty systemliteral using the single quotes. There is an output test + /// associated with this input file. Here the section(s) 2.3 apply. This test + /// is taken from the collection IBM XML Conformance Test Suite - Production 11. + /// + [TestMethod] + public void XmlIbmValidP11Ibm11v02() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +My Name is SnowMan. +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Makes sure that PUBLIC identifiers may have some strange characters. NOTE: + /// The XML editors have said that the XML specification errata will specify that + /// parameter entity expansion does not occur in PUBLIC identifiers, so that the + /// '%' character will not flag a malformed parameter entity reference. There is an + /// output test associated with this input file. Here the section(s) 2.3 [12] apply. + /// This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa100() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + /// + /// system literals may not contain URI fragments. Here the section(s) 2.3, + /// 4.2.2 [11] apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP11pass1() + { + var document = DocumentBuilder.Xml(@" + +?>/\''""> + + + +]> + +"); + } + + /// + /// valid public IDs. Here the section(s) 2.3 [12] apply. This test is taken from + /// the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP12pass1() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Uses a legal XML 1.0 name consisting of a single colon character (disallowed + /// by the latest XML Namespaces draft). There is an output test associated with + /// this input file. Here the section(s) 2.3 [4] apply. This test is taken from + /// the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa012() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// The document is encoded in UTF-8 and the name of the root element type uses + /// non-ASCII characters. There is an output test associated with this input file. + /// Here the section(s) 2.3 [5] apply. This test is taken from the collection + /// James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa063() + { + var document = DocumentBuilder.Xml(@" +]> +<เจมส์> +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// various satisfactions of the Names production in a NAMES attribute Here the + /// section(s) 2.3 [6] apply. This test is taken from the collection OASIS/NIST + /// TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP06pass1() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// various valid Nmtoken 's in an attribute list declaration. Here the + /// section(s) 2.3 [7] apply. This test is taken from the collection OASIS/NIST + /// TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP07pass1() + { + var document = DocumentBuilder.Xml(@" + +]> +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// various satisfaction of an NMTOKENS attribute value. Here the section(s) 2.3 + /// [8] apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP08pass1() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demostrates that extra whitespace is normalized into a single space + /// character. There is an output test associated with this input file. Here the + /// section(s) 2.3 2.10 apply. This test is taken from the collection James Clark + /// XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa092() + { + var document = DocumentBuilder.Xml(@" + +]> + + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that an attribute can have a null value. There is an output + /// test associated with this input file. Here the section(s) 2.3 3.1 [10][40][41] + /// apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa109() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + } + + /// + /// Test demonstrates that the Attribute in a Start-tag can consist of numerals + /// along with special characters. There is an output test associated with this + /// input file. Here the section(s) 2.3 3.1 [13] [40] apply. This test is taken + /// from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa013() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that all lower case letters are valid for the Attribute in a + /// Start-tag. There is an output test associated with this input file. Here the + /// section(s) 2.3 3.1 [13] [40] apply. This test is taken from the collection James + /// Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa014() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that all upper case letters are valid for the Attribute in a + /// Start-tag. There is an output test associated with this input file. Here the + /// section(s) 2.3 3.1 [13] [40] apply. This test is taken from the collection James + /// Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa015() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that PubidChar can be used for element content. There is an + /// output test associated with this input file. Here the section(s) 2.3 3.1 [43] + /// apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa009() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Testing CharData with empty string. There is an output test associated with this + /// input file. Here the section(s) 2.4 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 14. + /// + [TestMethod] + public void XmlIbmValidP14Ibm14v01() + { + var document = DocumentBuilder.Xml(@" + + +]> + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Testing CharData with white space character. There is an output test associated + /// with this input file. Here the section(s) 2.4 apply. This test is taken from the + /// collection IBM XML Conformance Test Suite - Production 14. + /// + [TestMethod] + public void XmlIbmValidP14Ibm14v02() + { + var document = DocumentBuilder.Xml(@" + + +]> + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Testing CharData with a general text string. There is an output test associated with + /// this input file. Here the section(s) 2.4 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 14. + /// + [TestMethod] + public void XmlIbmValidP14Ibm14v03() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +This is a test", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid use of character data, comments, processing instructions and CDATA sections + /// within the start and end tag. Here the section(s) 2.4 2.5 2.6 2.7 [15] [16] [18] + /// apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP43pass1() + { + var document = DocumentBuilder.Xml(@" +CharData""> +]> + +CharData + + +CharData + +&ent;" +CharData + +]]> + +CharData + +&ent;" +CharData + +]]> +&ent;" +CharData + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that character data is valid element content. There is an output + /// test associated with this input file. Here the section(s) 2.4 3.1 [14] [43] apply. + /// This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa048() + { + var document = DocumentBuilder.Xml(@" +]> +] +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates character references can be used for element content. There is an + /// output test associated with this input file. Here the section(s) 2.4 3.1 [43] apply. + /// This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa008() + { + var document = DocumentBuilder.Xml(@" +]> +&<>"' +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Comments may contain any legal XML characters; only the string "--" is disallowed. There + /// is an output test associated with this input file. Here the section(s) 2.5 apply. This + /// test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa119() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests empty comment. There is an output test associated with this input file. Here the + /// section(s) 2.5 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 15. + /// + [TestMethod] + public void XmlIbmValidP15Ibm15v01() + { + var document = DocumentBuilder.Xml(@" + +]> + + +My Name is SnowMan. + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests comment with regular text. There is an output test associated with this input file. + /// Here the section(s) 2.5 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 15. + /// + [TestMethod] + public void XmlIbmValidP15Ibm15v02() + { + var document = DocumentBuilder.Xml(@" + +]> + + +My Name is SnowMan. ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests comment with one dash inside. There is an output test associated with this input file. + /// Here the section(s) 2.5 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 15. + /// + [TestMethod] + public void XmlIbmValidP15Ibm15v03() + { + var document = DocumentBuilder.Xml(@" + +]> + + +My Name is SnowMan. ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests comment with more comprehensive content There is an output test associated with this + /// input file. Here the section(s) 2.5 apply. This test is taken from the collection IBM XML + /// Conformance Test Suite - Production 15. + /// + [TestMethod] + public void XmlIbmValidP15Ibm15v04() + { + var document = DocumentBuilder.Xml(@" + +]> + + +My Name is SnowMan. +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Comments don't get parameter entity expansion. There is an output test associated with this + /// input file. Here the section(s) 2.5 [15] apply. This test is taken from the collection Sun + /// Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidDtd01() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that comments are valid element content. There is an output test associated + /// with this input file. Here the section(s) 2.5 3.1 [15] [43] apply. This test is taken from + /// the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa021() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that comments are valid element content and that all characters before + /// the double-hypen right angle combination are considered part of thecomment. There is an + /// output test associated with this input file. Here the section(s) 2.5 3.1 [15] [43] apply. + /// This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa022() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests PI definition with only PItarget name and nothing else. There is an output test + /// associated with this input file. Here the section(s) 2.6 apply. This test is taken from + /// the collection IBM XML Conformance Test Suite - Production 16. + /// + [TestMethod] + public void XmlIbmValidP16Ibm16v01() + { + var document = DocumentBuilder.Xml(@" + +]> + + +My Name is SnowMan. + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests PI definition with only PItarget name and a white space. There is an output test + /// associated with this input file. Here the section(s) 2.6 apply. This test is taken from + /// the collection IBM XML Conformance Test Suite - Production 16. + /// + [TestMethod] + public void XmlIbmValidP16Ibm16v02() + { + var document = DocumentBuilder.Xml(@" + +]> + + +My Name is SnowMan. ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests PI definition with PItarget name and text that contains question mark and right + /// angle. There is an output test associated with this input file. Here the section(s) 2.6 + /// apply. This test is taken from the collection IBM XML Conformance Test Suite - Production 16. + /// + [TestMethod] + public void XmlIbmValidP16Ibm16v03() + { + var document = DocumentBuilder.Xml(@" + +]> + + IN PI ?> +My Name is SnowMan. ", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests PITarget name. There is an output test associated with this input file. Here the + /// section(s) 2.6 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 17. + /// + [TestMethod] + public void XmlIbmValidP17Ibm17v01() + { + var document = DocumentBuilder.Xml(@" + +]> + + +My Name is SnowMan. + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid comment and that it may appear anywhere in the document + /// including at the end. There is an output test associated with this input file. Here + /// the section(s) 2.6 [15] apply. This test is taken from the collection James Clark + /// XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa037() + { + var document = DocumentBuilder.Xml(@" +]> + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid comment and that it may appear anywhere in the document + /// including the beginning. There is an output test associated with this input file. + /// Here the section(s) 2.6 [15] apply. This test is taken from the collection James + /// Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa038() + { + var document = DocumentBuilder.Xml(@" + +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid processing instruction. There is an output test associated + /// with this input file. Here the section(s) 2.6 [16] apply. This test is taken from the + /// collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa036() + { + var document = DocumentBuilder.Xml(@" +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid processing instruction and that it may appear at the beginning + /// of the document. There is an output test associated with this input file. Here the + /// section(s) 2.6 [16] apply. This test is taken from the collection James Clark XMLTEST + /// cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa039() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that extra whitespace within a processing instruction willnormalized + /// into s single space character. There is an output test associated with this input file. + /// Here the section(s) 2.6 2.10 [16] apply. This test is taken from the collection James + /// Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa055() + { + var document = DocumentBuilder.Xml(@" +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that extra whitespace within a processing instruction is converted + /// into a single space character. There is an output test associated with this input file. + /// Here the section(s) 2.6 2.10 [16] apply. This test is taken from the collection James + /// Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa098() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that Processing Instructions are valid element content. There is an + /// output test associated with this input file. Here the section(s) 2.6 3.1 [16] [43] + /// apply. This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa016() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that Processing Instructions are valid element content and there + /// can be more than one. There is an output test associated with this input file. Here + /// the section(s) 2.6 3.1 [16] [43] apply. This test is taken from the collection James + /// Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa017() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests CDSect with CDStart CData CDEnd. There is an output test associated with this + /// input file. Here the section(s) 2.7 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 18. + /// + [TestMethod] + public void XmlIbmValidP18Ibm18v01() + { + var document = DocumentBuilder.Xml(@" + +]> + + + +My Name is SnowMan. text]]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual("My Name is SnowMan. This is text ", document.DocumentElement.TextContent); + } + + /// + /// Tests CDStart. There is an output test associated with this input file. Here the section(s) + /// 2.7 apply. This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 19. + /// + [TestMethod] + public void XmlIbmValidP19Ibm19v01() + { + var document = DocumentBuilder.Xml(@" + +]> + + +My Name is SnowMan. + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual("My Name is SnowMan. This is a test ", document.DocumentElement.TextContent); + } + + /// + /// Tests CDATA with empty string. There is an output test associated with this input file. + /// Here the section(s) 2.7 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 20. + /// + [TestMethod] + public void XmlIbmValidP20Ibm20v01() + { + var document = DocumentBuilder.Xml(@" + +]> + + + +My Name is SnowMan. + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual("My Name is SnowMan. ", document.DocumentElement.TextContent); + } + + /// + /// Tests CDATA with regular content. There is an output test associated with this input file. + /// Here the section(s) 2.7 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 20. + /// + [TestMethod] + public void XmlIbmValidP20Ibm20v02() + { + var document = DocumentBuilder.Xml(@" + +]> + + + +My Name is SnowMan. This is a test]]>", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual("My Name is SnowMan. This is a test", document.DocumentElement.TextContent); + } + + /// + /// Tests CDEnd. There is an output test associated with this input file. Here the section(s) + /// 2.7 apply. This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 21. + /// + [TestMethod] + public void XmlIbmValidP21Ibm21v01() + { + var document = DocumentBuilder.Xml(@" + +]> + + + +My Name is SnowMan. + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual("My Name is SnowMan. This is a test ", document.DocumentElement.TextContent); + } + + /// + /// Test demonstrates that all text within a valid CDATA section is considered text and not + /// recognized as markup. There is an output test associated with this input file. Here the + /// section(s) 2.7 [20] apply. This test is taken from the collection James Clark XMLTEST + /// cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa114() + { + var document = DocumentBuilder.Xml(@" +""> +]> +&e; +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual("&foo;", document.DocumentElement.TextContent); + } + + /// + /// Test demonstrates that CDATA sections are valid element content. There is an output test + /// associated with this input file. Here the section(s) 2.7 3.1 [18] [43] apply. This test is + /// taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa018() + { + var document = DocumentBuilder.Xml(@" +]> +]]> +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual("", document.DocumentElement.TextContent); + } + + /// + /// Test demonstrates that CDATA sections are valid element content and that ampersands may occur in + /// their literal form. There is an output test associated with this input file. Here the section(s) + /// 2.7 3.1 [18] [43] apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa019() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstractes that CDATA sections are valid element content and that everyting between the + /// CDStart and CDEnd is recognized as character data not markup. There is an output test associated + /// with this input file. Here the section(s) 2.7 3.1 [18] [43] apply. This test is taken from the + /// collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa020() + { + var document = DocumentBuilder.Xml(@" +]> +]]]> +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests prolog with XMLDecl and doctypedecl. There is an output test associated with this input file. + /// Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 22. + /// + [TestMethod] + public void XmlIbmValidP22Ibm22v01() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests prolog with doctypedecl. There is an output test associated with this input file. Here the + /// section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 22. + /// + [TestMethod] + public void XmlIbmValidP22Ibm22v02() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests prolog with Misc doctypedecl. There is an output test associated with this input file. Here + /// the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 22. + /// + [TestMethod] + public void XmlIbmValidP22Ibm22v03() + { + var document = DocumentBuilder.Xml(@" +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests prolog with doctypedecl Misc. There is an output test associated with this input file. Here + /// the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 22. + /// + [TestMethod] + public void XmlIbmValidP22Ibm22v04() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests prolog with XMLDecl Misc doctypedecl. There is an output test associated with this input + /// file. Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 22. + /// + [TestMethod] + public void XmlIbmValidP22Ibm22v05() + { + var document = DocumentBuilder.Xml(@" + + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests prolog with XMLDecl doctypedecl Misc. There is an output test associated with this input + /// file. Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 22. + /// + [TestMethod] + public void XmlIbmValidP22Ibm22v06() + { + var document = DocumentBuilder.Xml(@" + +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests prolog with XMLDecl Misc doctypedecl Misc. There is an output test associated with this + /// input file. Here the section(s) 2.8 apply. This test is taken from the collection IBM XML + /// Conformance Test Suite - Production 22. + /// + [TestMethod] + public void XmlIbmValidP22Ibm22v07() + { + var document = DocumentBuilder.Xml(@" + + +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests XMLDecl with VersionInfo only. There is an output test associated with this input file. + /// Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 23. + /// + [TestMethod] + public void XmlIbmValidP23Ibm23v01() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests XMLDecl with VersionInfo EncodingDecl. There is an output test associated with this input + /// file. Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 23. + /// + [TestMethod] + public void XmlIbmValidP23Ibm23v02() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests XMLDecl with VersionInfo SDDecl. There is an output test associated with this input file. + /// Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 23. + /// + [TestMethod] + public void XmlIbmValidP23Ibm23v03() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests XMLDecl with VerstionInfo and a trailing whitespace char. There is an output test associated + /// with this input file. Here the section(s) 2.8 apply. This test is taken from the collection IBM + /// XML Conformance Test Suite - Production 23. + /// + [TestMethod] + public void XmlIbmValidP23Ibm23v04() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests XMLDecl with VersionInfo EncodingDecl SDDecl. There is an output test associated with this + /// input file. Here the section(s) 2.8 apply. This test is taken from the collection IBM XML + /// Conformance Test Suite - Production 23. + /// + [TestMethod] + public void XmlIbmValidP23Ibm23v05() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests XMLDecl with VersionInfo EncodingDecl SDDecl and a trailing whitespace. There is an output + /// test associated with this input file. Here the section(s) 2.8 apply. This test is taken from + /// the collection IBM XML Conformance Test Suite - Production 23. + /// + [TestMethod] + public void XmlIbmValidP23Ibm23v06() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests VersionInfo with single quote. There is an output test associated with this input file. + /// Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 24. + /// + [TestMethod] + public void XmlIbmValidP24Ibm24v01() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests VersionInfo with double quote. There is an output test associated with this input file. + /// Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance + /// Test Suite - Production 24. + /// + [TestMethod] + public void XmlIbmValidP24Ibm24v02() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests EQ with =. There is an output test associated with this input file. Here the section(s) 2.8 + /// apply. This test is taken from the collection IBM XML Conformance Test Suite - Production 25. + /// + [TestMethod] + public void XmlIbmValidP25Ibm25v01() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests EQ with = and spaces on both sides. There is an output test associated with this input file. + /// Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 25. + /// + [TestMethod] + public void XmlIbmValidP25Ibm25v02() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests EQ with = and space in front of it. There is an output test associated with this input file. + /// Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 25. + /// + [TestMethod] + public void XmlIbmValidP25Ibm25v03() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests EQ with = and space after it. There is an output test associated with this input file. Here + /// the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 25. + /// + [TestMethod] + public void XmlIbmValidP25Ibm25v04() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests VersionNum 1.0. There is an output test associated with this input file. Here the section(s) + /// 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - Production 26. + /// + [TestMethod] + public void XmlIbmValidP26Ibm26v01() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests Misc with comment. There is an output test associated with this input file. Here the section(s) + /// 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - Production 27. + /// + [TestMethod] + public void XmlIbmValidP27Ibm27v01() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests Misc with PI. There is an output test associated with this input file. Here the section(s) 2.8 apply. + /// This test is taken from the collection IBM XML Conformance Test Suite - Production 27. + /// + [TestMethod] + public void XmlIbmValidP27Ibm27v02() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests Misc with white spaces. There is an output test associated with this input file. Here the + /// section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 27. + /// + [TestMethod] + public void XmlIbmValidP27Ibm27v03() + { + var document = DocumentBuilder.Xml(@" + +]> +S is in the following Misc +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests doctypedecl with internal DTD only. There is an output test associated with this input file. + /// Here the section(s) 2.8 apply. This test is taken from the collection IBM XML Conformance Test + /// Suite - Production 28. + /// + [TestMethod] + public void XmlIbmValidP28Ibm28v01() + { + var document = DocumentBuilder.Xml(@" + +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests markupdecl with combinations of elementdecl, AttlistDecl,EntityDecl, NotationDecl, PI + /// and comment. There is an output test associated with this input file. Here the section(s) 2.8 + /// apply. This test is taken from the collection IBM XML Conformance Test Suite - Production 29. + /// + [TestMethod] + public void XmlIbmValidP29Ibm29v01() + { + var document = DocumentBuilder.Xml(@" + + + + + + + + + + + + +]> + + &forcat; + This is a white tiger in Mirage!! + + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests WFC: PE in internal subset as a positive test. There is an output test associated with + /// this input file. Here the section(s) 2.8 apply. This test is taken from the collection IBM + /// XML Conformance Test Suite - Production 29. + /// + [TestMethod] + public void XmlIbmValidP29Ibm29v02() + { + var document = DocumentBuilder.Xml(@" + + + + + + ""> + %make_leopard_element; + + + + + + +]> + + &forcat; + This is a white tiger in Mirage!! + + + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests extSubset with extSubsetDecl only in the dtd file. There is an output test associated + /// with this input file. Here the section(s) 2.8 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 30. + /// + [TestMethod] + public void XmlIbmValidP30Ibm30v01() + { + var document = DocumentBuilder.Xml(@" +]> + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests extSubsetDecl with combinations of markupdecls, conditionalSects, PEReferences + /// and white spaces. There is an output test associated with this input file. Here the section(s) + /// 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - Production 31. + /// + [TestMethod] + public void XmlIbmValidP31Ibm31v01() + { + var document = DocumentBuilder.Xml(@"""> + %rootElement; + + ""> + %make_tiger_element; +]> + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// XML decl and doctypedecl Here the section(s) 2.8 [22] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP22pass4() + { + var document = DocumentBuilder.Xml(@" + + +]> + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// just doctypedecl Here the section(s) 2.8 [22] apply. This test is taken from the + /// collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP22pass5() + { + var document = DocumentBuilder.Xml(@" + +]> + + + + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// S between decls is not required Here the section(s) 2.8 [22] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP22pass6() + { + var document = DocumentBuilder.Xml(@" +]> +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that both a EncodingDecl and SDDecl are valid within the prolog. + /// There is an output test associated with this input file. Here the section(s) 2.8 [23] + /// apply. This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa033() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid prolog that uses double quotes as delimeters around the + /// VersionNum. There is an output test associated with this input file. Here the + /// section(s) 2.8 [24] apply. This test is taken from the collection James Clark XMLTEST + /// cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa028() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid prolog that uses single quotes as delimters around the + /// VersionNum. There is an output test associated with this input file. Here the + /// section(s) 2.8 [24] apply. This test is taken from the collection James Clark + /// XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa029() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid prolog that contains whitespace on both sides of + /// the equal sign in the VersionInfo. There is an output test associated with + /// this input file. Here the section(s) 2.8 [25] apply. This test is taken from + /// the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa030() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid types of markupdecl. Here the section(s) 2.8 [29] apply. This test is + /// taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP29pass1() + { + var document = DocumentBuilder.Xml(@" + + + + + + + + +]> + +", new DocumentOptions(validating : true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid doctypedecl with Parameter entity reference. The declaration of a parameter + /// entity must precede any reference to it. Here the section(s) 2.8 4.1 [28] [69] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP28pass3() + { + var document = DocumentBuilder.Xml(@"""> +%eldecl; +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid PEReferences. Here the section(s) 4.1 [69] apply. This test is taken from + /// the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP69pass1() + { + var document = DocumentBuilder.Xml(@" +""> +%pe;%pe; +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests whether entities may be declared more than once, with the first declaration being + /// the binding one. There is an output test associated with this input file. Here the section(s) 4.2 apply + /// This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa086() + { + var document = DocumentBuilder.Xml(@" + +""> +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual(1, document.DocumentElement.ChildNodes.Length); + + var text = document.DocumentElement.ChildNodes[0]; + Assert.AreEqual(NodeType.Text, text.NodeType); + Assert.AreEqual(String.Empty, text.TextContent); + } + + /// + /// Test demonstrates a valid SDDecl within the prolog. There is an output test associated with this + /// input file. Here the section(s) 2.9 [32] apply. This test is taken from the collection James + /// Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa032() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// A document may be marked 'standalone' if any optional whitespace is defined within the internal + /// DTD subset. There is an output test associated with this input file. Here the section(s) 2.9 + /// [32] apply. This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidSa01() + { + var document = DocumentBuilder.Xml(@" + + + +]> + + + + The whitespace around this element would be + invalid as standalone were the DTD external. + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// A document may be marked 'standalone' if any attributes that need normalization are defined within + /// the internal DTD subset. There is an output test associated with this input file. Here the section(s) + /// 2.9 [32] apply. This test is taken from the collection Sun Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidSa02() + { + var document = DocumentBuilder.Xml(@" + + + + + + + + + + + + + + + + +]> + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests clauses 1, 3, and 4 of the Element Valid validity constraint. There is an output test associated + /// with this input file. Here the section(s) 3 apply. This test is taken from the collection Sun + /// Microsystems XML Tests. + /// + [TestMethod] + public void XmlValidElement() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + + + + + + + + + + + + + + allowed + ]]> + + also + ]]> + + moreover + + allowed & stuff + + also + + moreover + moreover + + too + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests element with EmptyElemTag and STag content Etag, also tests the VC: Element Valid + /// with elements that have children, Mixed and ANY contents There is an output test associated + /// with this input file. Here the section(s) 3 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 39. + /// + [TestMethod] + public void XmlIbmValidP39Ibm39v01() + { + var document = DocumentBuilder.Xml(@" + + + + + + + +]> + + + content of b element + + no more children + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests STag with possible combinations of its fields, also tests WFC: Unique Att Spec. + /// There is an output test associated with this input file. Here the section(s) 3.1 apply. + /// This test is taken from the collection IBM XML Conformance Test Suite - Production 40. + /// + [TestMethod] + public void XmlIbmValidP40Ibm40v01() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + without white space + with a white space + one attribute + one attribute + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests Attribute with Name Eq AttValue and VC: Attribute Value Type There is an output + /// test associated with this input file. Here the section(s) 3.1 apply. This test is taken + /// from the collection IBM XML Conformance Test Suite - Production 41. + /// + [TestMethod] + public void XmlIbmValidP41Ibm41v01() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + Name eq AttValue + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests ETag with possible combinations of its fields There is an output test associated + /// with this input file. Here the section(s) 3.1 apply. This test is taken from the collection + /// IBM XML Conformance Test Suite - Production 42. + /// + [TestMethod] + public void XmlIbmValidP42Ibm42v01() + { + var document = DocumentBuilder.Xml(@" + + + + +]> + + : End tag with a space inside + content of b element + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests content with all possible constructs: element, CharData, Reference, CDSect, Comment. + /// There is an output test associated with this input file. Here the section(s) 3.1 apply. This test + /// is taken from the collection IBM XML Conformance Test Suite - Production 43. + /// + [TestMethod] + public void XmlIbmValidP43Ibm43v01() + { + var document = DocumentBuilder.Xml(@" + + + + + General entity reference in element content
""> +]> + + + + + CharData: content of b element + %paaa; : PE reference should not be recognized in element content + + + + &inContent; + Charater reference: A + CDSect in content: markupsHEADnothing ]]> + + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests EmptyElemTag with possible combinations of its fields There is an output test + /// associated with this input file. Here the section(s) 3.1 apply. This test is taken from + /// the collection IBM XML Conformance Test Suite - Production 44. + /// + [TestMethod] + public void XmlIbmValidP44Ibm44v01() + { + var document = DocumentBuilder.Xml(@" + + + + + +]> + + without white space + with a white space + + + + + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that whitespace is permitted after the tag name in a Start-tag. There + /// is an output test associated with this input file. Here the section(s) 3.1 [40] apply. + /// This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa002() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid attribute specification within a Start-tag that contains whitespace + /// on both sides of the equal sign. There is an output test associated with this input file. Here + /// the section(s) 3.1 [40] apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa005() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that whitespace is valid after the Attribute in a Start-tag. There is an output + /// test associated with this input file. Here the section(s) 3.1 [40] apply. This test is taken from the + /// collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa010() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates mutliple Attibutes within the Start-tag. There is an output test + /// associated with this input file. Here the section(s) 3.1 [40] apply. This test is taken + /// from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa011() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that extra whitespace within an Attribute of a Start-tag is normalized to + /// a single space character. There is an output test associated with this input file. Here the + /// section(s) 3.1 [40] apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa104() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that extra whitespace within Start-tags and End-tags are nomalized into + /// single spaces. There is an output test associated with this input file. Here the section(s) + /// 3.1 [40] [42] apply. This test is taken from the collection James Clark XMLTEST cases, + /// 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa054() + { + var document = DocumentBuilder.Xml(@" +]> + + + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates a valid attribute specification within a Start-tag. There is an output test + /// associated with this input file. Here the section(s) 3.1 [41] apply. This test is taken from + /// the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa004() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that the AttValue within a Start-tag can use a single quote as a delimter. + /// There is an output test associated with this input file. Here the section(s) 3.1 [41] apply. + /// This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa006() + { + var document = DocumentBuilder.Xml(@" + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that whitespace is permitted after the tag name in an End-tag. There is an output + /// test associated with this input file. Here the section(s) 3.1 [42] apply. This test is taken from + /// the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa003() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that Entity References are valid element content. There is an output test associated + /// with this input file. Here the section(s) 3.1 [43] apply. This test is taken from the collection James + /// Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa023() + { + var document = DocumentBuilder.Xml(@" + +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that extra whitespace is normalized into single space character. There is an output test + /// associated with this input file. Here the section(s) 3.1 [43] apply. This test is taken from the collection + /// James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa047() + { + var document = DocumentBuilder.Xml(@" +]> +X +Y +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Empty-element tag must be used for element which are declared EMPTY. Here the section(s) 3.1 [43] [44] apply. + /// This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP28pass1() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates the correct syntax for an Empty element tag. There is an output test associated with this + /// input file. Here the section(s) 3.1 [44] apply. This test is taken from the collection James Clark XMLTEST + /// cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa034() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that whitespace is permissible after the name in an Empty element tag. There is an output + /// test associated with this input file. Here the section(s) 3.1 [44] apply. This test is taken from the + /// collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa035() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that the empty-element tag must be use for an elements that are declared EMPTY. + /// There is an output test associated with this input file. Here the section(s) 3.1 [44] apply. This + /// test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa044() + { + var document = DocumentBuilder.Xml(@" + + +]> + + + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates that Entity References are valid element content and also demonstrates a valid + /// Entity Declaration. There is an output test associated with this input file. Here the section(s) + /// 3.1 4.1 [43] [66] apply. This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa024() + { + var document = DocumentBuilder.Xml(@" + +""> +]> +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Test demonstrates numeric character references can be used for element content. There is + /// an output test associated with this input file. Here the section(s) 3.1 4.6 [43] apply. + /// This test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidSa007() + { + var document = DocumentBuilder.Xml(@" +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests both P45 elementDecl and P46 contentspec with possible combinations of their constructs. + /// There is an output test associated with this input file. Here the section(s) 3.2 apply. This + /// test is taken from the collection IBM XML Conformance Test Suite - Production 45. + /// + [TestMethod] + public void XmlIbmValidP45Ibm45v01() + { + var document = DocumentBuilder.Xml(@" + + + + + + + + + + +]> + + without white space + with a white space + + + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests all possible children,cp,choice,seq patterns in P47,P48,P49,P50 There is an output test + /// associated with this input file. Here the section(s) 3.2.1 apply. This test is taken from the + /// collection IBM XML Conformance Test Suite - Production 47. + /// + [TestMethod] + public void XmlIbmValidP47Ibm47v01() + { + var document = DocumentBuilder.Xml(@" + + + + + + + + + + + + + + + + + + +]> + + + content of b element + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Parser/XmlValidExtDtd.cs b/src/AngleSharp.Xml.Tests/Parser/XmlValidExtDtd.cs new file mode 100644 index 0000000..64d8416 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Parser/XmlValidExtDtd.cs @@ -0,0 +1,455 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using AngleSharp; + +namespace UnitTests +{ + [TestClass] + public class XmlValidExtDtd + { + [TestInitialize] + public void SetUp() + { + Configuration.RegisterHttpRequester(); + } + + [TestCleanup] + public void CleanUp() + { + Configuration.UnregisterHttpRequester(); + } + + /// + /// Tests EnitityValue referencing a Parameter Entity. There is an output test + /// associated with this input file. Here the section(s) 2.3 apply. This test + /// is taken from the collection IBM XML Conformance Test Suite - Production 9. + /// + [TestMethod] + public void XmlIbmValidP09Ibm09v03() + { + var document = DocumentBuilder.Xml(@" + +I am a new student with &Name; +"); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Testing PubidChar with all legal PubidChar in a PubidLiteral. There is an + /// output test associated with this input file. Here the section(s) 2.3 apply. + /// This test is taken from the collection IBM XML Conformance Test Suite - + /// Production 13. + /// + [TestMethod] + public void XmlIbmValidP13Ibm13v01() + { + var document = DocumentBuilder.Xml(@" + + + +My Name is SnowMan. + + + + + + + + + ", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests regular systemliteral using the double quotes. There is an output test + /// associated with this input file. Here the section(s) 2.3 apply. This test is + /// taken from the collection IBM XML Conformance Test Suite - Production 12. + /// + [TestMethod] + public void XmlIbmValidP12Ibm12v03() + { + var document = DocumentBuilder.Xml(@" + + + +My Name is SnowMan. +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// valid EntityValue's. Except for entity references, markup is not recognized. + /// Here the section(s) 2.3 [9] apply. This test is taken from the collection + /// OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP09pass1() + { + var document = DocumentBuilder.Xml(@" +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Constructs an <!ATTLIST...> declaration from several PEs. There is an output test + /// associated with this input file. Here the section(s) 2.8, 4.1 [69] apply. This test + /// is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidNotSa024() + { + var document = DocumentBuilder.Xml(@" + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.IsNotNull(document.DocumentElement); + Assert.IsNotNull(document.DocumentElement.Attributes["a1"]); + Assert.AreEqual("v1", document.DocumentElement.Attributes["a1"].Value); + } + + /// + /// Test demonstrates the use of a parameter entity reference within an attribute + /// list declaration. There is an output test associated with this input file. Here + /// the section(s) 2.3 4.1 [10] [69] apply. This test is taken from the collection + /// James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidNotSa023() + { + var document = DocumentBuilder.Xml(@" + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.IsNotNull(document.DocumentElement); + Assert.IsNotNull(document.DocumentElement.Attributes["a1"]); + Assert.AreEqual("v1", document.DocumentElement.Attributes["a1"].Value); + } + + /// + /// Tests doctypedecl with external subset and combinations of different markup declarations + /// and PEReferences. There is an output test associated with this input file. Here the section(s) + /// 2.8 apply. This test is taken from the collection IBM XML Conformance Test Suite - Production 28. + /// + [TestMethod] + public void XmlIbmValidP28Ibm28v02() + { + var document = DocumentBuilder.Xml(@" + + + + ""> + ""> + ""> + %make_leopard_element; + + %make_small; + ""> + %make_big; + %make_attlist; + + +]> + + &forcat; + This is a white tiger in Mirage!! + + + + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests extSubset with TextDecl and extSubsetDecl in the dtd file. There is an output test + /// associated with this input file. Here the section(s) 2.8 apply. This test is taken from + /// the collection IBM XML Conformance Test Suite - Production 30. + /// + [TestMethod] + public void XmlIbmValidP30Ibm30v02() + { + var document = DocumentBuilder.Xml(@" + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests EnitityValue with combination of GE, PE and text, the GE used is declared + /// in the student.dtd. There is an output test associated with this input file. + /// Here the section(s) 2.3 apply. This test is taken from the collection IBM XML + /// Conformance Test Suite - Production 9. + /// + [TestMethod] + public void XmlIbmValidP09Ibm09v05() + { + var fullname = "first , last , middle"; + var age = "21"; + var status = "freshman"; + + var combine = String.Format("This is a test of My Name is {0} and my age is {1} Again {0} {0} and my status is \n\t\t{2} {2} and {0} {1} {0} {2} That is all.", + fullname, age, status); + + var document = DocumentBuilder.Xml(@" + + + + +]> + + +This is a test of &combine; + + + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + Assert.AreEqual(combine, document.DocumentElement.TextContent); + } + + /// + /// Tests regular systemliteral using the single quotes. There is an output test + /// associated with this input file. Here the section(s) 2.3 apply. This test is + /// taken from the collection IBM XML Conformance Test Suite - Production 11. + /// + [TestMethod] + public void XmlIbmValidP11Ibm11v03() + { + var document = DocumentBuilder.Xml(@" + + +My Name is SnowMan. +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests regular systemliteral using the double quotes. There is an output test + /// associated with this input file. Here the section(s) 2.3 apply. This test is + /// taken from the collection IBM XML Conformance Test Suite - Production 11. + /// + [TestMethod] + public void XmlIbmValidP11Ibm11v04() + { + var document = DocumentBuilder.Xml(@" + + + +My Name is SnowMan. + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests empty systemliteral using the double quotes. There is an output test + /// associated with this input file. Here the section(s) 2.3 apply. This test is + /// taken from the collection IBM XML Conformance Test Suite - Production 12. + /// + [TestMethod] + public void XmlIbmValidP12Ibm12v01() + { + var document = DocumentBuilder.Xml(@" + + + +My Name is SnowMan. + + + + + + + + ", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests empty systemliteral using the single quotes. There is an output test + /// associated with this input file. Here the section(s) 2.3 apply. This test is + /// taken from the collection IBM XML Conformance Test Suite - Production 12. + /// + [TestMethod] + public void XmlIbmValidP12Ibm12v02() + { + var document = DocumentBuilder.Xml(@" + + + +My Name is SnowMan. +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Tests regular systemliteral using the single quotes. There is an output test + /// associated with this input file. Here the section(s) 2.3 apply. This test is + /// taken from the collection IBM XML Conformance Test Suite - Production 12. + /// + [TestMethod] + public void XmlIbmValidP12Ibm12v04() + { + var document = DocumentBuilder.Xml(@" + + + +My Name is SnowMan. +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Expands a general entity which contains a CDATA section with what looks like a + /// markup declaration (but is just text since it's in a CDATA section). There is an + /// output test associated with this input file. Here the section(s) 2.7 apply. This + /// test is taken from the collection James Clark XMLTEST cases, 18-Nov-1998. + /// + [TestMethod] + public void XmlValidNotSa031() + { + var document = DocumentBuilder.Xml(@" +&e; +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// external subset can be empty. Here the section(s) 2.8 [31] apply. This test is taken + /// from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP31pass1() + { + var document = DocumentBuilder.Xml(@"]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid doctypedecl with EXternalID as Enternal Entity. The external entity contains a parameter + /// entity reference and condtional sections. Here the section(s) 2.8 3.4 4.2.2 [31] [62] [63] [75] + /// apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP31pass2() + { + var document = DocumentBuilder.Xml(@" + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid doctypedecl with ExternalID as an External Entity. A parameter entity reference is also used. + /// Here the section(s) 2.8 4.1 [28] [69] apply. This test is taken from the collection OASIS/NIST + /// TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP28pass5() + { + var document = DocumentBuilder.Xml(@" +""> + +]> + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid doctypedecl with ExternalID as an External Entity declaration. Here the section(s) 2.8 4.2.2 + /// [28] [75] apply. This test is taken from the collection OASIS/NIST TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP28pass4() + { + var document = DocumentBuilder.Xml(@" + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid doctypedecl with ExternalID as an External Entity. The external entity has an element declaration. + /// Here the section(s) 2.8 4.2.2 [30] [75] apply. This test is taken from the collection OASIS/NIST TESTS, + /// 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP30pass1() + { + var document = DocumentBuilder.Xml(@" + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + + /// + /// Valid doctypedecl with ExternalID as an Enternal Entity. The external entity begins with a Text Declaration. + /// Here the section(s) 2.8 4.2.2 4.3.1 [30] [75] [77] apply. This test is taken from the collection OASIS/NIST + /// TESTS, 1-Nov-1998. + /// + [TestMethod] + public void XmlValidOP30pass2() + { + var document = DocumentBuilder.Xml(@" + +", new DocumentOptions(validating: true)); + + Assert.IsNotNull(document); + Assert.IsTrue(document.IsValid); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Properties/AssemblyInfo.cs b/src/AngleSharp.Xml.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..13d4a3a --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyCopyright("Copyright © AngleSharp, 2013-2019.")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] diff --git a/src/AngleSharp.Xml.Tests/TestExtensions.cs b/src/AngleSharp.Xml.Tests/TestExtensions.cs new file mode 100644 index 0000000..fa51549 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/TestExtensions.cs @@ -0,0 +1,24 @@ +namespace AngleSharp.Xml.Tests +{ + using AngleSharp.Dom; + using AngleSharp.Html.Parser; + using AngleSharp.Xml.Parser; + using System; + + static class TestExtensions + { + public static IDocument ToXmlDocument(this String sourceCode, IConfiguration configuration = null) + { + var context = BrowsingContext.New(configuration); + var xmlParser = context.GetService(); + return xmlParser.ParseDocument(sourceCode); + } + + public static IDocument ToHtmlDocument(this String sourceCode, IConfiguration configuration = null) + { + var context = BrowsingContext.New(configuration ?? Configuration.Default); + var htmlParser = context.GetService(); + return htmlParser.ParseDocument(sourceCode); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Tokenizer/XmlDTD.cs b/src/AngleSharp.Xml.Tests/Tokenizer/XmlDTD.cs new file mode 100644 index 0000000..18b1e11 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Tokenizer/XmlDTD.cs @@ -0,0 +1,216 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using AngleSharp; +using AngleSharp.Xml; +using AngleSharp.DTD; + +namespace UnitTests +{ + [TestClass] + public class XmlDTD + { + [TestMethod] + public void TVScheduleDtdSubset() + { + var dtd = @" + + + + + + + + + + + + + + + "; + var text = ""; + var s = new SourceManager(text); + + var t = new XmlTokenizer(s); + t.DTD.Reset(); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.DOCTYPE, e.Type); + var d = (XmlDoctypeToken)e; + Assert.IsFalse(d.IsNameMissing); + Assert.AreEqual("TVSCHEDULE", d.Name); + Assert.IsTrue(d.IsSystemIdentifierMissing); + Assert.AreEqual(15, t.DTD.Count); + + //Unfortunately C# counts newlines with 2 characters since \r\n is used + Assert.AreEqual(dtd.Replace("\r\n", "\n"), d.InternalSubset); + //This is annoying but meh - what can we do? W3C specifies we need to use + //\n for newlines and omit \r completely. + } + + [TestMethod] + public void TVScheduleDtdComplete() + { + var dtd = @" + + + + + + + + + + + + + + + + ]>"; + var s = new SourceManager(dtd); + + var t = new XmlTokenizer(s); + t.DTD.Reset(); + var e = t.Get(); + Assert.IsTrue(t.DTD[0] is ElementDeclaration); + + var f1 = (t.DTD[0] as ElementDeclaration); + Assert.AreEqual("TVSCHEDULE", f1.Name); + Assert.AreEqual(ElementContentType.Children, f1.Entry.Type); + Assert.IsTrue(f1.Entry is ElementChoiceDeclarationEntry); + + var g1 = (f1.Entry as ElementChoiceDeclarationEntry); + Assert.AreEqual(ElementQuantifier.One, g1.Quantifier); + Assert.AreEqual(1, g1.Choice.Count); + Assert.IsTrue(g1.Choice[0] is ElementNameDeclarationEntry); + + var h1 = (g1.Choice[0] as ElementNameDeclarationEntry); + Assert.AreEqual(ElementQuantifier.OneOrMore, h1.Quantifier); + Assert.AreEqual("CHANNEL", h1.Name); + + Assert.IsTrue(t.DTD[3] is ElementDeclaration); + + var f2 = (t.DTD[3] as ElementDeclaration); + Assert.AreEqual("DAY", f2.Name); + Assert.AreEqual(ElementContentType.Children, f2.Entry.Type); + Assert.IsTrue(f2.Entry is ElementSequenceDeclarationEntry); + + var g2 = (f2.Entry as ElementSequenceDeclarationEntry); + Assert.AreEqual(ElementQuantifier.One, g2.Quantifier); + Assert.AreEqual(2, g2.Sequence.Count); + Assert.AreEqual(ElementQuantifier.One, g2.Sequence[0].Quantifier); + Assert.AreEqual(ElementQuantifier.OneOrMore, g2.Sequence[1].Quantifier); + Assert.IsTrue(g2.Sequence[0] is ElementNameDeclarationEntry); + Assert.IsTrue(g2.Sequence[1] is ElementChoiceDeclarationEntry); + + var g3 = (g2.Sequence[0] as ElementNameDeclarationEntry); + var g4 = (g2.Sequence[1] as ElementChoiceDeclarationEntry); + Assert.AreEqual("DATE", g3.Name); + Assert.AreEqual(2, g4.Choice.Count); + Assert.IsTrue(g4.Choice[0] is ElementNameDeclarationEntry); + Assert.IsTrue(g4.Choice[1] is ElementNameDeclarationEntry); + + var g5 = (g4.Choice[0] as ElementNameDeclarationEntry); + var g6 = (g4.Choice[1] as ElementNameDeclarationEntry); + Assert.AreEqual("HOLIDAY", g5.Name); + Assert.AreEqual("PROGRAMSLOT", g6.Name); + Assert.AreEqual(ElementQuantifier.One, g5.Quantifier); + Assert.AreEqual(ElementQuantifier.OneOrMore, g6.Quantifier); + + Assert.IsTrue(t.DTD[10] is AttributeDeclaration); + var f7 = (t.DTD[10] as AttributeDeclaration); + Assert.AreEqual("TVSCHEDULE", f7.Name); + Assert.AreEqual(1, f7.Count); + Assert.AreEqual("NAME", f7[0].Name); + Assert.IsInstanceOfType(f7[0].Type, typeof(AttributeStringType)); + Assert.IsInstanceOfType(f7[0].Default, typeof( AttributeRequiredValue)); + } + + [TestMethod] + public void NewspaperDtdComplete() + { + var s = new SourceManager(@" + + + + + + + + + + + + + + + + + ]>"); + var t = new XmlTokenizer(s); + t.DTD.Reset(); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.DOCTYPE, e.Type); + var d = (XmlDoctypeToken)e; + Assert.IsFalse(d.IsNameMissing); + Assert.AreEqual("NEWSPAPER", d.Name); + Assert.IsTrue(d.IsSystemIdentifierMissing); + Assert.AreEqual(14, t.DTD.Count); + } + + [TestMethod] + public void ProductCatalogDtdComplete() + { + var s = new SourceManager(@" + + + + + + + + + + + + + + + + + + + + ]>"); + var t = new XmlTokenizer(s); + t.DTD.Reset(); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.DOCTYPE, e.Type); + var d = (XmlDoctypeToken)e; + Assert.IsFalse(d.IsNameMissing); + Assert.AreEqual("CATALOG", d.Name); + Assert.IsTrue(d.IsSystemIdentifierMissing); + Assert.AreEqual(13, t.DTD.Count); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Tokenizer/XmlTokenization.cs b/src/AngleSharp.Xml.Tests/Tokenizer/XmlTokenization.cs new file mode 100644 index 0000000..e2a76d3 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Tokenizer/XmlTokenization.cs @@ -0,0 +1,187 @@ +namespace AngleSharp.Core.Tests.Xml +{ + using AngleSharp.Core.Tests.Mocks; + using AngleSharp.Text; + using AngleSharp.Xml; + using AngleSharp.Xml.Parser; + using AngleSharp.Xml.Parser.Tokens; + using NUnit.Framework; + + [TestFixture] + public class XmlTokenization + { + private static XmlTokenizer CreateTokenizer(TextSource source) + { + return new XmlTokenizer(source, XmlEntityProvider.Resolver); + } + + [Test] + public void EmptyXmlDocumentTokenization() + { + var s = new TextSource(""); + var t = CreateTokenizer(s); + var e = t.Get(); + Assert.IsInstanceOf(e); + } + + [Test] + public void OneCommentInXmlDocument() + { + var c = "My comment"; + var s = new TextSource(""); + var t = CreateTokenizer(s); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.Comment, e.Type); + Assert.AreEqual(c, ((XmlCommentToken)e).Data); + } + + [Test] + public void ValidXmlDeclarationOnlyVersion() + { + var s = new TextSource(""); + var t = CreateTokenizer(s); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.Declaration, e.Type); + Assert.AreEqual("1.0", ((XmlDeclarationToken)e).Version); + } + + [Test] + public void ValidXmlDeclarationVersionAndEncoding() + { + var s = new TextSource(""); + var t = CreateTokenizer(s); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.Declaration, e.Type); + var x = (XmlDeclarationToken)e; + Assert.AreEqual("1.1", x.Version); + Assert.IsFalse(x.IsEncodingMissing); + Assert.AreEqual("utf-8", x.Encoding); + } + + [Test] + public void ValidXmlDeclarationEverything() + { + var s = new TextSource(""); + var t = CreateTokenizer(s); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.Declaration, e.Type); + var x = (XmlDeclarationToken)e; + Assert.AreEqual("1.0", x.Version); + Assert.IsFalse(x.IsEncodingMissing); + Assert.AreEqual("ISO-8859-1", x.Encoding); + Assert.AreEqual(true, x.Standalone); + } + + [Test] + public void OneDoctypeInXmlDocument() + { + var s = new TextSource(""); + var t = CreateTokenizer(s); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.Doctype, e.Type); + var d = (XmlDoctypeToken)e; + Assert.IsFalse(d.IsNameMissing); + Assert.AreEqual("root_element", d.Name); + Assert.IsFalse(d.IsSystemIdentifierMissing); + Assert.AreEqual("DTD_location", d.SystemIdentifier); + } + + [Test] + public void XmlTokenizerStringToken() + { + var s = new TextSource("teststring\r"); + var t = CreateTokenizer(s); + var e = t.Get(); + Assert.AreEqual(XmlTokenType.Character, e.Type); + var x = (XmlCharacterToken)e; + Assert.AreEqual("teststring\n", x.Data); + } + + [Test] + public void XmlTokenizerStringAndStandardEntityToken() + { + var s = new TextSource("test&string\r"); + var t = CreateTokenizer(s); + var test = t.Get(); + var end = t.Get(); + Assert.AreEqual(XmlTokenType.Character, test.Type); + Assert.AreEqual("test&string\n", ((XmlCharacterToken)test).Data); + Assert.AreEqual(XmlTokenType.EndOfFile, end.Type); + } + + [Test] + public void XmlTokenizerStringAndCustomEntityToken() + { + var resolver = new MockEntityProvider(str => str.Equals("bar;") ? "foo" : null); + var s = new TextSource("test&bar;"); + var t = new XmlTokenizer(s, resolver); + var test = t.Get(); + var end = t.Get(); + Assert.AreEqual(XmlTokenType.Character, test.Type); + Assert.AreEqual("testfoo", ((XmlCharacterToken)test).Data); + Assert.AreEqual(XmlTokenType.EndOfFile, end.Type); + } + + [Test] + public void XmlTokenizerNumericCharacterReferences() + { + var s = new TextSource("testab\r"); + var t = CreateTokenizer(s); + var test = t.Get(); + var end = t.Get(); + Assert.AreEqual(XmlTokenType.Character, test.Type); + Assert.AreEqual("testab\n", ((XmlCharacterToken)test).Data); + Assert.AreEqual(XmlTokenType.EndOfFile, end.Type); + } + + [Test] + public void XmlTokenizerStringAndTagToken() + { + var s = new TextSource("test"); + var t = CreateTokenizer(s); + var foo = t.Get(); + var test = t.Get(); + var bar = t.Get(); + var end = t.Get(); + + Assert.AreEqual(XmlTokenType.StartTag, foo.Type); + Assert.AreEqual(XmlTokenType.EndTag, bar.Type); + Assert.AreEqual("foo", ((XmlTagToken)foo).Name); + Assert.AreEqual("bar", ((XmlTagToken)bar).Name); + Assert.AreEqual("test", ((XmlCharacterToken)test).Data); + Assert.AreEqual(XmlTokenType.EndOfFile, end.Type); + } + + [Test] + public void XmlTokenizerSelfClosingTagWithAttribute() + { + var s = new TextSource(""); + var t = CreateTokenizer(s); + var foo = t.Get() as XmlTagToken; + + Assert.IsNotNull(foo); + Assert.AreEqual(XmlTokenType.StartTag, foo.Type); + Assert.IsTrue(foo.IsSelfClosing); + Assert.AreEqual("foo", foo.Name); + Assert.AreEqual(1, foo.Attributes.Count); + Assert.AreEqual("bar", foo.Attributes[0].Key); + Assert.AreEqual("quz", foo.Attributes[0].Value); + } + + [Test] + public void XmlTokenizerTagWithAttributeContainingEntity() + { + var s = new TextSource(""); + var t = CreateTokenizer(s); + var foo = t.Get() as XmlTagToken; + + Assert.IsNotNull(foo); + Assert.AreEqual(XmlTokenType.StartTag, foo.Type); + Assert.IsFalse(foo.IsSelfClosing); + Assert.AreEqual("foo", foo.Name); + Assert.AreEqual(1, foo.Attributes.Count); + Assert.AreEqual("bar", foo.Attributes[0].Key); + Assert.AreEqual("\"quz\"", foo.Attributes[0].Value); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Various.cs b/src/AngleSharp.Xml.Tests/Various.cs new file mode 100644 index 0000000..4af1df7 --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Various.cs @@ -0,0 +1,81 @@ +namespace AngleSharp.Xml.Tests +{ + using AngleSharp.Dom; + using AngleSharp.Io; + using AngleSharp.Svg.Dom; + using AngleSharp.Text; + using AngleSharp.Xml.Dom; + using AngleSharp.Xml.Parser; + using NUnit.Framework; + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + + [TestFixture] + public class VariousTests + { + private static readonly String XmlContent = @" +Tove +Jani +Reminder +Don't forget me this weekend! +"; + + private static readonly String SvgContent = @" + + +"; + + [Test] + public void ObtainElementPositionsFromXml() + { + var positions = new Dictionary(); + var source = @" + + + + +"; + var parser = new XmlParser(new XmlParserOptions + { + OnCreated = (element, position) => positions[element] = position + }); + parser.ParseDocument(source); + Assert.AreEqual(6, positions.Count); + } + + [Test] + public async Task GenerateDocumentFromXmlWithXmlContentType() + { + var document = await GenerateDocument(XmlContent, "text/xml"); + + Assert.IsInstanceOf(document); + Assert.AreEqual("note", document.DocumentElement.NodeName); + } + + [Test] + public async Task GenerateDocumentFromSvgWithSvgContentType() + { + var document = await GenerateDocument(SvgContent, "image/svg+xml"); + + Assert.IsInstanceOf(document); + Assert.AreEqual("svg", document.DocumentElement.NodeName); + Assert.AreEqual("path", document.DocumentElement.FirstElementChild.NodeName); + } + + private static Task GenerateDocument(String content, String contentType) + { + var config = Configuration.Default.WithDefaultLoader().WithXml(); + var context = BrowsingContext.New(config); + return context.OpenAsync(res => + { + res.Content(content); + + if (!String.IsNullOrEmpty(contentType)) + { + res.Header(HeaderNames.ContentType, contentType); + } + }); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Xhtml/AutoSelectMarkupFormatter.cs b/src/AngleSharp.Xml.Tests/Xhtml/AutoSelectMarkupFormatter.cs new file mode 100644 index 0000000..2bbfe5b --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Xhtml/AutoSelectMarkupFormatter.cs @@ -0,0 +1,135 @@ +namespace AngleSharp.Xml.Tests.Xhtml +{ + using AngleSharp.Dom; + using AngleSharp.Xhtml; + using NUnit.Framework; + using System.IO; + using System.Linq; + + [TestFixture] + public class AutoSelectMarkupFormatter + { + [Test] + public void TestMetaTags() + { + var swResult = new StringWriter(); + var document = (@" + + + test.html + + + + ... + + ").ToHtmlDocument(); + + document.ToHtml(swResult, new AutoSelectedMarkupFormatter(document.Doctype)); + + var result = swResult.ToString(); + var c = 0; + var i = -1; + + while ((i = result.IndexOf("/>", i + 1)) >= 0) + { + c++; + + if (i >= result.Length) + { + Assert.Fail("End of result xhtml reached but not found what we are looking for!"); + } + } + + Assert.AreEqual(2, c); + Assert.AreEqual(-1, result.IndexOf("meta>")); + } + + [Test] + public void TestImgTags() + { + var swResult = new StringWriter(); + var document = (@" + + + test.html + + +
Image label1
+ + +
Image label2
+ + + + ").ToHtmlDocument(); + + document.ToHtml(swResult, new AutoSelectedMarkupFormatter(document.Doctype)); + + var result = swResult.ToString(); + var c = 0; + var i = -1; + + while ((i = result.IndexOf("/>", i + 1)) >= 0) + { + c++; + + if (i >= result.Length) + { + Assert.Fail("End of result xhtml reached but not found what we are looking for!"); + } + } + + Assert.AreEqual(2, c); + Assert.AreEqual(-1, result.IndexOf("img>")); + } + + [Test] + public void TestSomeComment() + { + var swResult = new StringWriter(); + var source = @" + + + +"; + var document = source.ToHtmlDocument(); + document.ToHtml(swResult, new AutoSelectedMarkupFormatter(document.Doctype)); + Assert.IsNotNull(swResult.ToString()); + } + + [Test] + public void TestTrailingComment() + { + var swResult = new StringWriter(); + var source = @" + + + +"; + var document = source.ToHtmlDocument(); + document.ToHtml(swResult, new AutoSelectedMarkupFormatter(document.Doctype)); + Assert.IsNotNull(swResult.ToString()); + } + + [Test] + public void TestRemovingComment() + { + var swResult = new StringWriter(); + var source = @" + + + +"; + var document = source.ToHtmlDocument(); + var comments = document.Descendents().ToList(); + + foreach (var comment in comments) + { + comment.Remove(); + } + + document.ToHtml(swResult, new AutoSelectedMarkupFormatter(document.Doctype)); + Assert.IsNotNull(swResult.ToString()); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/Xhtml/PreserveValidXhtml.cs b/src/AngleSharp.Xml.Tests/Xhtml/PreserveValidXhtml.cs new file mode 100644 index 0000000..920b60a --- /dev/null +++ b/src/AngleSharp.Xml.Tests/Xhtml/PreserveValidXhtml.cs @@ -0,0 +1,84 @@ +namespace AngleSharp.Xml.Tests.Xhtml +{ + using AngleSharp.Xhtml; + using NUnit.Framework; + using System.IO; + + [TestFixture] + public class PreserveValidXhtml + { + [Test] + public void TestMetaTags() + { + var sw = new StringWriter(); + var document = (@" + + + test.html + + + + ... + + ").ToXmlDocument(); + + document.ToHtml(sw, XhtmlMarkupFormatter.Instance); + + var result = sw.ToString(); + var c = 0; + var i = -1; + + while ((i = result.IndexOf("/>", i + 1)) >= 0) + { + c++; + + if (i >= result.Length) + { + Assert.Fail("End of result xhtml reached but not found what we are looking for!"); + } + } + + Assert.AreEqual(2, c); + Assert.AreEqual(-1, result.IndexOf("meta>")); + } + + [Test] + public void TestImgTags() + { + var sw = new StringWriter(); + var document = (@" + + + test.html + + +
Image label1
+ + +
Image label2
+ + + + ").ToXmlDocument(); + + document.ToHtml(sw, XhtmlMarkupFormatter.Instance); + + var result = sw.ToString(); + var c = 0; + var i = -1; + + while ((i = result.IndexOf("/>", i + 1)) >= 0) + { + c++; + + if (i >= result.Length) + { + Assert.Fail("End of result xhtml reached but not found what we are looking for!"); + } + } + + Assert.AreEqual(2, c); + Assert.AreEqual(-1, result.IndexOf("img>")); + } + } +} diff --git a/src/AngleSharp.Xml.Tests/packages.config b/src/AngleSharp.Xml.Tests/packages.config new file mode 100644 index 0000000..c57838f --- /dev/null +++ b/src/AngleSharp.Xml.Tests/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/AngleSharp.Xml.nuspec b/src/AngleSharp.Xml.nuspec new file mode 100644 index 0000000..8537ec2 --- /dev/null +++ b/src/AngleSharp.Xml.nuspec @@ -0,0 +1,20 @@ + + + + AngleSharp.Io + $version$ + AngleSharp + Florian Rappl + https://github.com/AngleSharp/AngleSharp.Xml/blob/master/LICENSE + https://anglesharp.github.io + https://raw.github.com/AngleSharp/AngleSharp.Xml/master/logo.png + false + Adds a powerful XML and DTD parser to AngleSharp. + https://github.com/AngleSharp/AngleSharp.Xml/blob/master/CHANGELOG.md + Copyright 2016-2019, AngleSharp + html html5 css css3 dom requester http https xml dtd + + + + + diff --git a/src/AngleSharp.Xml.sln b/src/AngleSharp.Xml.sln new file mode 100644 index 0000000..b28659f --- /dev/null +++ b/src/AngleSharp.Xml.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharp.Xml", "AngleSharp.Xml\AngleSharp.Xml.csproj", "{5B570639-7B4A-4A66-B283-9481F6A481ED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AngleSharp.Xml.Tests", "AngleSharp.Xml.Tests\AngleSharp.Xml.Tests.csproj", "{18B0B97B-8795-4DC2-A1E7-8070255BE718}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B570639-7B4A-4A66-B283-9481F6A481ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B570639-7B4A-4A66-B283-9481F6A481ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B570639-7B4A-4A66-B283-9481F6A481ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B570639-7B4A-4A66-B283-9481F6A481ED}.Release|Any CPU.Build.0 = Release|Any CPU + {18B0B97B-8795-4DC2-A1E7-8070255BE718}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18B0B97B-8795-4DC2-A1E7-8070255BE718}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18B0B97B-8795-4DC2-A1E7-8070255BE718}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18B0B97B-8795-4DC2-A1E7-8070255BE718}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/AngleSharp.Xml/AngleSharp.Xml.csproj b/src/AngleSharp.Xml/AngleSharp.Xml.csproj new file mode 100644 index 0000000..a4aeb75 --- /dev/null +++ b/src/AngleSharp.Xml/AngleSharp.Xml.csproj @@ -0,0 +1,19 @@ + + + AngleSharp.Xml + AngleSharp.Xml + netstandard2.0 + true + Key.snk + true + + + + + + + + + false + + \ No newline at end of file diff --git a/src/AngleSharp.Xml/AutoSelectedMarkupFormatter.cs b/src/AngleSharp.Xml/AutoSelectedMarkupFormatter.cs new file mode 100644 index 0000000..df73c8b --- /dev/null +++ b/src/AngleSharp.Xml/AutoSelectedMarkupFormatter.cs @@ -0,0 +1,165 @@ +namespace AngleSharp.Xml +{ + using AngleSharp.Dom; + using AngleSharp.Html; + using AngleSharp.Xhtml; + using System; + + /// + /// AutoSelectedMarkupFormatter class to select the proper MarkupFormatter + /// implementation depending on the used document type. + /// + public sealed class AutoSelectedMarkupFormatter : IMarkupFormatter + { + #region Fields + + private IMarkupFormatter childFormatter = null; + private IDocumentType _docType; + + #endregion + + #region ctor + + /// + /// Creates a new instance of the auto selected markup formatter. + /// + /// + /// Optional DocumentType to hint the implementation to use. + /// + public AutoSelectedMarkupFormatter(IDocumentType docType = null) + { + _docType = docType; + } + + #endregion + + #region Properties + + private IMarkupFormatter ChildFormatter + { + get + { + if (childFormatter == null && _docType != null) + { + if (_docType.PublicIdentifier.Contains("XML")) + { + childFormatter = XmlMarkupFormatter.Instance; + } + else if (_docType.PublicIdentifier.Contains("XHTML")) + { + childFormatter = XhtmlMarkupFormatter.Instance; + } + } + + return childFormatter ?? HtmlMarkupFormatter.Instance; + } + set + { + childFormatter = value; + } + } + + #endregion + + #region Methods + + /// + /// Formats an attribute specified by the argument. + /// + /// The attribute to serialize. + /// The formatted attribute. + public String Attribute(IAttr attribute) + { + return ChildFormatter.Attribute(attribute); + } + + /// + /// Formats opening a tag with the given name. + /// + /// The element to open. + /// + /// Is the element actually self-closing? + /// + /// The formatted opening tag. + public String OpenTag(IElement element, Boolean selfClosing) + { + Confirm(element.Owner.Doctype); + return ChildFormatter.OpenTag(element, selfClosing); + } + + /// + /// Formats closing a tag with the given name. + /// + /// The element to close. + /// + /// Is the element actually self-closing? + /// + /// The formatted closing tag. + public String CloseTag(IElement element, Boolean selfClosing) + { + Confirm(element.Owner.Doctype); + return ChildFormatter.CloseTag(element, selfClosing); + } + + /// + /// Formats the given comment. + /// + /// The comment to stringify. + /// The formatted comment. + public String Comment(IComment comment) + { + Confirm(comment.Owner.Doctype); + return ChildFormatter.Comment(comment); + } + + /// + /// Formats the given doctype using the name, public and system + /// identifiers. + /// + /// The document type to stringify. + /// The formatted doctype. + public String Doctype(IDocumentType doctype) + { + Confirm(doctype); + return ChildFormatter.Doctype(doctype); + } + + /// + /// Formats the given processing instruction using the target and the + /// data. + /// + /// + /// The processing instruction to stringify. + /// + /// The formatted processing instruction. + public String Processing(IProcessingInstruction processing) + { + Confirm(processing.Owner.Doctype); + return ChildFormatter.Processing(processing); + } + + /// + /// Formats the given text. + /// + /// The text to sanatize. + /// The formatted text. + public String Text(ICharacterData text) + { + return ChildFormatter.Text(text); + } + + #endregion + + #region Helpers + + private void Confirm(IDocumentType docType) + { + if (_docType == null) + { + _docType = docType; + } + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Dom/Events/XmlParseEvent.cs b/src/AngleSharp.Xml/Dom/Events/XmlParseEvent.cs new file mode 100644 index 0000000..cc14ca0 --- /dev/null +++ b/src/AngleSharp.Xml/Dom/Events/XmlParseEvent.cs @@ -0,0 +1,32 @@ +namespace AngleSharp.Xml.Dom.Events +{ + using AngleSharp.Dom; + using AngleSharp.Dom.Events; + using System; + + /// + /// The event that is published in case of starting XML parsing. + /// + public class XmlParseEvent : Event + { + /// + /// Creates a new event for starting XML parsing. + /// + /// The document to be filled. + /// Determines if parsing is done. + public XmlParseEvent(IDocument document, Boolean completed) + : base(completed ? EventNames.Parsed : EventNames.Parsing) + { + Document = document; + } + + /// + /// Gets the document, which is to be filled. + /// + public IDocument Document + { + get; + private set; + } + } +} diff --git a/src/AngleSharp.Xml/Dom/ISvgDocument.cs b/src/AngleSharp.Xml/Dom/ISvgDocument.cs new file mode 100644 index 0000000..e9a3318 --- /dev/null +++ b/src/AngleSharp.Xml/Dom/ISvgDocument.cs @@ -0,0 +1,18 @@ +namespace AngleSharp.Svg.Dom +{ + using AngleSharp.Attributes; + using AngleSharp.Dom; + + /// + /// Serves as an entry point to the content of an SVG document. + /// + [DomName("SVGDocument")] + public interface ISvgDocument : IDocument + { + /// + /// Gets the root svg element in the document hierachy. + /// + [DomName("rootElement")] + ISvgSvgElement RootElement { get; } + } +} diff --git a/src/AngleSharp.Xml/Dom/IXmlDocument.cs b/src/AngleSharp.Xml/Dom/IXmlDocument.cs new file mode 100644 index 0000000..8505c93 --- /dev/null +++ b/src/AngleSharp.Xml/Dom/IXmlDocument.cs @@ -0,0 +1,13 @@ +namespace AngleSharp.Xml.Dom +{ + using AngleSharp.Attributes; + using AngleSharp.Dom; + + /// + /// The interface represent an XML document. + /// + [DomName("XMLDocument")] + public interface IXmlDocument : IDocument + { + } +} diff --git a/src/AngleSharp.Xml/Dom/Internal/SvgDocument.cs b/src/AngleSharp.Xml/Dom/Internal/SvgDocument.cs new file mode 100644 index 0000000..7b41d7c --- /dev/null +++ b/src/AngleSharp.Xml/Dom/Internal/SvgDocument.cs @@ -0,0 +1,94 @@ +namespace AngleSharp.Svg.Dom +{ + using AngleSharp.Dom; + using AngleSharp.Io; + using AngleSharp.Text; + using AngleSharp.Xml; + using System; + + /// + /// Represents a document node that contains only SVG nodes. + /// + sealed class SvgDocument : Document, ISvgDocument + { + #region Fields + + private readonly IElementFactory _factory; + + #endregion + + #region ctor + + internal SvgDocument(IBrowsingContext context, TextSource source) + : base(context ?? BrowsingContext.New(), source) + { + ContentType = MimeTypeNames.Svg; + _factory = Context.GetFactory>(); + } + + internal SvgDocument(IBrowsingContext context = null) + : this(context, new TextSource(String.Empty)) + { + } + + #endregion + + #region Properties + + public override IElement DocumentElement + { + get { return RootElement; } + } + + public ISvgSvgElement RootElement + { + get { return this.FindChild(); } + } + + public override IEntityProvider Entities + { + get { return Context.GetProvider() ?? XmlEntityProvider.Resolver; } + } + + #endregion + + #region Methods + + public override Element CreateElementFrom(String name, String prefix) + { + return _factory.Create(this, name, prefix) as Element; + } + + public override Node Clone(Document owner, Boolean deep) + { + var node = new SvgDocument(Context, new TextSource(Source.Text)); + CloneDocument(node, deep); + return node; + } + + #endregion + + #region Helpers + + protected override String GetTitle() + { + var title = RootElement.FindChild(); + return title?.TextContent.CollapseAndStrip() ?? base.GetTitle(); + } + + protected override void SetTitle(String value) + { + ISvgElement title = RootElement.FindChild(); + + if (title == null) + { + title = _factory.Create(this, TagNames.Title); + RootElement.AppendChild(title); + } + + title.TextContent = value; + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Dom/Internal/XmlDocument.cs b/src/AngleSharp.Xml/Dom/Internal/XmlDocument.cs new file mode 100644 index 0000000..e73e066 --- /dev/null +++ b/src/AngleSharp.Xml/Dom/Internal/XmlDocument.cs @@ -0,0 +1,66 @@ +namespace AngleSharp.Xml.Dom +{ + using AngleSharp.Dom; + using AngleSharp.Io; + using AngleSharp.Text; + using System; + + /// + /// Represents a document node that contains only XML nodes. + /// + sealed class XmlDocument : Document, IXmlDocument + { + #region ctor + + internal XmlDocument(IBrowsingContext context, TextSource source) + : base(context ?? BrowsingContext.New(), source) + { + ContentType = MimeTypeNames.Xml; + } + + internal XmlDocument(IBrowsingContext context = null) + : this(context, new TextSource(String.Empty)) + { + } + + #endregion + + #region Properties + + public override IElement DocumentElement + { + get { return this.FindChild(); } + } + + public override IEntityProvider Entities + { + get { return Context.GetProvider() ?? XmlEntityProvider.Resolver; } + } + + #endregion + + #region Methods + + public override Element CreateElementFrom(String name, String prefix) + { + return new XmlElement(this, name, prefix); + } + + public override Node Clone(Document owner, Boolean deep) + { + var node = new XmlDocument(Context, new TextSource(Source.Text)); + CloneDocument(node, deep); + return node; + } + + #endregion + + #region Helpers + + protected override void SetTitle(String value) + { + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Dom/Internal/XmlElement.cs b/src/AngleSharp.Xml/Dom/Internal/XmlElement.cs new file mode 100644 index 0000000..a2dee42 --- /dev/null +++ b/src/AngleSharp.Xml/Dom/Internal/XmlElement.cs @@ -0,0 +1,42 @@ +namespace AngleSharp.Xml.Dom +{ + using AngleSharp.Dom; + using System; + + /// + /// The object representation of an XMLElement. + /// + sealed class XmlElement : Element + { + #region ctor + + public XmlElement(Document owner, String name, String prefix = null) + : base(owner, name, prefix, null) + { + } + + #endregion + + #region Properties + + internal String IdAttribute + { + get; + set; + } + + #endregion + + #region Methods + + public override Node Clone(Document owner, Boolean deep) + { + var node = new XmlElement(owner, LocalName, Prefix); + CloneElement(node, owner, deep); + node.IdAttribute = IdAttribute; + return node; + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/DomImplementationExtension.cs b/src/AngleSharp.Xml/DomImplementationExtension.cs new file mode 100644 index 0000000..ec290d8 --- /dev/null +++ b/src/AngleSharp.Xml/DomImplementationExtension.cs @@ -0,0 +1,54 @@ +namespace AngleSharp.Xml +{ + using AngleSharp.Attributes; + using AngleSharp.Dom; + using AngleSharp.Xml.Dom; + using System; + + /// + /// Extensions for the DomImplementation interface. + /// + [DomExposed("DOMImplementation")] + public static class DomImplementationExtension + { + /// + /// Creates and returns an XMLDocument. + /// + /// + /// The namespace URI of the document to be created, or null if the + /// document doesn't belong to one. + /// + /// + /// The qualified name, that is an optional prefix and colon plus the + /// local root element name, of the document to be created. + /// + /// + /// DocumentType of the document to be created. It defaults to null. + /// + /// A new document. + [DomName("createDocument")] + public static IXmlDocument CreateDocument(this IImplementation impl, String namespaceUri = null, String qualifiedName = null, IDocumentType doctype = null) + { + var document = new XmlDocument(); + + if (doctype != null) + { + document.AppendChild(doctype); + } + + if (!String.IsNullOrEmpty(qualifiedName)) + { + var element = document.CreateElement(namespaceUri, qualifiedName); + + if (element != null) + { + document.AppendChild(element); + } + } + + + document.BaseUrl = _owner.BaseUrl; + return document; + } + } +} diff --git a/src/AngleSharp.Xml/Key.snk b/src/AngleSharp.Xml/Key.snk new file mode 100644 index 0000000..d43ce41 Binary files /dev/null and b/src/AngleSharp.Xml/Key.snk differ diff --git a/src/AngleSharp.Xml/Parser/IXmlParser.cs b/src/AngleSharp.Xml/Parser/IXmlParser.cs new file mode 100644 index 0000000..de53e44 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/IXmlParser.cs @@ -0,0 +1,41 @@ +namespace AngleSharp.Xml.Parser +{ + using AngleSharp.Browser; + using AngleSharp.Dom; + using AngleSharp.Xml.Dom; + using System; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Represents the interface of an XML parser. + /// + public interface IXmlParser : IParser + { + /// + /// Parses the string and returns the result. + /// + IXmlDocument ParseDocument(String source); + + /// + /// Parses the stream and returns the result. + /// + IXmlDocument ParseDocument(Stream source); + + /// + /// Parses the string asynchronously with option to cancel. + /// + Task ParseDocumentAsync(String source, CancellationToken cancel); + + /// + /// Parses the stream asynchronously with option to cancel. + /// + Task ParseDocumentAsync(Stream source, CancellationToken cancel); + + /// + /// Populates the given document asynchronously. + /// + Task ParseDocumentAsync(IDocument document, CancellationToken cancel); + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlCDataToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlCDataToken.cs new file mode 100644 index 0000000..560d24a --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlCDataToken.cs @@ -0,0 +1,47 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + using System; + + /// + /// The CData token that contains a sequence of raw characters. + /// + sealed class XmlCDataToken : XmlToken + { + #region Fields + + private readonly String _data; + + #endregion + + #region ctor + + /// + /// Creates a new CData token. + /// + public XmlCDataToken(TextPosition position) + : this(position, String.Empty) + { + } + + /// + /// Creates a new CData token with the supplied data. + /// + public XmlCDataToken(TextPosition position, String data) + : base(XmlTokenType.CData, position) + { + _data = data; + } + + #endregion + + #region Properties + + /// + /// Gets or sets the supplied data. + /// + public String Data => _data; + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlCharacterToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlCharacterToken.cs new file mode 100644 index 0000000..34cf0b1 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlCharacterToken.cs @@ -0,0 +1,52 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + using System; + + /// + /// The character token that contains a single character. + /// + sealed class XmlCharacterToken : XmlToken + { + #region Fields + + private readonly String _data; + + #endregion + + #region ctor + + /// + /// Creates a new character token. + /// + public XmlCharacterToken(TextPosition position) + : this(position, String.Empty) + { + } + + /// + /// Creates a new character token with the given character. + /// + public XmlCharacterToken(TextPosition position, String data) + : base(XmlTokenType.Character, position) + { + _data = data; + } + + #endregion + + #region Properties + + /// + /// Gets if the token only contains spaces. + /// + public override Boolean IsIgnorable => _data.StripLeadingTrailingSpaces().Length == 0; + + /// + /// Gets the data of the character token. + /// + public String Data => _data; + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlCommentToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlCommentToken.cs new file mode 100644 index 0000000..ec4b62f --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlCommentToken.cs @@ -0,0 +1,47 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + using System; + + /// + /// The token that is used for comments. + /// + sealed class XmlCommentToken : XmlToken + { + #region Fields + + private readonly String _data; + + #endregion + + #region ctor + + /// + /// Creates a new comment token. + /// + public XmlCommentToken(TextPosition position) + : this(position, String.Empty) + { + } + + /// + /// Creates a new comment token with the supplied data. + /// + public XmlCommentToken(TextPosition position, String data) + : base(XmlTokenType.Comment, position) + { + _data = data; + } + + #endregion + + #region Properties + + /// + /// Gets or sets the supplied data. + /// + public String Data => _data; + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlDeclarationToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlDeclarationToken.cs new file mode 100644 index 0000000..c414537 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlDeclarationToken.cs @@ -0,0 +1,70 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + using System; + + /// + /// Represents the XML declaration <?xml ...?> + /// + sealed class XmlDeclarationToken : XmlToken + { + #region Fields + + private String _version; + private String _encoding; + private Boolean _standalone; + + #endregion + + #region ctor + + /// + /// Creates a new XML declaration token. + /// + public XmlDeclarationToken(TextPosition position) + : base(XmlTokenType.Declaration, position) + { + _version = String.Empty; + _encoding = null; + _standalone = false; + } + + #endregion + + #region Properties + + /// + /// Gets if the encoding value has been set. + /// + public Boolean IsEncodingMissing => _encoding == null; + + /// + /// Gets or sets the version value. + /// + public String Version + { + get { return _version; } + set { _version = value; } + } + + /// + /// Gets or sets the encoding value. + /// + public String Encoding + { + get { return _encoding ?? String.Empty; } + set { _encoding = value; } + } + + /// + /// Gets or sets the standalone value. + /// + public Boolean Standalone + { + get { return _standalone; } + set { _standalone = value; } + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlDoctypeToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlDoctypeToken.cs new file mode 100644 index 0000000..d8fa9c8 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlDoctypeToken.cs @@ -0,0 +1,89 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + using System; + + /// + /// The DOCTYPE token. + /// + sealed class XmlDoctypeToken : XmlToken + { + #region Fields + + private String _name; + private String _publicIdentifier; + private String _systemIdentifier; + + #endregion + + #region ctor + + /// + /// Creates a new DOCTYPE token. + /// + public XmlDoctypeToken(TextPosition position) + : base(XmlTokenType.Doctype, position) + { + _name = null; + _publicIdentifier = null; + _systemIdentifier = null; + } + + #endregion + + #region Properties + + /// + /// Gets the state of the name. + /// + public Boolean IsNameMissing => _name == null; + + /// + /// Gets the state of the public identifier. + /// + public Boolean IsPublicIdentifierMissing => _publicIdentifier == null; + + /// + /// Gets the state of the system identifier. + /// + public Boolean IsSystemIdentifierMissing => _systemIdentifier == null; + + /// + /// Gets or sets the name of the DOCTYPE token. + /// + public String Name + { + get { return _name ?? String.Empty; } + set { _name = value; } + } + + /// + /// Gets or sets the value of the public identifier. + /// + public String PublicIdentifier + { + get { return _publicIdentifier ?? String.Empty; } + set { _publicIdentifier = value; } + } + + /// + /// Gets or sets the value of the system identifier. + /// + public String SystemIdentifier + { + get { return _systemIdentifier ?? String.Empty; } + set { _systemIdentifier = value; } + } + + /// + /// Gets or sets the internal subset. + /// + public String InternalSubset + { + get; + set; + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlEndOfFileToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlEndOfFileToken.cs new file mode 100644 index 0000000..4eab6af --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlEndOfFileToken.cs @@ -0,0 +1,18 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + + /// + /// Represents the final token to mark the EOF. + /// + sealed class XmlEndOfFileToken : XmlToken + { + /// + /// Creates a new EOF token. + /// + public XmlEndOfFileToken(TextPosition position) + : base(XmlTokenType.EndOfFile, position) + { + } + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlPIToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlPIToken.cs new file mode 100644 index 0000000..1aff3f4 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlPIToken.cs @@ -0,0 +1,54 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + using System; + + /// + /// The processing instruction token that defines a processing instruction. + /// + sealed class XmlPIToken : XmlToken + { + #region Fields + + private String _target; + private String _content; + + #endregion + + #region ctor + + /// + /// Creates a new processing instruction token. + /// + public XmlPIToken(TextPosition position) + : base(XmlTokenType.ProcessingInstruction, position) + { + _target = String.Empty; + _content = String.Empty; + } + + #endregion + + #region Properties + + /// + /// Gets or sets the target data. + /// + public String Target + { + get { return _target; } + set { _target = value; } + } + + /// + /// Gets or sets the content data. + /// + public String Content + { + get { return _content; } + set { _content = value; } + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlTagToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlTagToken.cs new file mode 100644 index 0000000..9315d46 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlTagToken.cs @@ -0,0 +1,113 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + using System; + using System.Collections.Generic; + + /// + /// Class for StartTagToken and EndTagToken. + /// + sealed class XmlTagToken : XmlToken + { + #region Fields + + private readonly List> _attributes; + private String _name; + private Boolean _selfClosing; + + #endregion + + #region ctor + + /// + /// Sets the default values. + /// + public XmlTagToken(XmlTokenType type, TextPosition position) + : base(type, position) + { + _name = String.Empty; + _attributes = new List>(); + } + + #endregion + + #region Properties + + /// + /// Gets or sets the state of the self-closing flag. + /// + public Boolean IsSelfClosing + { + get { return _selfClosing; } + set { _selfClosing = value; } + } + + /// + /// Gets or sets the name of the tag. + /// + public String Name + { + get { return _name; } + set { _name = value; } + } + + /// + /// Gets the list of attributes. + /// + public List> Attributes => _attributes; + + #endregion + + #region Methods + + /// + /// Adds a new attribute to the list of attributes. The value will + /// be set to an empty string. + /// + /// The name of the attribute. + public void AddAttribute(String name) + { + _attributes.Add(new KeyValuePair(name, String.Empty)); + } + + /// + /// Adds a new attribute to the list of attributes. + /// + /// The name of the attribute. + /// The value of the attribute. + public void AddAttribute(String name, String value) + { + _attributes.Add(new KeyValuePair(name, value)); + } + + /// + /// Sets the value of the last added attribute. + /// + /// The value to set. + public void SetAttributeValue(String value) + { + _attributes[_attributes.Count - 1] = new KeyValuePair(_attributes[_attributes.Count - 1].Key, value); + } + + /// + /// Gets the value of the attribute with the given name or an empty + /// string if the attribute is not available. + /// + /// The name of the attribute. + /// The value of the attribute. + public String GetAttribute(String name) + { + for (var i = 0; i != _attributes.Count; i++) + { + if (_attributes[i].Key.Is(name)) + { + return _attributes[i].Value; + } + } + + return String.Empty; + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/Tokens/XmlToken.cs b/src/AngleSharp.Xml/Parser/Tokens/XmlToken.cs new file mode 100644 index 0000000..7c0df1a --- /dev/null +++ b/src/AngleSharp.Xml/Parser/Tokens/XmlToken.cs @@ -0,0 +1,47 @@ +namespace AngleSharp.Xml.Parser.Tokens +{ + using AngleSharp.Text; + using System; + + /// + /// The abstract base class of any XML token. + /// + abstract class XmlToken + { + #region Fields + + private readonly XmlTokenType _type; + private readonly TextPosition _position; + + #endregion + + #region ctor + + public XmlToken(XmlTokenType type, TextPosition position) + { + _type = type; + _position = position; + } + + #endregion + + #region Properties + + /// + /// Gets if the token can be ignored. + /// + public virtual Boolean IsIgnorable => false; + + /// + /// Gets the type of the token. + /// + public XmlTokenType Type => _type; + + /// + /// Gets the position of the token. + /// + public TextPosition Position => _position; + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlDomBuilder.cs b/src/AngleSharp.Xml/Parser/XmlDomBuilder.cs new file mode 100644 index 0000000..4677226 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlDomBuilder.cs @@ -0,0 +1,457 @@ +namespace AngleSharp.Xml.Parser +{ + using AngleSharp.Dom; + using AngleSharp.Text; + using AngleSharp.Xml.Dom; + using AngleSharp.Xml.Parser.Tokens; + using System; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Represents the Tree construction as specified in the official W3C + /// specification for XML: + /// http://www.w3.org/TR/REC-xml/ + /// + sealed class XmlDomBuilder + { + #region Fields + + private readonly XmlTokenizer _tokenizer; + private readonly Document _document; + private readonly List _openElements; + + private XmlParserOptions _options; + private XmlTreeMode _currentMode; + private Boolean _standalone; + + #endregion + + #region ctor + + /// + /// Creates a new instance of the XML parser. + /// + /// The document instance to be filled. + internal XmlDomBuilder(Document document) + { + _tokenizer = new XmlTokenizer(document.Source, document.Entities); + _document = document; + _standalone = false; + _openElements = new List(); + _currentMode = XmlTreeMode.Initial; + } + + #endregion + + #region Properties + + /// + /// Gets if the document was detected to be standalone. + /// + public Boolean IsStandalone => _standalone; + + /// + /// Gets the current node. + /// + public Node CurrentNode + { + get + { + if (_openElements.Count > 0) + { + return _openElements[_openElements.Count - 1]; + } + + return _document; + } + } + + #endregion + + #region Methods + + /// + /// Parses the given source asynchronously and creates the document. + /// + /// The options to use for parsing. + /// The cancellation token to use. + public async Task ParseAsync(XmlParserOptions options, CancellationToken cancelToken) + { + var source = _document.Source; + var token = default(XmlToken); + _options = options; + _tokenizer.IsSuppressingErrors = options.IsSuppressingErrors; + + do + { + if (source.Length - source.Index < 1024) + { + await source.PrefetchAsync(8192, cancelToken).ConfigureAwait(false); + } + + token = _tokenizer.Get(); + Consume(token); + } + while (token.Type != XmlTokenType.EndOfFile); + + return _document; + } + + /// + /// Parses the given source and creates the document. + /// + /// The options to use for parsing. + public Document Parse(XmlParserOptions options) + { + var token = default(XmlToken); + _options = options; + _tokenizer.IsSuppressingErrors = options.IsSuppressingErrors; + + do + { + token = _tokenizer.Get(); + Consume(token); + } + while (token.Type != XmlTokenType.EndOfFile); + + return _document; + } + + #endregion + + #region States + + /// + /// Consumes a token and processes it. + /// + /// The token to consume. + private void Consume(XmlToken token) + { + switch (_currentMode) + { + case XmlTreeMode.Initial: + Initial(token); + break; + case XmlTreeMode.Prolog: + BeforeDoctype(token); + break; + case XmlTreeMode.Misc: + InMisc(token); + break; + case XmlTreeMode.Body: + InBody(token); + break; + case XmlTreeMode.After: + AfterBody(token); + break; + } + } + + /// + /// The initial state. Expects an XML declaration. + /// + /// The consumed token. + private void Initial(XmlToken token) + { + if (token.Type == XmlTokenType.Declaration) + { + var declarationToken = (XmlDeclarationToken)token; + _standalone = declarationToken.Standalone; + + if (!declarationToken.IsEncodingMissing) + { + SetEncoding(declarationToken.Encoding); + } + + if (!CheckVersion(declarationToken.Version) && !_options.IsSuppressingErrors) + { + throw XmlParseError.XmlDeclarationVersionUnsupported.At(token.Position); + } + } + else + { + _currentMode = XmlTreeMode.Prolog; + BeforeDoctype(token); + } + } + + /// + /// Before any doctype - still in the prolog. No declaration + /// allowed. + /// + /// The consumed token. + private void BeforeDoctype(XmlToken token) + { + switch (token.Type) + { + case XmlTokenType.Doctype: + { + var doctypeToken = (XmlDoctypeToken)token; + var doctypeNode = _document.Implementation.CreateDocumentType(doctypeToken.Name, doctypeToken.PublicIdentifier, doctypeToken.SystemIdentifier); + _document.AppendChild(doctypeNode); + _currentMode = XmlTreeMode.Misc; + + break; + } + default: + { + InMisc(token); + break; + } + } + } + + /// + /// In the body state - no doctypes and declarations allowed. + /// + /// The consumed token. + private void InMisc(XmlToken token) + { + switch (token.Type) + { + case XmlTokenType.Comment: + { + var commenToken = (XmlCommentToken)token; + var commentNode = _document.CreateComment(commenToken.Data); + CurrentNode.AppendChild(commentNode); + break; + } + case XmlTokenType.ProcessingInstruction: + { + var piToken = (XmlPIToken)token; + var piNode = _document.CreateProcessingInstruction(piToken.Target, piToken.Content); + CurrentNode.AppendChild(piNode); + break; + } + case XmlTokenType.StartTag: + { + _currentMode = XmlTreeMode.Body; + InBody(token); + break; + } + default: + { + if (!token.IsIgnorable && !_options.IsSuppressingErrors) + { + throw XmlParseError.XmlMissingRoot.At(token.Position); + } + + break; + } + } + } + + /// + /// In the body state - no doctypes and declarations allowed. + /// + /// The consumed token. + private void InBody(XmlToken token) + { + switch (token.Type) + { + case XmlTokenType.StartTag: + { + var tagToken = (XmlTagToken)token; + var element = CreateElement(tagToken.Name); + CurrentNode.AppendChild(element); + + for (var i = 0; i < tagToken.Attributes.Count; i++) + { + var attr = tagToken.Attributes[i]; + var item = CreateAttribute(attr.Key, attr.Value.Trim()); + element.AddAttribute(item); + } + + if (!tagToken.IsSelfClosing) + { + _openElements.Add(element); + } + else if (_openElements.Count == 0) + { + _currentMode = XmlTreeMode.After; + } + + if (_options.OnCreated != null) + { + _options.OnCreated.Invoke(element, tagToken.Position); + } + + break; + } + case XmlTokenType.EndTag: + { + var tagToken = (XmlTagToken)token; + + if (!CurrentNode.NodeName.Is(tagToken.Name)) + { + if (_options.IsSuppressingErrors) + { + break; + } + + throw XmlParseError.TagClosingMismatch.At(token.Position); + } + + _openElements.RemoveAt(_openElements.Count - 1); + + if (_openElements.Count == 0) + { + _currentMode = XmlTreeMode.After; + } + + break; + } + case XmlTokenType.ProcessingInstruction: + case XmlTokenType.Comment: + { + InMisc(token); + break; + } + case XmlTokenType.CData: + { + var cdataToken = (XmlCDataToken)token; + CurrentNode.AppendText(cdataToken.Data); + break; + } + case XmlTokenType.Character: + { + var charToken = (XmlCharacterToken)token; + CurrentNode.AppendText(charToken.Data); + break; + } + case XmlTokenType.EndOfFile: + { + if (_options.IsSuppressingErrors) + { + break; + } + + throw XmlParseError.EOF.At(token.Position); + } + case XmlTokenType.Doctype: + { + if (_options.IsSuppressingErrors) + { + break; + } + + throw XmlParseError.XmlDoctypeAfterContent.At(token.Position); + } + case XmlTokenType.Declaration: + { + if (_options.IsSuppressingErrors) + { + break; + } + + throw XmlParseError.XmlDeclarationMisplaced.At(token.Position); + } + } + } + + /// + /// After the body state - nothing except Comment PI S allowed. + /// + /// The consumed token. + private void AfterBody(XmlToken token) + { + switch (token.Type) + { + case XmlTokenType.ProcessingInstruction: + case XmlTokenType.Comment: + { + InMisc(token); + break; + } + case XmlTokenType.EndOfFile: + { + break; + } + default: + { + if (!token.IsIgnorable && !_options.IsSuppressingErrors) + { + throw XmlParseError.XmlMissingRoot.At(token.Position); + } + + break; + } + } + } + + #endregion + + #region Helpers + + private static Element CreateElement(Document document, String name, String prefix) + { + return new XmlElement(document, name, prefix); + } + + private Element CreateElement(String name) + { + var prefix = default(String); + var colon = name.IndexOf(Symbols.Colon); + + if (colon > 0 && colon < name.Length - 1) + { + prefix = name.Substring(0, colon); + name = name.Substring(colon + 1); + } + + return _document.CreateElementFrom(name, prefix); + } + + private Attr CreateAttribute(String name, String value) + { + var colon = name.IndexOf(Symbols.Colon); + + if (colon > 0 && colon < name.Length - 1) + { + var prefix = name.Substring(0, colon); + var ns = NamespaceNames.XmlNsUri; + + if (!prefix.Is(NamespaceNames.XmlNsPrefix)) + { + ns = CurrentNode.LookupNamespaceUri(prefix); + } + + return new Attr(prefix, name.Substring(colon + 1), value, ns); + } + + return new Attr(name, value); + } + + private static Boolean CheckVersion(String ver) + { + var t = ver.ToDouble(0.0); + return t >= 1.0 && t < 2.0; + } + + private void SetEncoding(String charSet) + { + if (TextEncoding.IsSupported(charSet)) + { + var encoding = TextEncoding.Resolve(charSet); + + if (encoding != null) + { + try + { + _document.Source.CurrentEncoding = encoding; + } + catch (NotSupportedException) + { + _currentMode = XmlTreeMode.Initial; + _document.Clear(); + _openElements.Clear(); + } + } + } + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlParseError.cs b/src/AngleSharp.Xml/Parser/XmlParseError.cs new file mode 100644 index 0000000..66d941b --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlParseError.cs @@ -0,0 +1,153 @@ +namespace AngleSharp.Xml.Parser +{ + /// + /// A collection of error codes. + /// + enum XmlParseError : ushort + { + /// + /// Unexpected end of file detected. + /// + EOF = 0x00, + /// + /// Undefined markup declaration found. + /// + UndefinedMarkupDeclaration = 0x1e, + /// + /// Character reference is an invalid number. + /// + CharacterReferenceInvalidNumber = 0x38, + /// + /// Character reference is an invalid code. + /// + CharacterReferenceInvalidCode = 0x39, + /// + /// Character reference is not terminated by a semicolon. + /// + CharacterReferenceNotTerminated = 0x3a, + /// + /// The given doctype tag is invalid. + /// + DoctypeInvalid = 0x45, + /// + /// The closing tag and the currently open tag do not match. + /// + TagClosingMismatch = 0x76, + /// + /// (0x200) Missing root element. + /// + XmlMissingRoot = 0x200, + /// + /// (0x201) Document type declaration after content. + /// + XmlDoctypeAfterContent = 0x201, + /// + /// (0x202) Invalid XML declaration. + /// + XmlDeclarationInvalid = 0x202, + /// + /// (0x203) XML declaration not at beginning of document. + /// + XmlDeclarationMisplaced = 0x203, + /// + /// (0x204) The given version number is not supported. + /// + XmlDeclarationVersionUnsupported = 0x204, + /// + /// (0x205) Invalid start-tag. + /// + XmlInvalidStartTag = 0x205, + /// + /// (0x206) Invalid end-tag. + /// + XmlInvalidEndTag = 0x206, + /// + /// (0x207) Well-formedness constraint: No < in Attribute Values. + /// + XmlLtInAttributeValue = 0x207, + /// + /// (0x208) Well-formedness constraint: Unique Att Spec. + /// + XmlUniqueAttribute = 0x208, + /// + /// (0x209) Invalid processing instruction. + /// + XmlInvalidPI = 0x209, + /// + /// (0x210) XML validation for the current document failed. + /// + XmlValidationFailed = 0x210, + /// + /// (0x211) XML invalid character data detected. + /// + XmlInvalidCharData = 0x211, + /// + /// (0x212) XML invalid name found. + /// + XmlInvalidName = 0x212, + /// + /// (0x213) XML invalid public identifier character. + /// + XmlInvalidPubId = 0x213, + /// + /// (0x214) XML invalid attribute seen. + /// + XmlInvalidAttribute = 0x214, + /// + /// (0x215) XML invalid comment detected. + /// + XmlInvalidComment = 0x215, + /// + /// (0x300) Invalid document type declaration. + /// + DtdInvalid = 0x300, + /// + /// (0x301) Invalid parameter entity reference. + /// + DtdPEReferenceInvalid = 0x301, + /// + /// (0x302) Invalid name in entity declaration. + /// + DtdNameInvalid = 0x302, + /// + /// (0x303) Declaration invalid. + /// + DtdDeclInvalid = 0x303, + /// + /// (0x304) Invalid element type declaration. + /// + DtdTypeInvalid = 0x304, + /// + /// (0x305) Invalid entity declaration. + /// + DtdEntityInvalid = 0x305, + /// + /// (0x306) Invalid element name in attribute-list declaration. + /// + DtdAttListInvalid = 0x306, + /// + /// (0x307) Invalid content specification in element type declaration. + /// + DtdTypeContent = 0x307, + /// + /// (0x308) An element type must not be declared more than once. + /// + DtdUniqueElementViolated = 0x308, + /// + /// (0x309) The DTD conditional section is invalid. + /// + DtdConditionInvalid = 0x309, + /// + /// (0x310) The given text declaration contains errors.s + /// + DtdTextDeclInvalid = 0x310, + /// + /// (0x311) The notation declaration is invalid. + /// + DtdNotationInvalid = 0x311, + /// + /// (0x312) No parameter reference recursion allowed. + /// + DtdPEReferenceRecursion = 0x312, + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlParseErrorExtensions.cs b/src/AngleSharp.Xml/Parser/XmlParseErrorExtensions.cs new file mode 100644 index 0000000..cd3e8f9 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlParseErrorExtensions.cs @@ -0,0 +1,33 @@ +namespace AngleSharp.Xml.Parser +{ + using AngleSharp.Text; + using System; + + /// + /// Extensions for the parse error enumeration. + /// + static class XmlParseErrorExtensions + { + /// + /// Creates the XmlParseException at the given position. + /// + /// The code for the exception. + /// The position of the error. + /// The new exception object. + public static XmlParseException At(this XmlParseError code, TextPosition position) + { + var message = "Error while parsing the provided XML document."; + return new XmlParseException(code.GetCode(), message, position); + } + + /// + /// Retrieves a number describing the error of a given error code. + /// + /// A specific error code. + /// The code of the error. + public static Int32 GetCode(this XmlParseError code) + { + return (Int32)code; + } + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlParseException.cs b/src/AngleSharp.Xml/Parser/XmlParseException.cs new file mode 100644 index 0000000..b12d0de --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlParseException.cs @@ -0,0 +1,51 @@ +namespace AngleSharp.Xml.Parser +{ + using AngleSharp.Text; + using System; + + /// + /// Exception that is thrown if an ill-formatted XML document is parsed. + /// + public class XmlParseException : Exception + { + #region ctor + + /// + /// Creates a new XmlParseException. + /// + /// The provided error code. + /// The associated error message. + /// The position in the source. + /// + public XmlParseException(Int32 code, String message, TextPosition position) + : base(message) + { + Code = code; + Position = position; + } + + #endregion + + #region Properties + + /// + /// Gets the position of the error. + /// + public TextPosition Position + { + get; + private set; + } + + /// + /// Gets the provided error code. + /// + public Int32 Code + { + get; + private set; + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlParser.cs b/src/AngleSharp.Xml/Parser/XmlParser.cs new file mode 100644 index 0000000..b977ef5 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlParser.cs @@ -0,0 +1,206 @@ +namespace AngleSharp.Xml.Parser +{ + using AngleSharp.Dom; + using AngleSharp.Text; + using AngleSharp.Xml.Dom; + using AngleSharp.Xml.Dom.Events; + using System; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Creates an instance of the XML parser front-end. + /// + public class XmlParser : EventTarget, IXmlParser + { + #region Fields + + private readonly XmlParserOptions _options; + private readonly IBrowsingContext _context; + + #endregion + + #region Events + + /// + /// Fired when the XML parser is starting. + /// + public event DomEventHandler Parsing + { + add { AddEventListener(EventNames.Parsing, value); } + remove { RemoveEventListener(EventNames.Parsing, value); } + } + + /// + /// Fired when the XML parser is finished. + /// + public event DomEventHandler Parsed + { + add { AddEventListener(EventNames.Parsed, value); } + remove { RemoveEventListener(EventNames.Parsed, value); } + } + + /// + /// Fired when a XML parse error is encountered. + /// + public event DomEventHandler Error + { + add { AddEventListener(EventNames.Error, value); } + remove { RemoveEventListener(EventNames.Error, value); } + } + + #endregion + + #region ctor + + /// + /// Creates a new parser with the default options and context. + /// + public XmlParser() + : this(default(IBrowsingContext)) + { + } + + /// + /// Creates a new parser with the custom options. + /// + /// The options to use. + public XmlParser(XmlParserOptions options) + : this(options, default(IBrowsingContext)) + { + } + + /// + /// Creates a new parser with the custom configuration. + /// + /// The context to use. + internal XmlParser(IBrowsingContext context) + : this(default(XmlParserOptions), context) + { + } + + /// + /// Creates a new parser with the custom options and the given context. + /// + /// The options to use. + /// The context to use. + public XmlParser(XmlParserOptions options, IBrowsingContext context) + { + _options = options; + _context = context ?? BrowsingContext.NewFrom(this); + } + + #endregion + + #region Properties + + /// + /// Gets the specified options. + /// + public XmlParserOptions Options => _options; + + /// + /// Gets the specified context. + /// + public IBrowsingContext Context => _context; + + #endregion + + #region Methods + + /// + /// Parses the string and returns the result. + /// + public IXmlDocument ParseDocument(String source) + { + var document = CreateDocument(source); + return Parse(document); + } + + /// + /// Parses the stream and returns the result. + /// + public IXmlDocument ParseDocument(Stream source) + { + var document = CreateDocument(source); + return Parse(document); + } + + /// + /// Parses the string asynchronously with option to cancel. + /// + public Task ParseDocumentAsync(String source, CancellationToken cancel) + { + var document = CreateDocument(source); + return ParseAsync(document, cancel); + } + + /// + /// Parses the stream asynchronously with option to cancel. + /// + public Task ParseDocumentAsync(Stream source, CancellationToken cancel) + { + var document = CreateDocument(source); + return ParseAsync(document, cancel); + } + + async Task IXmlParser.ParseDocumentAsync(IDocument document, CancellationToken cancel) + { + var parser = CreateBuilder((Document)document); + InvokeEventListener(new XmlParseEvent(document, completed: false)); + await parser.ParseAsync(_options, cancel).ConfigureAwait(false); + InvokeEventListener(new XmlParseEvent(document, completed: true)); + return document; + } + + #endregion + + #region Helpers + + private XmlDocument CreateDocument(String source) + { + var textSource = new TextSource(source); + return CreateDocument(textSource); + } + + private XmlDocument CreateDocument(Stream source) + { + var textSource = new TextSource(source, _context.GetDefaultEncoding()); + return CreateDocument(textSource); + } + + private XmlDocument CreateDocument(TextSource textSource) + { + var document = new XmlDocument(_context, textSource); + return document; + } + + private XmlDomBuilder CreateBuilder(Document document) + { + var parser = new XmlDomBuilder(document); + return parser; + } + + + private IXmlDocument Parse(XmlDocument document) + { + var parser = CreateBuilder(document); + InvokeEventListener(new XmlParseEvent(document, completed: false)); + parser.Parse(_options); + InvokeEventListener(new XmlParseEvent(document, completed: true)); + return document; + } + + private async Task ParseAsync(XmlDocument document, CancellationToken cancel) + { + var parser = CreateBuilder(document); + InvokeEventListener(new XmlParseEvent(document, completed: false)); + await parser.ParseAsync(_options, cancel).ConfigureAwait(false); + InvokeEventListener(new XmlParseEvent(document, completed: true)); + return document; + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlParserExtensions.cs b/src/AngleSharp.Xml/Parser/XmlParserExtensions.cs new file mode 100644 index 0000000..c0ba500 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlParserExtensions.cs @@ -0,0 +1,39 @@ +namespace AngleSharp.Xml.Parser +{ + using AngleSharp.Dom; + using AngleSharp.Xml.Dom; + using System; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extensions for the IXmlParser instances. + /// + public static class XmlParserExtensions + { + /// + /// Parses the string asynchronously. + /// + public static Task ParseDocumentAsync(this IXmlParser parser, String source) + { + return parser.ParseDocumentAsync(source, CancellationToken.None); + } + + /// + /// Parses the stream asynchronously. + /// + public static Task ParseDocumentAsync(this IXmlParser parser, Stream source) + { + return parser.ParseDocumentAsync(source, CancellationToken.None); + } + + /// + /// Populates the given document asynchronously. + /// + public static Task ParseDocumentAsync(this IXmlParser parser, IDocument document) + { + return parser.ParseDocumentAsync(document, CancellationToken.None); + } + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlParserOptions.cs b/src/AngleSharp.Xml/Parser/XmlParserOptions.cs new file mode 100644 index 0000000..56e485d --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlParserOptions.cs @@ -0,0 +1,31 @@ +namespace AngleSharp.Xml.Parser +{ + using AngleSharp.Dom; + using AngleSharp.Text; + using System; + + /// + /// Contains a number of options for the XML parser. + /// + public struct XmlParserOptions + { + /// + /// Gets or sets if errors should be surpressed. This way the document + /// will be parsed for sure, but may look weird. + /// + public Boolean IsSuppressingErrors + { + get; + set; + } + + /// + /// Gets or sets the callback once a new element was created. + /// + public Action OnCreated + { + get; + set; + } + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlTokenType.cs b/src/AngleSharp.Xml/Parser/XmlTokenType.cs new file mode 100644 index 0000000..985f429 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlTokenType.cs @@ -0,0 +1,49 @@ +namespace AngleSharp.Xml.Parser +{ + /// + /// An enumation of all possible tokens. + /// + enum XmlTokenType : byte + { + /// + /// The DOCTYPE token. + /// + Doctype, + /// + /// The XML declaration. + /// + Declaration, + /// + /// The start tag token to mark open tags. + /// + StartTag, + /// + /// The end tag token to mark ending tags. + /// + EndTag, + /// + /// The comment tag to mark comments. + /// + Comment, + /// + /// The CData token for such regions. + /// + CData, + /// + /// The character token to mark a single character. + /// + Character, + /// + /// A charref token to mark character references. + /// + CharacterReference, + /// + /// A processing instruction token to mark such elements. + /// + ProcessingInstruction, + /// + /// The End-Of-File token to mark the end. + /// + EndOfFile + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlTokenizer.cs b/src/AngleSharp.Xml/Parser/XmlTokenizer.cs new file mode 100644 index 0000000..ecbecc7 --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlTokenizer.cs @@ -0,0 +1,1294 @@ +namespace AngleSharp.Xml.Parser +{ + using AngleSharp.Common; + using AngleSharp.Dom; + using AngleSharp.Text; + using AngleSharp.Xml.Parser.Tokens; + using System; + + /// + /// Performs the tokenization of the source code. Most of + /// the information is taken from http://www.w3.org/TR/REC-xml/. + /// + sealed class XmlTokenizer : BaseTokenizer + { + #region Fields + + private readonly IEntityProvider _resolver; + private TextPosition _position; + + #endregion + + #region ctor + + /// + /// Creates a new tokenizer for XML documents. + /// + /// The source code manager. + /// The entity resolver to use. + public XmlTokenizer(TextSource source, IEntityProvider resolver) + : base(source) + { + _resolver = resolver; + } + + #endregion + + #region Properties + + /// + /// Gets or sets if some errors should be suppressed. + /// + public Boolean IsSuppressingErrors + { + get; + set; + } + + #endregion + + #region Methods + + /// + /// Gets the next available token. + /// + /// The next available token. + public XmlToken Get() + { + var current = GetNext(); + + if (current != Symbols.EndOfFile) + { + _position = GetCurrentPosition(); + return Data(current); + } + + return NewEof(); + } + + #endregion + + #region General + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-logical-struct. + /// + /// The next input character. + private XmlToken Data(Char c) + { + switch (c) + { + case Symbols.LessThan: + return TagOpen(); + + case Symbols.EndOfFile: + return NewEof(); + + default: + return DataText(c); + } + } + + private XmlToken DataText(Char c) + { + while (true) + { + switch (c) + { + case Symbols.LessThan: + case Symbols.EndOfFile: + Back(); + return NewCharacters(); + + case Symbols.Ampersand: + StringBuffer.Append(CharacterReference()); + c = GetNext(); + break; + + case Symbols.SquareBracketClose: + StringBuffer.Append(c); + c = CheckNextCharacter(); + break; + + default: + StringBuffer.Append(c); + c = GetNext(); + break; + } + } + } + + #endregion + + #region CDATA + + /// + /// Checks if the character sequence is equal to ]]>. + /// + /// The given character. + private Char CheckNextCharacter() + { + var c = GetNext(); + + if (c == Symbols.SquareBracketClose) + { + if (GetNext() == Symbols.GreaterThan) + throw XmlParseError.XmlInvalidCharData.At(GetCurrentPosition()); + + Back(); + } + + return c; + } + + /// + /// See http://www.w3.org/TR/REC-xml/#NT-CData. + /// + private XmlCDataToken CData() + { + var c = GetNext(); + + while (true) + { + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + if (c == Symbols.SquareBracketClose && ContinuesWithSensitive("]]>")) + { + Advance(2); + break; + } + + StringBuffer.Append(c); + c = GetNext(); + } + + return NewCharacterData(); + } + + /// + /// Called once an & character is being seen. + /// + /// The entity token. + private String CharacterReference() + { + var c = GetNext(); + var start = StringBuffer.Length; + var hex = false; + var numeric = c == Symbols.Num; + + if (numeric) + { + c = GetNext(); + hex = c == 'x' || c == 'X'; + + if (hex) + { + c = GetNext(); + + while (c.IsHex()) + { + StringBuffer.Append(c); + c = GetNext(); + } + } + else + { + while (c.IsDigit()) + { + StringBuffer.Append(c); + c = GetNext(); + } + } + } + else if (c.IsXmlNameStart()) + { + do + { + StringBuffer.Append(c); + c = GetNext(); + } + while (c.IsXmlName()); + } + + var length = StringBuffer.Length - start; + + if (c == Symbols.Semicolon && length > 0) + { + if (numeric) + { + var content = StringBuffer.ToString(start, length); + var number = hex ? content.FromHex() : content.FromDec(); + + if (number.IsValidAsCharRef()) + { + StringBuffer.Remove(start, length); + return Char.ConvertFromUtf32(number); + } + + StringBuffer.Append(c); + } + else + { + var content = StringBuffer.Append(c).ToString(start, ++length); + var entity = _resolver.GetSymbol(content); + + if (!String.IsNullOrEmpty(entity)) + { + StringBuffer.Remove(start, length); + return entity; + } + } + + if (!IsSuppressingErrors) + throw XmlParseError.CharacterReferenceInvalidCode.At(_position); + } + + if (!IsSuppressingErrors) + throw XmlParseError.CharacterReferenceNotTerminated.At(GetCurrentPosition()); + + StringBuffer.Insert(start, Symbols.Ampersand); + return String.Empty; + } + + #endregion + + #region Tags + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-starttags. + /// + private XmlToken TagOpen() + { + var c = GetNext(); + + if (c == Symbols.ExclamationMark) + { + return MarkupDeclaration(); + } + else if (c == Symbols.QuestionMark) + { + c = GetNext(); + + if (ContinuesWithSensitive(TagNames.Xml)) + { + Advance(2); + return DeclarationStart(); + } + + return ProcessingStart(c); + } + else if (c == Symbols.Solidus) + { + return TagEnd(); + } + else if (c.IsXmlNameStart()) + { + StringBuffer.Append(c); + return TagName(NewOpenTag()); + } + + throw XmlParseError.XmlInvalidStartTag.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#dt-etag. + /// + private XmlToken TagEnd() + { + var c = GetNext(); + + if (c.IsXmlNameStart()) + { + do + { + StringBuffer.Append(c); + c = GetNext(); + } + while (c.IsXmlName()); + + while (c.IsSpaceCharacter()) + { + c = GetNext(); + } + + if (c == Symbols.GreaterThan) + { + var tag = NewCloseTag(); + tag.Name = FlushBuffer(); + return tag; + } + } + + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + throw XmlParseError.XmlInvalidEndTag.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-Name. + /// + /// The current tag token. + /// The emitted token. + private XmlToken TagName(XmlTagToken tag) + { + var c = GetNext(); + + while (c.IsXmlName()) + { + StringBuffer.Append(c); + c = GetNext(); + } + + tag.Name = FlushBuffer(); + + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + if (c == Symbols.GreaterThan) + { + return tag; + } + else if (c.IsSpaceCharacter()) + { + return AttributeBeforeName(tag); + } + else if (c == Symbols.Solidus) + { + return TagSelfClosing(tag); + } + + throw XmlParseError.XmlInvalidName.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#d0e2480. + /// + /// The current tag token. + private XmlToken TagSelfClosing(XmlTagToken tag) + { + var c = GetNext(); + tag.IsSelfClosing = true; + + if (c == Symbols.GreaterThan) + { + return tag; + } + + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + throw XmlParseError.XmlInvalidName.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#dt-markup. + /// + private XmlToken MarkupDeclaration() + { + var pos = GetCurrentPosition(); + Advance(); + + if (ContinuesWithSensitive("--")) + { + Advance(); + return CommentStart(); + } + else if (ContinuesWithSensitive(TagNames.Doctype)) + { + Advance(6); + return Doctype(); + } + else if (ContinuesWithSensitive(Keywords.CData)) + { + Advance(6); + return CData(); + } + + throw XmlParseError.UndefinedMarkupDeclaration.At(pos); + } + + #endregion + + #region XML Declaration + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-XMLDecl. + /// + private XmlToken DeclarationStart() + { + var c = GetNext(); + + if (!c.IsSpaceCharacter()) + { + StringBuffer.Append(TagNames.Xml); + return ProcessingTarget(c, NewProcessing()); + } + + do c = GetNext(); + while (c.IsSpaceCharacter()); + + if (ContinuesWithSensitive(AttributeNames.Version)) + { + Advance(6); + return DeclarationVersionAfterName(NewDeclaration()); + } + + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-VersionInfo. + /// + /// The current declaration token. + private XmlToken DeclarationVersionAfterName(XmlDeclarationToken decl) + { + var c = SkipSpaces(); + + if (c != Symbols.Equality) + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + + return DeclarationVersionBeforeValue(decl); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-VersionInfo. + /// + /// The current declaration token. + private XmlToken DeclarationVersionBeforeValue(XmlDeclarationToken decl) + { + var c = SkipSpaces(); + + if (c != Symbols.DoubleQuote && c != Symbols.SingleQuote) + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + + return DeclarationVersionValue(decl, c); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-VersionInfo. + /// + /// The current declaration token. + /// The quote character. + private XmlToken DeclarationVersionValue(XmlDeclarationToken decl, Char quote) + { + var c = GetNext(); + + while (c != quote) + { + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + StringBuffer.Append(c); + c = GetNext(); + } + + decl.Version = FlushBuffer(); + c = GetNext(); + + if (c.IsSpaceCharacter()) + { + return DeclarationAfterVersion(decl); + } + + return DeclarationEnd(c, decl); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-VersionNum. + /// + /// The current declaration token. + private XmlToken DeclarationAfterVersion(XmlDeclarationToken decl) + { + var c = SkipSpaces(); + + if (ContinuesWithSensitive(AttributeNames.Encoding)) + { + Advance(7); + return DeclarationEncodingAfterName(decl); + } + else if (ContinuesWithSensitive(AttributeNames.Standalone)) + { + Advance(9); + return DeclarationStandaloneAfterName(decl); + } + + return DeclarationEnd(c, decl); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl. + /// + /// The current declaration token. + private XmlToken DeclarationEncodingAfterName(XmlDeclarationToken decl) + { + var c = SkipSpaces(); + + if (c != Symbols.Equality) + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + + return DeclarationEncodingBeforeValue(decl); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl. + /// + /// The current declaration token. + private XmlToken DeclarationEncodingBeforeValue(XmlDeclarationToken decl) + { + var c = SkipSpaces(); + + if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) + { + var q = c; + c = GetNext(); + + if (c.IsLetter()) + { + StringBuffer.Append(c); + return DeclarationEncodingValue(decl, q); + } + } + + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-EncodingDecl. + /// + /// The current declaration token. + /// The quote character. + private XmlToken DeclarationEncodingValue(XmlDeclarationToken decl, Char quote) + { + var c = GetNext(); + + while (c != quote) + { + if (!c.IsAlphanumericAscii() && c != Symbols.Dot && c != Symbols.Underscore && c != Symbols.Minus) + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + + StringBuffer.Append(c); + c = GetNext(); + } + + decl.Encoding = FlushBuffer(); + c = GetNext(); + + if (c.IsSpaceCharacter()) + { + return DeclarationAfterEncoding(decl); + } + + return DeclarationEnd(c, decl); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl. + /// + /// The current declaration token. + private XmlToken DeclarationAfterEncoding(XmlDeclarationToken decl) + { + var c = SkipSpaces(); + + if (ContinuesWithSensitive(AttributeNames.Standalone)) + { + Advance(9); + return DeclarationStandaloneAfterName(decl); + } + + return DeclarationEnd(c, decl); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl. + /// + /// The current declaration token. + private XmlToken DeclarationStandaloneAfterName(XmlDeclarationToken decl) + { + var c = SkipSpaces(); + + if (c != Symbols.Equality) + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + + return DeclarationStandaloneBeforeValue(decl); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl. + /// + /// The current declaration token. + private XmlToken DeclarationStandaloneBeforeValue(XmlDeclarationToken decl) + { + var c = SkipSpaces(); + + if (c != Symbols.DoubleQuote && c != Symbols.SingleQuote) + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + + return DeclarationStandaloneValue(decl, c); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-SDDecl. + /// + /// The current declaration token. + /// The quote character. + private XmlToken DeclarationStandaloneValue(XmlDeclarationToken decl, Char quote) + { + var c = GetNext(); + + while (c != quote) + { + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + StringBuffer.Append(c); + c = GetNext(); + } + + var s = FlushBuffer(); + + if (s.Is(Keywords.Yes)) + { + decl.Standalone = true; + } + else if (s.Is(Keywords.No)) + { + decl.Standalone = false; + } + else + { + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + } + + return DeclarationEnd(GetNext(), decl); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-XMLDecl. + /// + /// The next input character. + /// The current declaration token. + private XmlDeclarationToken DeclarationEnd(Char c, XmlDeclarationToken decl) + { + while (c.IsSpaceCharacter()) + { + c = GetNext(); + } + + if (c != Symbols.QuestionMark || GetNext() != Symbols.GreaterThan) + throw XmlParseError.XmlDeclarationInvalid.At(GetCurrentPosition()); + + return decl; + } + + #endregion + + #region Doctype + + /// + /// See 8.2.4.52 DOCTYPE state + /// + private XmlToken Doctype() + { + var c = GetNext(); + + if (c.IsSpaceCharacter()) + { + return DoctypeNameBefore(); + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + /// + /// See 8.2.4.53 Before DOCTYPE name state + /// + private XmlToken DoctypeNameBefore() + { + var c = SkipSpaces(); + + if (c.IsXmlNameStart()) + { + StringBuffer.Append(c); + return DoctypeName(NewDoctype()); + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + /// + /// See 8.2.4.54 DOCTYPE name state + /// + /// The current doctype token. + /// The emitted token. + private XmlToken DoctypeName(XmlDoctypeToken doctype) + { + var c = GetNext(); + + while (c.IsXmlName()) + { + StringBuffer.Append(c); + c = GetNext(); + } + + doctype.Name = FlushBuffer(); + + if (c == Symbols.GreaterThan) + { + return doctype; + } + else if (c.IsSpaceCharacter()) + { + return DoctypeNameAfter(doctype); + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + /// + /// See 8.2.4.55 After DOCTYPE name state + /// + /// The current doctype token. + /// The emitted token. + private XmlToken DoctypeNameAfter(XmlDoctypeToken doctype) + { + var c = SkipSpaces(); + + if (c == Symbols.GreaterThan) + { + return doctype; + } + else if (ContinuesWithSensitive(Keywords.Public)) + { + Advance(5); + return DoctypePublic(doctype); + } + else if (ContinuesWithSensitive(Keywords.System)) + { + Advance(5); + return DoctypeSystem(doctype); + } + else if (c == Symbols.SquareBracketOpen) + { + Advance(); + return DoctypeAfter(GetNext(), doctype); + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + /// + /// See 8.2.4.56 After DOCTYPE public keyword state + /// + /// The current doctype token. + /// The emitted token. + private XmlToken DoctypePublic(XmlDoctypeToken doctype) + { + var c = GetNext(); + + if (c.IsSpaceCharacter()) + { + c = SkipSpaces(); + + if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) + { + doctype.PublicIdentifier = String.Empty; + return DoctypePublicIdentifierValue(doctype, c); + } + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + /// + /// See 8.2.4.58 DOCTYPE public identifier (double-quoted) state + /// + /// The current doctype token. + /// The closing character. + /// The emitted token. + private XmlToken DoctypePublicIdentifierValue(XmlDoctypeToken doctype, Char quote) + { + var c = GetNext(); + + while (c != quote) + { + if (!c.IsPubidChar()) + throw XmlParseError.XmlInvalidPubId.At(GetCurrentPosition()); + + StringBuffer.Append(c); + c = GetNext(); + } + + doctype.PublicIdentifier = FlushBuffer(); + return DoctypePublicIdentifierAfter(doctype); + } + + /// + /// See 8.2.4.60 After DOCTYPE public identifier state + /// + /// The current doctype token. + /// The emitted token. + private XmlToken DoctypePublicIdentifierAfter(XmlDoctypeToken doctype) + { + var c = GetNext(); + + if (c == Symbols.GreaterThan) + { + return doctype; + } + else if (c.IsSpaceCharacter()) + { + return DoctypeBetween(doctype); + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + /// + /// See 8.2.4.61 Between DOCTYPE public and system identifiers state + /// + /// The current doctype token. + /// The emitted token. + private XmlToken DoctypeBetween(XmlDoctypeToken doctype) + { + var c = SkipSpaces(); + + if (c == Symbols.GreaterThan) + { + return doctype; + } + else if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) + { + doctype.SystemIdentifier = String.Empty; + return DoctypeSystemIdentifierValue(doctype, c); + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + /// + /// See 8.2.4.62 After DOCTYPE system keyword state + /// + /// The current doctype token. + /// The emitted token. + private XmlToken DoctypeSystem(XmlDoctypeToken doctype) + { + var c = GetNext(); + + if (c.IsSpaceCharacter()) + { + c = SkipSpaces(); + + if (c == Symbols.DoubleQuote || c == Symbols.SingleQuote) + { + doctype.SystemIdentifier = String.Empty; + return DoctypeSystemIdentifierValue(doctype, c); + } + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + /// + /// See 8.2.4.64 DOCTYPE system identifier (double-quoted) state + /// + /// The current doctype token. + /// The quote character. + /// The emitted token. + private XmlToken DoctypeSystemIdentifierValue(XmlDoctypeToken doctype, Char quote) + { + var c = GetNext(); + + while (c != quote) + { + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + StringBuffer.Append(c); + c = GetNext(); + } + + doctype.SystemIdentifier = FlushBuffer(); + return DoctypeSystemIdentifierAfter(doctype); + } + + /// + /// See 8.2.4.66 After DOCTYPE system identifier state + /// + /// The current doctype token. + /// The emitted token. + private XmlToken DoctypeSystemIdentifierAfter(XmlDoctypeToken doctype) + { + var c = SkipSpaces(); + + if (c == Symbols.SquareBracketOpen) + { + Advance(); + c = GetNext(); + } + + return DoctypeAfter(c, doctype); + } + + /// + /// The doctype finalizer. + /// + /// The next input character. + /// The current doctype token. + /// The emitted token. + private XmlToken DoctypeAfter(Char c, XmlDoctypeToken doctype) + { + while (c.IsSpaceCharacter()) + { + c = GetNext(); + } + + if (c == Symbols.GreaterThan) + { + return doctype; + } + + throw XmlParseError.DoctypeInvalid.At(GetCurrentPosition()); + } + + #endregion + + #region Attributes + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-Attribute. + /// + /// The current tag token. + private XmlToken AttributeBeforeName(XmlTagToken tag) + { + var c = SkipSpaces(); + + if (c == Symbols.Solidus) + { + return TagSelfClosing(tag); + } + else if (c == Symbols.GreaterThan) + { + return tag; + } + + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + if (c.IsXmlNameStart()) + { + StringBuffer.Append(c); + return AttributeName(tag); + } + + throw XmlParseError.XmlInvalidAttribute.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-Attribute. + /// + /// The current tag token. + private XmlToken AttributeName(XmlTagToken tag) + { + var c = GetNext(); + + while (c.IsXmlName()) + { + StringBuffer.Append(c); + c = GetNext(); + } + + var name = FlushBuffer(); + + if (!String.IsNullOrEmpty(tag.GetAttribute(name))) + throw XmlParseError.XmlUniqueAttribute.At(GetCurrentPosition()); + + tag.AddAttribute(name); + + if (c.IsSpaceCharacter()) + { + do c = GetNext(); + while (c.IsSpaceCharacter()); + } + + if (c != Symbols.Equality) + throw XmlParseError.XmlInvalidAttribute.At(GetCurrentPosition()); + + return AttributeBeforeValue(tag); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-Attribute. + /// + /// The current tag token. + private XmlToken AttributeBeforeValue(XmlTagToken tag) + { + var c = SkipSpaces(); + + if (c != Symbols.DoubleQuote && c != Symbols.SingleQuote) + throw XmlParseError.XmlInvalidAttribute.At(GetCurrentPosition()); + + return AttributeValue(tag, c); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-Attribute. + /// + /// The current tag token. + /// The quote character. + private XmlToken AttributeValue(XmlTagToken tag, Char quote) + { + var c = GetNext(); + + while (c != quote) + { + if (c == Symbols.EndOfFile) + throw XmlParseError.EOF.At(GetCurrentPosition()); + + if (c == Symbols.LessThan) + throw XmlParseError.XmlLtInAttributeValue.At(GetCurrentPosition()); + + if (c == Symbols.Ampersand) + { + StringBuffer.Append(CharacterReference()); + } + else + { + StringBuffer.Append(c); + } + + c = GetNext(); + } + + tag.SetAttributeValue(FlushBuffer()); + return AttributeAfterValue(tag); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#NT-Attribute. + /// + /// The current tag token. + private XmlToken AttributeAfterValue(XmlTagToken tag) + { + var c = GetNext(); + + if (c.IsSpaceCharacter()) + { + return AttributeBeforeName(tag); + } + else if (c == Symbols.Solidus) + { + return TagSelfClosing(tag); + } + else if (c == Symbols.GreaterThan) + { + return tag; + } + + throw XmlParseError.XmlInvalidAttribute.At(GetCurrentPosition()); + } + + #endregion + + #region Processing Instruction + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-pi. + /// + /// The next input character. + private XmlToken ProcessingStart(Char c) + { + if (c.IsXmlNameStart()) + { + StringBuffer.Append(c); + return ProcessingTarget(GetNext(), NewProcessing()); + } + + throw XmlParseError.XmlInvalidPI.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-pi. + /// + /// The next input character. + /// The processing instruction token. + private XmlToken ProcessingTarget(Char c, XmlPIToken pi) + { + while (c.IsXmlName()) + { + StringBuffer.Append(c); + c = GetNext(); + } + + pi.Target = FlushBuffer(); + + if (pi.Target.Isi(TagNames.Xml)) + throw XmlParseError.XmlInvalidPI.At(GetCurrentPosition()); + + if (c == Symbols.QuestionMark) + { + c = GetNext(); + + if (c == Symbols.GreaterThan) + { + return pi; + } + } + else if (c.IsSpaceCharacter()) + { + return ProcessingContent(pi); + } + + throw XmlParseError.XmlInvalidPI.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-pi. + /// + /// The processing instruction token. + private XmlToken ProcessingContent(XmlPIToken pi) + { + var c = GetNext(); + + while (c != Symbols.EndOfFile) + { + if (c == Symbols.QuestionMark) + { + c = GetNext(); + + if (c == Symbols.GreaterThan) + { + pi.Content = FlushBuffer(); + return pi; + } + + StringBuffer.Append(Symbols.QuestionMark); + } + else + { + StringBuffer.Append(c); + c = GetNext(); + } + } + + throw XmlParseError.EOF.At(GetCurrentPosition()); + } + + #endregion + + #region Comments + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-comments. + /// + private XmlToken CommentStart() + { + return Comment(GetNext()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-comments. + /// + /// The next input character. + private XmlToken Comment(Char c) + { + while (c.IsXmlChar()) + { + if (c == Symbols.Minus) + { + return CommentDash(); + } + + StringBuffer.Append(c); + c = GetNext(); + } + + throw XmlParseError.XmlInvalidComment.At(GetCurrentPosition()); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-comments. + /// + private XmlToken CommentDash() + { + var c = GetNext(); + + if (c == Symbols.Minus) + { + return CommentEnd(); + } + + return Comment(c); + } + + /// + /// More http://www.w3.org/TR/REC-xml/#sec-comments. + /// + private XmlToken CommentEnd() + { + var c = GetNext(); + + if (c == Symbols.GreaterThan) + { + return NewComment(); + } + + throw XmlParseError.XmlInvalidComment.At(GetCurrentPosition()); + } + + #endregion + + #region Tokens + + private XmlEndOfFileToken NewEof() + { + return new XmlEndOfFileToken(GetCurrentPosition()); + } + + private XmlCharacterToken NewCharacters() + { + var content = FlushBuffer(); + return new XmlCharacterToken(_position, content); + } + + private XmlCommentToken NewComment() + { + var comment = FlushBuffer(); + return new XmlCommentToken(_position, comment); + } + + private XmlPIToken NewProcessing() + { + return new XmlPIToken(_position); + } + + private XmlDoctypeToken NewDoctype() + { + return new XmlDoctypeToken(_position); + } + + private XmlDeclarationToken NewDeclaration() + { + return new XmlDeclarationToken(_position); + } + + private XmlTagToken NewOpenTag() + { + return new XmlTagToken(XmlTokenType.StartTag, _position); + } + + private XmlTagToken NewCloseTag() + { + return new XmlTagToken(XmlTokenType.EndTag, _position); + } + + private XmlCDataToken NewCharacterData() + { + var content = FlushBuffer(); + return new XmlCDataToken(_position, content); + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/Parser/XmlTreeMode.cs b/src/AngleSharp.Xml/Parser/XmlTreeMode.cs new file mode 100644 index 0000000..24499ad --- /dev/null +++ b/src/AngleSharp.Xml/Parser/XmlTreeMode.cs @@ -0,0 +1,29 @@ +namespace AngleSharp.Xml.Parser +{ + /// + /// Possible insertation mode values. + /// + enum XmlTreeMode : byte + { + /// + /// The initial mode - waiting for the XML declaration. + /// + Initial, + /// + /// The prolog (before the doctype or any element). + /// + Prolog, + /// + /// The misc mode (e.g. between doctype and first element). + /// + Misc, + /// + /// The body (after the doctype or first element). + /// + Body, + /// + /// The misc mode (after root). + /// + After + } +} diff --git a/src/AngleSharp.Xml/Properties/AssemblyInfo.cs b/src/AngleSharp.Xml/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..81d2026 --- /dev/null +++ b/src/AngleSharp.Xml/Properties/AssemblyInfo.cs @@ -0,0 +1,7 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyCopyright("Copyright © AngleSharp, 2013-2019")] +[assembly: ComVisible(false)] +[assembly: InternalsVisibleToAttribute("AngleSharp.Xml.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010001adf274fa2b375134e8e4558d606f1a0f96f5cd0c6b99970f7cce9887477209d7c29f814e2508d8bd2526e99e8cd273bd1158a3984f1ea74830ec5329a77c6ff201a15edeb8b36ab046abd1bce211fe8dbb076d7d806f46b15bfda44def04ead0669971e96c5f666c9eda677f28824fff7aa90d32929ed91d529a7a41699893")] diff --git a/src/AngleSharp.Xml/XmlConfigurationExtensions.cs b/src/AngleSharp.Xml/XmlConfigurationExtensions.cs new file mode 100644 index 0000000..416f1f4 --- /dev/null +++ b/src/AngleSharp.Xml/XmlConfigurationExtensions.cs @@ -0,0 +1,54 @@ +namespace AngleSharp.Xml +{ + using AngleSharp.Dom; + using AngleSharp.Io; + using AngleSharp.Svg.Dom; + using AngleSharp.Xml.Dom; + using AngleSharp.Xml.Parser; + using System.Linq; + using System.Threading; + using System.Threading.Tasks; + + /// + /// XML related extensions for the configuration. + /// + public static class XmlConfigurationExtensions + { + /// + /// Adds XML capabilities to the configuration. + /// + /// The configuration to extend. + /// The new configuration. + public static IConfiguration WithXml(this IConfiguration configuration) + { + var documentFactory = configuration.Services.OfType().FirstOrDefault(); + + if (documentFactory != null) + { + documentFactory.Register(MimeTypeNames.Xml, LoadXmlAsync); + documentFactory.Register(MimeTypeNames.ApplicationXml, LoadXmlAsync); + documentFactory.Register(MimeTypeNames.Svg, LoadSvgAsync); + } + + return configuration.WithOnly(ctx => new XmlParser(ctx)); + } + + private static Task LoadXmlAsync(IBrowsingContext context, CreateDocumentOptions options, CancellationToken cancellationToken) + { + var parser = context.GetService(); + var document = new XmlDocument(context, options.Source); + document.Setup(options.Response, options.ContentType, options.ImportAncestor); + context.NavigateTo(document); + return parser.ParseDocumentAsync(document, cancellationToken); + } + + private static Task LoadSvgAsync(IBrowsingContext context, CreateDocumentOptions options, CancellationToken cancellationToken) + { + var parser = context.GetService(); + var document = new SvgDocument(context, options.Source); + document.Setup(options.Response, options.ContentType, options.ImportAncestor); + context.NavigateTo(document); + return parser.ParseDocumentAsync(document, cancellationToken); + } + } +} diff --git a/src/AngleSharp.Xml/XmlEntityProvider.cs b/src/AngleSharp.Xml/XmlEntityProvider.cs new file mode 100644 index 0000000..22e3b29 --- /dev/null +++ b/src/AngleSharp.Xml/XmlEntityProvider.cs @@ -0,0 +1,63 @@ +namespace AngleSharp.Xml +{ + using AngleSharp.Dom; + using System; + using System.Collections.Generic; + + /// + /// Represents the list of all Xml entities. + /// + public sealed class XmlEntityProvider : IEntityProvider + { + #region Fields + + private readonly Dictionary _entities = new Dictionary + { + { "amp;", "&" }, + { "lt;", "<" }, + { "gt;", ">" }, + { "apos;", "'" }, + { "quot;", "\"" } + }; + + #endregion + + #region Instance + + /// + /// Gets the instance to resolve entities. + /// + public static readonly IEntityProvider Resolver = new XmlEntityProvider(); + + #endregion + + #region ctor + + private XmlEntityProvider() + { + } + + #endregion + + #region Methods + + /// + /// Gets a symbol specified by its entity name. + /// + /// The name of the entity in the XML code. + /// The string with the symbol or null. + public String GetSymbol(String name) + { + var symbol = String.Empty; + + if (!String.IsNullOrEmpty(name)) + { + _entities.TryGetValue(name, out symbol); + } + + return symbol; + } + + #endregion + } +} diff --git a/src/AngleSharp.Xml/XmlMarkupFormatter.cs b/src/AngleSharp.Xml/XmlMarkupFormatter.cs new file mode 100644 index 0000000..4c0c472 --- /dev/null +++ b/src/AngleSharp.Xml/XmlMarkupFormatter.cs @@ -0,0 +1,136 @@ +namespace AngleSharp.Xml +{ + using AngleSharp.Dom; + using AngleSharp.Text; + using System; + + /// + /// Represents the standard XML markup formatter. + /// + public sealed class XmlMarkupFormatter : IMarkupFormatter + { + #region Instance + + /// + /// An instance of the XmlMarkupFormatter. + /// + public static readonly IMarkupFormatter Instance = new XmlMarkupFormatter(); + + #endregion + + #region Methods + + String IMarkupFormatter.CloseTag(IElement element, Boolean selfClosing) + { + var prefix = element.Prefix; + var name = element.LocalName; + var tag = !String.IsNullOrEmpty(prefix) ? prefix + ":" + name : name; + return selfClosing ? String.Empty : String.Concat(""); + } + + String IMarkupFormatter.Comment(IComment comment) + { + return String.Concat(""); + } + + String IMarkupFormatter.Doctype(IDocumentType doctype) + { + var publicId = doctype.PublicIdentifier; + var systemId = doctype.SystemIdentifier; + var noExternalId = String.IsNullOrEmpty(publicId) && String.IsNullOrEmpty(systemId); + var externalId = noExternalId ? String.Empty : " " + (String.IsNullOrEmpty(publicId) ? + String.Concat("SYSTEM \"", systemId, "\"") : + String.Concat("PUBLIC \"", publicId, "\" \"", systemId, "\"")); + return String.Concat(""); + } + + String IMarkupFormatter.OpenTag(IElement element, Boolean selfClosing) + { + var prefix = element.Prefix; + var temp = StringBuilderPool.Obtain(); + temp.Append(Symbols.LessThan); + + if (!String.IsNullOrEmpty(prefix)) + { + temp.Append(prefix).Append(Symbols.Colon); + } + + temp.Append(element.LocalName); + + foreach (var attribute in element.Attributes) + { + temp.Append(" ").Append(Instance.Attribute(attribute)); + } + + if (selfClosing) + { + temp.Append(" /"); + } + + temp.Append(Symbols.GreaterThan); + return temp.ToPool(); + } + + String IMarkupFormatter.Processing(IProcessingInstruction processing) + { + var value = String.Concat(processing.Target, " ", processing.Data); + return String.Concat(""); + } + + String IMarkupFormatter.Text(ICharacterData text) + { + var content = text.Data; + return EscapeText(content); + } + + String IMarkupFormatter.Attribute(IAttr attribute) + { + var value = attribute.Value; + var temp = StringBuilderPool.Obtain(); + temp.Append(attribute.Name); + temp.Append(Symbols.Equality).Append(Symbols.DoubleQuote); + + for (var i = 0; i < value.Length; i++) + { + switch (value[i]) + { + case Symbols.Ampersand: temp.Append("&"); break; + case Symbols.LessThan: temp.Append("<"); break; + case Symbols.DoubleQuote: temp.Append("""); break; + default: temp.Append(value[i]); break; + } + } + + return temp.Append(Symbols.DoubleQuote).ToPool(); + } + + #endregion + + #region Helpers + + /// + /// Escapes the given text by replacing special characters with their + /// XML entity (only applies to ampersands and opening angle brackets). + /// + /// The string to alter. + /// The altered string. + public static String EscapeText(String content) + { + var temp = StringBuilderPool.Obtain(); + + for (var i = 0; i < content.Length; i++) + { + switch (content[i]) + { + case Symbols.Ampersand: temp.Append("&"); break; + case Symbols.LessThan: temp.Append("<"); break; + default: temp.Append(content[i]); break; + } + } + + return temp.ToPool(); + } + + #endregion + } +} diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 0000000..4ade49e --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,7 @@ + + + Adds a powerful XML and DTD parser to AngleSharp. + AngleSharp.Xml + 0.11.0 + + \ No newline at end of file