473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Unable to parse multiple values using XMLStarlet

I'm trying to use XMLStarlet to pull a value out of Microsoft's
mssecure.xml file for patch availability. I'm an XML newb, so I'm
struggling here.

I want to pull the @Summary field value- I'm unable to see from the
examples how to handle pulling one of these multiple values. I don't
want to use a template.

I tried

xml sel -t -m
BulletinDataStore/Bulletins/Bulletinp[@BulletinID=MS98-007] to see if I
could get anything - nothing. I'm missing some point here.
The file is like this (from xml el -v mssecure.xml):

BulletinDatastore/Bulletins/Bulletin[@BulletinID='MS98-007' and
@BulletinLocationID='1' and @FAQLocationID='1' and
@FAQPageName='FQ98-007.asp' and @Title='Potential SMTP and NNTP
Denial-of-Service Vulnerabilities' and @DatePosted='1998/07/24' and
@DateRevised='1998/09/09' and @Supported='Yes' and @Summary='This issue
involves a denial of service vulnerability that can potentially be used
by someone with malicious intent to unexpectedly cause multiple
components of the Microsoft Exchange Server to stop.' and @Issue='' and
@ImpactSeverityID='0' and @PreReqSeverityID='0' and
@MitigationSeverityID='0' and @PopularitySeverityID='0']
BulletinDatastore/Bulletins/Bulletin/BulletinComments
BulletinDatastore/Bulletins/Bulletin/QNumbers
BulletinDatastore/Bulletins/Bulletin/QNumbers/QNumber[@QNumber='188341']
BulletinDatastore/Bulletins/Bulletin/QNumbers/QNumber[@QNumber='188369']
BulletinDatastore/Bulletins/Bulletin/Patches
BulletinDatastore/Bulletins/Bulletin/Patches/Patch[@PatchName='MS98-007'
and @Pa
tchLocationID='13' and @SBID='0' and @SQNumber='188341' and
@NoReboot='0' and @SeverityID='0']

Jul 20 '05 #1
2 2680
kg****@yahoo.com wrote:
I'm trying to use XMLStarlet to pull a value out of Microsoft's
mssecure.xml file for patch availability. I'm an XML newb, so I'm
struggling here.
I don't know XMLStarlet, but your problem can
easily be solved with other tools.
I want to pull the @Summary field value- I'm unable to see from the
examples how to handle pulling one of these multiple values. I don't
want to use a template.


The attached script is written for use with xmlgawk,
an extension of GNU Awk. The script prints the IDs
of all bulletins along with a summary and the names
of all patches like this:

Bulletin MS98-007 1998/09/09
This issue involves a denial of service vulnerability that can potentially be used by someone with m
alicious intent to unexpectedly cause multiple components of the Microsoft Exchange Server to stop.
PatchName: psp2stri.exe
PatchName: psp2imsi.exe
PatchName: MS98-007

If you would like to use the script, you will probably
need a bit more info about xmlgawk:

http://groups.google.de/groups?dq=&h...Dcomp.lang.awk

# mssec.awk
# Reads a file containing MS-related bulletins about
# patches named mssecure.xml. The data comes as an
# XML document from standard input. An overview is
# printed on standard output. More recent versions
# of the file can be downloaded here:
# https://xml.shavlik.com/mssecure.xml
# JK 2004-08-27

BEGIN { XMLMODE=1 }

XMLSTARTELEM == "Bulletin" {
print "\nBulletin", XMLATTR["BulletinID"], XMLATTR["DateRevised"]
print XMLATTR["Summary"]
}

XMLSTARTELEM == "Patch" {
print "PatchName:", XMLATTR["PatchName"]
}
Jul 20 '05 #2
kg****@yahoo.com wrote in message news:<cg********@odak26.prod.google.com>...
I'm trying to use XMLStarlet to pull a value out of Microsoft's
mssecure.xml file for patch availability. I'm an XML newb, so I'm
struggling here.

I want to pull the @Summary field value- I'm unable to see from the
examples how to handle pulling one of these multiple values. I don't
want to use a template.

I tried

xml sel -t -m
BulletinDataStore/Bulletins/Bulletinp[@BulletinID=MS98-007] to see if I
could get anything - nothing. I'm missing some point here.
The file is like this (from xml el -v mssecure.xml):

BulletinDatastore/Bulletins/Bulletin[@BulletinID='MS98-007' and
@BulletinLocationID='1' and @FAQLocationID='1' and
@FAQPageName='FQ98-007.asp' and @Title='Potential SMTP and NNTP
Denial-of-Service Vulnerabilities' and @DatePosted='1998/07/24' and
@DateRevised='1998/09/09' and @Supported='Yes' and @Summary='This issue
involves a denial of service vulnerability that can potentially be used
by someone with malicious intent to unexpectedly cause multiple
components of the Microsoft Exchange Server to stop.' and @Issue='' and
@ImpactSeverityID='0' and @PreReqSeverityID='0' and
@MitigationSeverityID='0' and @PopularitySeverityID='0']
BulletinDatastore/Bulletins/Bulletin/BulletinComments
BulletinDatastore/Bulletins/Bulletin/QNumbers
BulletinDatastore/Bulletins/Bulletin/QNumbers/QNumber[@QNumber='188341']
BulletinDatastore/Bulletins/Bulletin/QNumbers/QNumber[@QNumber='188369']
BulletinDatastore/Bulletins/Bulletin/Patches
BulletinDatastore/Bulletins/Bulletin/Patches/Patch[@PatchName='MS98-007'
and @Pa
tchLocationID='13' and @SBID='0' and @SQNumber='188341' and
@NoReboot='0' and @SeverityID='0']


Using XmlStarlet

xml sel -t -v "/BulletinDatastore/Bulletins/Bulletin[@BulletinID='MS98-001']/@Summary"
your-mssecure.xml
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: dreamcatcher | last post by:
I want my program to parse INI files, only have little clue of how to do that, though, hope you guys might shed some light on this, thanx. for example:
4
by: Chris Bower | last post by:
Reposted from aspnet.buildingcontrols: Ok, I've got a bunch of derived controls that all have a property Rights of type Rights (Rights is an Enumerator). I wrote a custom TypeConverter so that I...
5
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
1
by: whidbey | last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books...
0
by: whidbey | last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books...
0
by: Gabriel Genellina | last post by:
En Thu, 25 Sep 2008 05:30:41 -0300, <dudeja.rajat@gmail.comescribió: Instead of parsing that generated file (intended for human usage), use difflib.Differ or difflib.SequenceMatcher - you get a...
2
by: wengao | last post by:
xml ed -i <xpath-t elem -n Value -v <value1\ -t elem -n Value -v <value2\ -t elem -n Value -v <value3sample.xml There was a complaint about the second one: I/O warning : failed to load...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.