Jump to content

DATA BINDING


AndreasB

Recommended Posts

Hi!I'm very new to XML so please bare with me.I have an XML file which has been autogenerated with a program called nmap (ie. used for scanning vounerability on your network).Now, I've read and tried the page where you can BIND XML and create the selected contents in a TABLE to be outputted on a HTML page.Now, I tried the same with the XML file that had been generated with nmap, but I see that there seems to be a problem and I believe it has to do with that the fieldnames contain spaces. I have pasted below a short example from the XML file for you to review.

<host><status state="up" /><address addr="192.165.181.113" addrtype="ipv4" /><hostnames><hostname name="computer01" type="PTR" /></hostnames><ports><extraports state="filtered" count="1667" />

The above is just a short cutout of the whole file.Thankful for any kind of help!Best regards,Andreas

Link to comment
Share on other sites

So what exactly is the problem if there is a premade application which would transform this XML data into an XHTML table?

Link to comment
Share on other sites

What is actually that application? Is it editable? If so, post it's code. If not (as I suspect) there isn't anything you could do except make your own application by making an appropriate XSLT file.

Link to comment
Share on other sites

  • 3 weeks later...

Hi there I saw this :) and thought of you :) . I think your biggest problem here is that all of the values are attributes and not elements.If you look at the XSL tutorial, it will show you how to deal with extracting attributes by using @ combined with <xsl:value-of>.If you only needed to select individual pieces of information then use the following as a base code and edit it how you see fit (if it doesn't work then I apologise because I'm quite new to this myself):

<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:apply-templates select="address"/><xsl:template match="address">address: <xsl:value-of select="@addr" /><br />address type: <xsl:value-of select="@addrtype" /></xsl:template></xsl:stylesheet>

If you save the above as an xsl file then you can link the two by using script that you can find in the XMLDOM tutorial in the W3Schools website.Hope this helps.Dooberry.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...