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

  • SEARCH
  • Home
  • 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 8646551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:50:22+00:00 2026-06-12T12:50:22+00:00

Code : import markup url_= (‘href1.com’,’href2.com’) mycxml=markup.page(mode=’xml’, case=’given’) mycxml.init(encoding=’utf-8′) mycxml.Collection.open() mycxml.Items(url_) mycxml.collection.close() print mycxml

  • 0

Code:

import markup
url_= ('href1.com','href2.com')
mycxml=markup.page(mode='xml', case='given')
mycxml.init(encoding='utf-8')
mycxml.Collection.open()
mycxml.Items(url_)
mycxml.collection.close()
print mycxml

Output:

<?xml version='1.0' encoding='utf-8' ?>
<Collection>
<Items>href1.com</Items>
<Items>href2.com</Items>
</collection>

I would like to have a line like <Collection xmlns:p="somelines"> instead of <Collection>, but the : does not let me compile it. How can I “escape” it?

  • 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-12T12:50:23+00:00Added an answer on June 12, 2026 at 12:50 pm

    I don’t know if markup.py has something built-in to handle this, but it’s easy to force python to accept it using the ** syntax:

    import markup
    url_= ('href1.com','href2.com')
    mycxml=markup.page(mode='xml', case='given')
    mycxml.init(encoding='utf-8')
    mycxml.Collection(**{'xmlns:p': 'somelines'})
    mycxml.Items(url_)
    mycxml.collection.close()
    print mycxml
    

    output:

    <?xml version='1.0' encoding='utf-8' ?>
    <Collection xmlns:p="somelines">
    <Items>href1.com</Items>
    <Items>href2.com</Items>
    </collection>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

code: import urllib,urllib2 url = 'http://www.pythonchallenge.com/pc/def/linkedlist.php' print urllib2.urlopen(url).read() print urllib2.urlopen(url,urllib.urlencode({'nothing':12345})).read() the question I encounter
Code: import com.independentsoft.exchange.Service; import android.app.Activity; import android.os.Bundle; public class ContactsToExchangeActivity extends Activity { @Override
I have the following code import smtplib from email.mime.text import MIMEText smtpserver = 'smtp.gmail.com'
I have this code import com.crystaldecisions.reports.sdk.ReportClientDocument; ... ReportClientDocument rpt = new ReportClientDocument(); rpt.open(reportPath+fileName, 0);
given the following code: import ctypes ip=192.168.1.1 thisdll = ctypes.cdll['aDLL'] thisdll.functionThatExpectsAnIP(ip) how can I
I have the following code: import re #open the xml file for reading: file
My code: import datetime as dt import scikits.timeseries as ts ts_start_datetime= ts.Date(freq='T',year=2011,month=1,day=1,hour= 0,minute=0) ts_end_datetime
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
I have this code: import re def doReplace(toReplace): i = 1 def chapterReplacer(_): result
I have the code: import subprocess , os ffmpeg = "C:\\ffmpeg_10_6_11.exe" inVid = "C:\\test_in.avi"

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.