Why is XML parsing not working?

Hi, I’m new here. I’m having trouble parsing an XML file, like the one shown in the example. I’ve already looked at the documentation, but I think I don’t really understand how it works.

<result id="some-id">
  <name>some name</name>
  <owner>
    <name>some admin</name>
  </owner>
  <modification_time>2000-06-12T13:27:15Z</modification_time>
  <comment/>
  <creation_time>2000-06-12T13:27:15Z</creation_time>
  <detection>
    <result id="another-id">
      <details>
        <detail>
          <name>product</name>
          <value>some value</value>
        </detail>
        <detail>
          <name>location</name>
          <value>80/tcp</value>
        </detail>
        <detail>
          <name>source_oid</name>
          <value>null</value>
        </detail>
        <detail>
          <name>source_name</name>
          <value>another value</value>
        </detail>
      </details>
    </result>
  </detection>
</result>

Is it a problem if there are tags with the same name nested (not directly, but as children of children)?
Many thanks

I don’t understand the question.
Does it not parse correctly?
AFAIK xml gets parsed into a list of dictionaries,
so it creates a list of tag dicts, each containing the tag name, and a list of children, which is in turn the same. this means that you can have many same named tags, as the dictionaries are self contained.

Hi @not_raffa, could you maybe try to revise your post’s title to be a complete question as per the question guidelines:

Good titles are questions you would ask your friend about Typst.

We hope by adhering to this, we make the information in this forum easy to find in the future. Thanks!

Also, you marked the reply you got as the solution – great! However, someone finding your question would (I think) not easily see how you were able to solve your problem using that response. It would be great if you could demonstrate how you managed to solve the problem you initially had in a separate reply to your post.

1 Like