PDA

View Full Version : New nc.synergyxr.net feature



Lachlan
27-05-05, 22:03
Attention Neocron Application Developers!

Nc.synergyxr.net, the dynamic Neocron resource site, is proud to announce the availability of an XML interface to the nc.synergyxr.net database. Items, classes, and skills are now available in the current version, but other data is planned for inclusion in the API if there is sufficient demand.

What does all of this mean? If your application can parse XML data, you can now include data from the nc.synergyxr.net database in your application. As the database is updated by the community, so is your application!

This is ideally suited for skillmanagers, rare part databases, part/construction calculators, and more!

For further information, see http://nc.synergyxr.net/xmlapi (http://nc.synergyxr.net/xmlapi) or contact an nc.synergyxr.net admin.

-FN-
27-05-05, 23:37
Now I wish I knew something about XML :rolleyes: :p Seriously tho, thanks for the awesome work Lachlan - I hope to see some cool stuff coming from creative people with the new data format available :)

Brammers
28-05-05, 00:33
Well since I'm looking at adding new stuff to the THN, I may make use of this.

*Pokes around* This looks quite good!

enigma_b17
28-05-05, 01:02
xml is the w1n :)

Darkana
28-05-05, 01:36
WTB XML Schema definition of this :p

Lachlan
28-05-05, 01:43
WTB XML Schema definition of this :p
I'm no XML expert, but my understanding is that you only need a DTD Schema to check for properly formed XML (against that Schema) and some third-party parsers that require one.

If anyone absolutely needs one, I'll see what I can come up with.. I just haven't looked into it yet.

All of the possible tags are documented, it's just not in schema format.

enigma_b17
28-05-05, 01:53
a dtd provides data validation, not really that the xml is properly formatted. It just makes sure like if an element Must have a certain attribute or value then if it doesnt it gives an error when u try to validate it through an xml parser like er
cooktop.

Darkana
28-05-05, 09:45
Well, a XML Schema is nothing else than a DTD, at least from the view point of what it is doing. XML Schemas are more powerful in the way they can describe the syntax of XML documents, though. On top of it, they are written in XML, which is easier readable than this weird DTD syntax.

To make it short: It's not really needed here, but it allows you to make an exact description of how your XML documents look like.

Btw. you can use a XML Schema for more than just validation :)

Edit: Maybe I should put a small example here, too (the silo list):


<?xml version="1.0"?>
<!-- xmlns:xsd defines the namespace ("ns") xsd, all tags
of this namespace are prefaced with "xsd:",
including this very root element "schema" -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<!-- root element, I splitted type definition (nc.synType) from
element definition -->
<xsd:element name="nc.syn" type="nc.synType"/>

<xsd:complexType name="nc.synType">
<xsd:sequence>
<xsd:element name="logo" type="logoType"/>
<xsd:element name="api" type="apiType"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="logoType">
<xsd:attribute name="url" type="xsd:anyURI" use="required"/>
<!-- or, to "fix" the URI you are using:
xsd:attribute name="url" type="xsd:anyURI" use="fixed"
value="http://[...]tl90bp.gif"/ -->
</xsd:complexType>

<xsd:complexType name="apiType">
<xsd:sequence>
<xsd:element name="silolist">
<!-- anonymous type definition -->
<xsd:complexType>
<xsd:sequence>
<!-- unlimited amount of "silo"-tags -->
<xsd:element name="silo" type="siloType"
maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<!-- regular expression limiting the content of the silo tags
to "classes", "items" or "skills" for now -->
<xsd:simpleType name="siloType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="classes|items|skills"/>
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>
As you can see, it's pretty straighforward. Downside is, you have tons of choices how you actually write the schema definitions (I showed some); the simplest way is probably the best, I think :)

Furthermore, this XSD has a flaw: It allows you to add an unlimited amount of <silo>-tags, including multiple "classes", "items" and/or "skills", which is probably not what you intented. Which means, there is room for improvement, still :cool:

PS: I'm not entirely sure if this is syntactically correct, but I think you get the idea what it looks like and what it is for.