2017 © Pedro Peláez
 

library cs-phpxml

Library for reading, writing, and updating XML via PHP

image

crazedsanity/cs-phpxml

Library for reading, writing, and updating XML via PHP

  • Friday, September 1, 2017
  • by crazedsanity
  • Repository
  • 1 Watchers
  • 0 Stars
  • 346 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 1 % Grown

The README.md

BASICS:::

xmlParser{} is the class that parses an XML file or string., (*1)

xmlBuilder{} parses an array (like the one from xmlParser{}->get_tree()) into an XML string., (*2)

xmlCreator{} is a set of methods to create an array like what xmlParser{} creates, and feeds it to xmlBuilder{} to create a useable XML string., (*3)

EXTERNAL LIBRARIES:

1.) The "arrayToPath{}" object/class is available online at http://sf.net/projects/cs-arraytopath, or via Subversion at "https://cs-arraytopath.svn.sourceforge.net/svnroot/cs-arraytopath/trunk"., (*4)

2.) All projects which utilize these XML libraries have a "/lib" directory (beneath "public_html", which holds index.php, etc.) that holds all the libraries: /lib/externals/ holds directories containing these libraries. An example layout:, (*5)

/public_html/
    index.php
    subdir1/
    subdir2/
/lib/
    dir1/
    externals/
        cs-arrayToPath/
        cs-content/
        cs-phpxml/
    otherFolder/
/templates/
    somedir1/
    x/

3.), (*6)

REMEMBER:

1.) there can be ONLY ONE root element (the first index, "ROOT_ELEMENT")., (*7)

2.) the parser converts tags into UPPERCASE: lowercase indexes are special (attributes, type, value) a.) if an intermediate portion of the path is "value" (case insensitive), it is left as UPPERCASE b.) if the last part of the path is "value" (case insensitive), it is converted to lowercase only if that path exists., (*8)

3.) arrayToPath{} addresses arrays using paths, much like a unix filesystem. In the array below, the tag with a value of "AA Rechargeable Battery Pack" may be addressed as "/ROOT_ELEMENT/SHOPPING-CART/ITEMS/ITEM/0/ITEM-NAME"., (*9)

4.) when a tag is listed multiple times within the same parent tag, it is represented as a numerically-indexed array beneath the duplicated tag name: this parent tag will NOT have a "type" index. For an example, see /ROOT_ELEMENT/SHOPPING-CART/ITEMS/ITEM in the array below., (*10)

5.) Attribute names are left in whatever case they were in, not converted to upper or lower like others!, (*11)

FORMAT OF ARRAYS:::

Array ( [ROOT_ELEMENT] => Array ( [type] => open [attributes] => Array ( [XMLNS] => http://this.domain.com/wherever/whatever [COMMENT] => This is my comment ), (*12)

         [SHOPPING-CART] => Array
             (
                 [type] => open
                 [ITEMS] => Array
                     (
                         [type] => open
                         [ITEM] => Array
                             (
                                 [0] => Array
                                     (
                                         [type] => open
                                         [ITEM-NAME] => Array
                                             (
                                                 [type] => complete
                                                 [value] => AA Rechargeable Battery Pack
                                             )

                                         [ITEM-DESCRIPTION] => Array
                                             (
                                                 [type] => complete
                                                 [value] => Battery pack containing four AA rechargeable batteries
                                             )

                                         [UNIT-PRICE] => Array
                                             (
                                                 [type] => complete
                                                 [attributes] => Array
                                                     (
                                                         [CURRENCY] => USD
                                                         [testValue] => this is just a Test.
                                                     )

                                                 [value] => 12.00
                                             )

                                         [QUANTITY] => Array
                                             (
                                                 [type] => complete
                                                 [value] => 1
                                             )

                                     )

                                 [1] => Array
                                     (
                                         [type] => open
                                         [ITEM-NAME] => Array
                                             (
                                                 [type] => complete
                                                 [value] => MegaSound 2GB MP3 Player
                                             )

                                         [ITEM-DESCRIPTION] => Array
                                             (
                                                 [type] => complete
                                                 [value] => Portable MP3 player - stores 500 songs
                                             )

                                         [UNIT-PRICE] => Array
                                             (
                                                 [type] => complete
                                                 [attributes] => Array
                                                     (
                                                         [CURRENCY] => USD
                                                     )

                                                 [value] => 178.00
                                             )

                                         [QUANTITY] => Array
                                             (
                                                 [type] => complete
                                                 [value] => 1
                                             )

                                     )

                             )

                     )

             )

     )

), (*13)

License

Copyright (c) 2013 "crazedsanity" Dan Falconer Dual licensed under the MIT and GPL Licenses., (*14)

The Versions

01/09 2017

dev-master

9999999-dev https://github.com/crazedsanity/cs-phpxml

Library for reading, writing, and updating XML via PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

php xml dry oaoo

01/09 2017

v1.2.0

1.2.0.0 https://github.com/crazedsanity/cs-phpxml

Library for reading, writing, and updating XML via PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

php xml dry oaoo

24/12 2014

v1.1.5

1.1.5.0 https://github.com/crazedsanity/cs-phpxml

Library for reading, writing, and updating XML via PHP

  Sources   Download

MIT

The Requires

 

php xml

24/12 2014

v1.1.4

1.1.4.0 https://github.com/crazedsanity/cs-phpxml

Library for reading, writing, and updating XML via PHP

  Sources   Download

MIT

The Requires

 

php xml

06/01 2014

dev-development

dev-development https://github.com/crazedsanity/cs-phpxml

Library for reading, writing, and updating XML via PHP

  Sources   Download

MIT

The Requires

 

php xml

06/01 2014

1.1.3

1.1.3.0 https://github.com/crazedsanity/cs-phpxml

Library for reading, writing, and updating XML via PHP

  Sources   Download

MIT

The Requires

 

php xml