Skip to content

Idea: Support data type when using concise syntax #23

Description

@barchard

It would be nice if I could specify the data type when using the concise syntax. For example:

$book->add([ 'title'  => 'The Theory Of Everything',
             'author' => 'S. Hawking',
             'chapters' => [
                    [ 'chapter' => [
                            '@id' => '1',
                            '@:cdata'   => 'Ideas About The Universe' ] ],
                    [ 'chapter' => [
                            '@id' => '2',
                            '@:cdata'   => 'The Expanding Universe' ] ],
           ]]);

Presently, I am forced to call ->add('chapter', true) then ->cdata('Ideas About The Universe') on the node returned from the add call. Obviously, this results in code that isn't very concise :\

Data types based on the current API could be:

  • text
  • cdata
  • comment

Just an idea.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions