Skip to Content
0
Former Member
May 04, 2010 at 04:01 PM

DTD File Format - Attributes vs Elements

53 Views

Hi guys,

I have a DTD for an external HTTP call and it is not loading correctly into DataServices - or I am missing some settings!

Best explained with an example which involves samples of XML so please bear with me.....:

The DTD specifies a combination of nested elements as well as attributes of the elements that are to be passed as parameters in the HTTP function call (via XML doc).... e.g.

<!ELEMENT customer >

<!ATTLIST customer

sms-customer-number CDATA #IMPLIED

web-customer-number CDATA #IMPLIED

customer-group CDATA #REQUIRED>

<!ELEMENT activation-code (#PCDATA)>

...

...

So, what the DTD wants is an XML call like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE customers PUBLIC "-//blahblah" "customers.1.0.dtd">

<customers>

- <customer sms-customer-number="BPFLIP11" customer-group="e130a9">

<activation-code>grape</activation-code>

</customer>

</customers>

Notice that the sms_customer_number and the customer_group are attributes within <customer> and that activation_code is a nested element within it.

HOWEVER; when loading this DTD into DS as a file format, it creates the attributes as nested elements themselves and so causes the XML to look like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE customers PUBLIC "-//Atypon//DTD Literatum Customers DTD v1.0 20091209//EN" "customers.1.0.dtd">

<customers>

- <customer>

<sms-customer-number>BPFLIP11</sms-customer-number>

<customer-group>e130a9</customer-group>

<activation-code>grape</activation-code>

</customer>

</customers>

-


So the question is, why is DS not interpreting the DTD correctly and is there any way to get control over how to build the XML for my function call i.e. how can I get the first XML to be created (specifying attributes OF an element) instead of the second (everything is elements)?

Thanks for any help!

Flip.