Request for ideas/direction

M

Mark Woods

Hello Everyone,

Have a question for the group...

At work, we use a software/hardware inventory product called "Alchemy
Network Inventory". It scans each computer that logs into our network
and creates a result file on a server. The result files are tagged-text,
with an extension of ".XML". These files are not truly valid XML, as
they are missing the XML statement at the top and do not have a link to a
DTD/schema. I have asked the manufacturer for such a DTD/schema, but
they have not honored my request at this time.

They have a console program that reads the result files and can display
each computer and it's components/software, and this program can also
export any/all of the result files to more traditional file formats such
as Excel, CSV and Access (via ODBC).

What I'm looking for are ideas on what parsers/programming languages I
could use that would be able to "read" these result files and generate
reports in either HTML, pure text, etc.

Need something that I can do immediate, ad hoc reports and have been
looking at Perl, Python, VBScript, XSLT, etc., but am a novice programmer
and am looking to learn in the process of doing it.

Thanks in advance...
 
M

Martin Honnen

Mark Woods wrote:

At work, we use a software/hardware inventory product called "Alchemy
Network Inventory". It scans each computer that logs into our network
and creates a result file on a server. The result files are tagged-text,
with an extension of ".XML". These files are not truly valid XML, as
they are missing the XML statement at the top and do not have a link to a
DTD/schema. I have asked the manufacturer for such a DTD/schema, but
they have not honored my request at this time.

If by "XML statement" you mean the XML declaration e.g.
<?xml version="1.0"?>
then it is allowed to leave that out if the encoding of the file is
UTF-8 or UTF-16.
And "a link to a DTD", e.g. the DOCTYPE node
<!DOCTYPE root SYSTEM "whatever.dtd">
is also optional thus what you have could indeed be XML if it is
well-formed markup.

What I'm looking for are ideas on what parsers/programming languages I
could use that would be able to "read" these result files and generate
reports in either HTML, pure text, etc.

If it is XML then any XML parser would do and then you can use DOM or
XSLT to create other formats.

The programming language to choose obviously needs to support XML
parsing but most languages do that so your choice should be driven by
what you are comfortable with.
 
?

=?ISO-8859-1?Q?J=FCrgen_Kahrs?=

Mark said:
and creates a result file on a server. The result files are tagged-text,
with an extension of ".XML". These files are not truly valid XML, as
they are missing the XML statement at the top and do not have a link to a

xmllint accepts such files.
What I'm looking for are ideas on what parsers/programming languages I
could use that would be able to "read" these result files and generate
reports in either HTML, pure text, etc.

The canonical solution seems to be to use XSL.
Need something that I can do immediate, ad hoc reports and have been
looking at Perl, Python, VBScript, XSLT, etc., but am a novice programmer
and am looking to learn in the process of doing it.

I would use a script language rather than XSL.
Script languages allow you to implement stand-alone
scripts with a minimum of requirements.
 
R

Rolf Kemper

Mark,
if I undestood it right, you want to convert the invalid xml into a
valid xml.
In case you have it in Excel, you could write out the Excel file as
XML. It has all the Excell items and declarations with it. Then you
might apply some xslt to the transform it to your target format. But
all this this might be a total overkill.
If I would have to do the job, I would use perl (some regex and
XML::Simple , which is quite easy)and write out xml. Then translate it
to HTML , text, etc. by xlst.

Rolf
 
A

Andy Dingley

These files are not truly valid XML, as
they are missing the XML statement at the top and do not have a link to a
DTD/schema.

These may not even be valid XML, but they're probably well-formed XML
and that's all you need.

XML alone can just be "well-formed", which means that the syntax is
correct. XML prologs, DTDs and schemas are all optional.

XML for a named application can go one better than this, and could be
"valid". This means that it's written according to a DTD/schema and
it matches that DTD/schema. Containing an explicit link to that
DTD/schema is still optional.

I have asked the manufacturer for such a DTD/schema, but
they have not honored my request at this time.

They very rarely do. If they would tell you, they'd have told you
already and been proud of it.

What I'm looking for are ideas on what parsers/programming languages I
could use

Some scripting language that you know / like, and that can connect to
an XML DOM / XSLT transformer. Perl or Python could easily do this.
By the sound of things you're on Windows (what about the servers ?)
so a handy XML tool is Microsft's MSXML that is a free download and
does both XML and XSLT.

Depending on the structure and usage of the schema, you may be able to
process the document entirely with XSLT. This is unlikely though -
it's usual that you need a slightly smart "wrapper" around it, so as
to feed it the right files and maybe some metadata from other sources.

You may also need to perform some internal computation or string
mangling that's hard in pure XSLT 1, but trivial in JavaScript or
regexes. This is a job for an extension to XSLT, a simple little
snippet of JavaScript embedded in the stylesheet. They're not very
portable for web-wide distribution, but they work fine for in house
tools.

Michael Kay's XSLT book is the one to have.
 
W

William Park

Mark Woods said:
Hello Everyone,

Have a question for the group...

At work, we use a software/hardware inventory product called "Alchemy
Network Inventory". It scans each computer that logs into our network
and creates a result file on a server. The result files are tagged-text,
with an extension of ".XML". These files are not truly valid XML, as
they are missing the XML statement at the top and do not have a link to a
DTD/schema. I have asked the manufacturer for such a DTD/schema, but
they have not honored my request at this time.

They have a console program that reads the result files and can display
each computer and it's components/software, and this program can also
export any/all of the result files to more traditional file formats such
as Excel, CSV and Access (via ODBC).

What I'm looking for are ideas on what parsers/programming languages I
could use that would be able to "read" these result files and generate
reports in either HTML, pure text, etc.

Need something that I can do immediate, ad hoc reports and have been
looking at Perl, Python, VBScript, XSLT, etc., but am a novice programmer
and am looking to learn in the process of doing it.

Thanks in advance...

Sounds like the result files just use the format of XML syntax. And,
that's all you need to parse it. I can think of Gawk and Bash, both
with Expat XML parser interface. Their URLs have been posted in this
newsgroup, I think.

If you can post a sample input you have and sample output you want, we
wouldn't have to guess. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top