Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I am parsing XML and need a script that will read my XML file and add in the open tag for all missing open tags. Example from XML below: <promo_code/> has no matching open tag <promo_code> I need the code to scan and add missing open tags. End result would be <promo_code> <promo_code/> Example XML code below…

<orders> <order> <alt_number>2222</alt_number> <state>processed</state> <user_id>1234</user_id> <dd_id>54321</dd_id> <placed_at/> <total_price>449.0</total_price> <total_shipping_costs>90.0</total_shipping_costs> <discount>0</discount> <dd_status_code>HD</dd_status_code> <dd_status_desc>ORDER IS ON HOLD UNTIL 11/01/13</dd_status_desc> <promo_code/> <billing_address> <address_id/> <dd_customer_id/> <address_1>1212 Not Real</address_1> <address_2></address_2> <city>san mateo</city> <title></title> <company></company> <first_name>Jane</first_name> <last_name>Doe</last_name> <state_abbr/> <formated_telephone/> <zipcode/> <email>smith@smith.com</email> <country_code>USA</country_code> </billing_address> <transaction> </transaction> <shipments> <shipment_id>21286</shipment_id> <shipment> <shipping_address> <address_id>27696</address_id> <dd_customer_id/> <address_1>1212 Not Real</address_1> <address_2></address_2> <city>san jose</city> <title>Dr</title> <company></company> <first_name>Jane</first_name> <last_name>Doe</last_name> <state_abbr>CA</state_abbr> <formated_telephone>555-555-5555 Jane Smith</formated_teleph +one> <zipcode>95125-3344</zipcode> <email></email> <country_code>USA</country_code> </shipping_address> <delivery_date>2011-10-01</delivery_date> <gift>true</gift> <gift_email>smith@smith.com</gift_email> <gift_message>Happy Birthday</gift_message> <status>N</status> <tracking_nr></tracking_nr> <sent_at/> </shipment> </shipments> <line_items> <line_item> <line_item_id>16821</line_item_id> <dd_id>IDID</dd_id> <name>Keep It Coming</name> <quantity>1</quantity> <price>359.0</price> <shipment_id>21286</shipment_id> <shipping_costs>90.0</shipping_costs> <tax_amount>0</tax_amount> </line_item> </line_items> </order> <orders>

In reply to How can I add missing XML open tags by TheVend

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 17:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found