Skip to content

Documentation needed: Creation of root node with namespace #333

Description

@Zack-83

As of Release 1.2.1. it seems to be possible to assign a namespace to a newly created root node, using xml_root()

Unfortunately this is not documented at all, neither under ?xml_root (redirecting to xml_children) nor under xml_new_root() (redirecting to xml_new_document), so that it is not clear how to use it. The parameters ns, prefix, uri don't work as expected.

Importing the namespace from an existing XML document does also not work. And creating an object of class xml_namespace from scratch seems also impossible.

Is there a solution?

Thanks

Activity

  1. grn-dk commented on Mar 15, 2021

    @grn-dk

    doc <- xml_new_root(
    .value = "MyFancyStructure",
    "xsi:schemaLocation" = "https://example.com ",
    "xmlns:ver3.4" = "https://example.com",
    "xmlns:xsi" = "https://www.w3.org/2001/XMLSchema-instance",
    .version = "1.0",
    .encoding = "UTF-8"
    )

    Not sure if this solves your issue, just wanted to document it. :-)

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