XML parsing issue

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1110

    hi Gurus,
    I am trying to parse such XML structure:

    <?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?>
    <Data xmlns=”data10.xsd” version=”1.1″>
    <cmData scope=”all” type=”all”>
    <header>
    <log action=”created” appInfo=”XMLmanager” appVersion=”1.0″ dateTime=”2015-05-07″ user=”XXX”/>
    </header>
    <managedObject class=”Node” operation=”update” version=”1.0″>
    <p name=”id”>Nd1</p>
    <list name=”unitList”>
    <item>
    <p name=”primary”>IF1</p>
    <p name=”Code”>A101</p>
    <p name=”Name”>NQ</p>
    <p name=”unitNumber”>1</p>
    </item>
    <item>
    <p name=”primary”>IF1</p>
    <p name=”Code”>A101</p>
    <p name=”Name”>NX</p>
    <p name=”unitNumber”>2</p>
    </item>
    </managedObject>
    <managedObject class=”line” operation=”update” version=”1.0″>
    <p name=”id”>Ln1</p>
    <p name=”delay”>82</p>
    <p name=”loss”>-30</p>
    <p name=”ul”>0</p>
    </managedObject>
    </cmData>
    </Data>

    And want to make such data frame:
    managedObject Operation name Value
    Node update id Nd1
    line update id Ln1
    line update delay 82
    line update loss -30
    line update ul 0

    could you please hint here, as I have an issue with xmlParse function:
    > doc <- xmlParse(file)
    xmlns: URI raml21.xsd is not absolute
    > class(doc)
    [1] “XMLInternalDocument” “XMLAbstractDocument”
    > root = xmlRoot(doc)
    > class(root)
    [1] “XMLInternalElementNode” “XMLInternalNode” “XMLAbstractNode”
    > child = xmlChildren(root)
    > class(child)
    [1] “XMLInternalNodeList” “XMLNodeList”
    > child_next = xmlChildren(child)
    Error in UseMethod(“xmlChildren”) :
    no applicable method for ‘xmlChildren’ applied to an object of class “c(‘XMLInternalNodeList’, ‘XMLNodeList’)”

    could you please help understand why I can`t fetch sub-child classes? I appreciate your help.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Scroll to top
Privacy Policy