Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8573533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:16:23+00:00 2026-06-11T19:16:23+00:00

I am learning to use XML:LibXML for a project in Perl and I saw

  • 0

I am learning to use XML:LibXML for a project in Perl and I saw this example.

The goal is to build this XML file:

<?xml version="1.0" encoding="utf-8"?>
<assets xmlns="http://bricolage.sourceforge.net/assets.xsd">
  <story id="1234" type="story">
    <name>Catch as Catch Can</name>
  </story>
</assets>

The author uses addChild to create story under assets:

my $story = $dom->createElement('story');

and he then also uses addChild (in combination with createAttribute) to specify the attributes for story:

$story->addChild( $dom->createAttribute( id => 1234));

Looking at the XML example above (without knowing much about XML), id="1234" is not a child of story but rather an attribute of it, so why do we use addChild in this last line?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:16:25+00:00Added an answer on June 11, 2026 at 7:16 pm

    By calling createAttribute or createElement, you create a new node. By calling addChild, you attach such a node into its parent. There are several types of nodes in XML: elements, attributes, but also text, comments, or processing instructions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my XML file: <?xml version=1.0 encoding=utf-8 ?> <Hero> <Legion> <Andromeda> <HeroType>Agility</HeroType> <Damage>39-53</Damage> <Armor>3.1</Armor>
I am just learning how to use perl hashes and ran into this message
I am learning to use xmlhttprequest/AJAX. In this sample code from w3schools, I do
I am use libxml2 for XML parsing. The sample code on the libxml website
I am learning xslt, but don't know the best scenarios for use xml +
My data.xml <?xml version=1.0 encoding=ISO-8859-1?> <catalog> <cd country=UK> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <price>10.0</price>
I am having issues integrating junit with a working ant build.xml file. My test
I'm just learning PERL. I've read some docs on parsing XML and reused some
I'm learning how to use ADF to build a webservice based desktop application. I
<?xml version=1.0 encoding=ISO-8859-1?> <bookstore> <book category=COOKING> <title lang=en>Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.