2017 © Pedro Peláez
 

library doc-validator

Simple scraper for validating nested XML/JSON examples in HTML

image

jamiehannaford/doc-validator

Simple scraper for validating nested XML/JSON examples in HTML

  • Thursday, February 27, 2014
  • by jamiehannaford
  • Repository
  • 1 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

doc-validator

Simple scraper for validating nested XML/JSON examples in OpenStack/Rackspace doc files., (*1)

General outline

  1. Executes a recursive wget for a given URI. The process follows every link nested in a given piece of markup until every possible link is exhausted. It saves each remote URI to the local filesystem. An example location might be: ./docs/docs.openstack.org, where docs.openstack.org is the root URI you specified. Only HTML files are saved, any other remote file type is omitted., (*2)

  2. Once the wget procedure is complete, the PHP script traverses the local directory recursively, scanning each HTML file for a given regex pattern. The regular expression indicates how code samples are nested into the markup., (*3)

  3. Once code samples are extracted, the script judges whether it is either JSON or XML. It then executes the relevant parsing test for either type., (*4)

  4. If the parsing fails, it is likely malformed, and generates an error. These errors can either be output to the console (i.e. STDOUT) or to a local log file., (*5)

CLI options

The main script you will need to run is:, (*6)

./bin/doc-validator

Supported CLI flags

Short Long Description Default
-u --uri The URI which wget points at docs.rackspace.com
-s --skip-wget Instructs the script to skip the wget stage and check the local ./docs version only Disabled
-q --quiet-wget Instructs the script to silence the wget output Disabled
-l --log-file Instructs the script to output everything to a provided file. If left empty, the filename will be the same as the root URI Disabled

Convenience scripts

To run against docs.openstack.org, run: ./bin/openstack, (*7)

To run against docs.rackspace.com, run: ./bin/rackspace, (*8)

Installation

You will need to install this package with Composer:, (*9)

# Install Composer executable
curl -sS https://getcomposer.org/installer | php

# Install package
php composer.phar require jamiehannaford/doc-validator:1.0.0

You can then access the binary:, (*10)

./vendor/bin/doc-validator -udocs.foo.com -q -l < /dev/null &

Because you have left the --log-file flag empty, it will log everything to a default location:, (*11)

./vendor/jamiehannaford/doc-validator/log/docs.foo.com.log

The Versions

27/02 2014

dev-master

9999999-dev

Simple scraper for validating nested XML/JSON examples in HTML

  Sources   Download

Apache-2.0

The Requires

 

26/02 2014

1.0.0

1.0.0.0

Simple scraper for validating nested XML/JSON examples in HTML

  Sources   Download

Apache-2.0

The Requires