XDTOFactory, attribute schemaLocation. How?

1C:Enterprise platform integration capabilities and techniques

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 23, 2013
Company: OTTO

Hello all.

The problem is that it is impossible to specify the type like this:

Quote
type_schemaLocation = XDTOFactory.Type("http://www.w3.org/2001/XMLSchema-instance", "schemaLocation");
How to assign attribute type schemaLocation ?

Quote
The xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes can be used in a document to provide hints as to the physical location of schema documents which may be used for ·assessment·. See How schema definitions are located on the Web (§4.3.2) for details on the use of these attributes.

 
#2
People who like this:1Yes/0No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

Maybe this will help you.
I add xdto package with Namespace Uri "http://www.w3.org/2001/XMLSchema-instance"
and then create type in DataProcessor1 at Server Procedure.
see my example.

Download 1Cv8_2.cf (11.19 KB)
 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 23, 2013
Company: OTTO

Thanks for the tip, but there are two problems:
1) schemaLocation this is attribute. The suggested option - complex Type in XML.
2) But even if the schemaLocation a simple type, then this Namespace ("http://www.w3.org/2001/XMLSchema-instance") import in other XDTO package
and 1С platform output does so:

Quote
<ITMList xmlns="http://www.otto.de/itemdist" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://www.otto.de/itemdist itm_list.xsd">
whitout prefix xsi, but should be like this:
Quote
<ITMList xmlns="http://www.otto.de/itemdist" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.otto.de/itemdist itm_list.xsd">

I may be doing something wrong?

 
#4
People who like this:1Yes/0No
Active user
Rating: 6
Joined: Sep 16, 2011
Company:

Try using SetAttribute method of DOMElement:

SetAttribute(<Name>, <Value>)
SetAttribute(<NamespaceURI>, <LocalName>, <Value>)

Sets an attribute value.
If the attribute with the specified name does not exist in the element, it is created and set to the specified value. Otherwise, the attribute value is changed. The attribute value is not parsed while it is set

If the attribute name contains characters incompatible with XML standard of this document, or the node is read-only, an exception is triggered.

 
#5
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 23, 2013
Company: OTTO

Xin Wang, please give an example
I have the XDTOobject
how convert XDTOobject to DOMElement?

 
#6
People who like this:0Yes/0No
Active user
Rating: 6
Joined: Sep 16, 2011
Company:

Let's do opposite: please provide the infobase dump and explain where is the problem in it. And we will try to help.

 
#7
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 23, 2013
Company: OTTO

Ok. This database: http://sdrv.ms/YqlS9p
formed XML:

Code
<ITMList 
xmlns="http://www.sample-package.org" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <one>Fire</one>
   <zero>Bomb</zero>
</ITMList>


How to make sure that the element "ITMList"
containing the attribute "xsi:schemaLocation="http://www.otto.de/itemdist itm_list.xsd"
?

 
#8
People who like this:1Yes/0No
Active user
Rating: 4
Joined: Nov 19, 2012
Company:

Alexey, if I understood you correctly - you want get something like this:

Code
<ITMList xmlns="http://www.sample-package.org" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
schemaLocation="http://www.otto.de/itemdist/itm_list.xsd">
   <zero>Bomb</zero>
</ITMList>


You wrote correct code:
Code
ITMList = XDTOFactory.Create(XDTOFactory.Type("http://www.sample-package.org","ITMList"));
   ITMList.schemaLocation = "http://www.otto.de/itemdist/itm_list.xsd";
   ITMList.zero = "Bomb";


but in XDTOPackage for schemaLocation you must set Form=Attribute (default = Item)


But I don't know how to add prefix xsi..

Edited: Aleksey Bochkov - Jan 25, 2013 01:12 AM
 
#9
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 23, 2013
Company: OTTO

Thank you Aleksey for the analysis! )))

Quote
but in XDTOPackage for schemaLocation you must set Form=Attribute (default = Item)
According to the XML specification
http://www.w3.org/TR/xmlschema-1/#no-xsi
you suggested incorrect variant ((

and yes, need only:
Code
xsi:schemaLocation="http://www.otto.de/itemdist/itm_list.xsd"

 
#10
People who like this:1Yes/0No
Active user
Rating: 6
Joined: Sep 16, 2011
Company:

I tried to add xsi to schemaLocation, but failed too. Did this without of using XDTO Factory:

Code
   TempFileName = GetTempFileName();
   
   XMLWriter = New XMLWriter;
   XMLWriter.OpenFile(TempFileName);
   XMLWriter.WriteXMLDeclaration();
   XMLWriter.WriteStartElement("ITMList");
   XMLWriter.WriteAttribute("xmlns", "http://www.otto.de/itemdist");
   XMLWriter.WriteAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema");
   XMLWriter.WriteAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
   XMLWriter.WriteAttribute("xsi:schemaLocation", "http://www.otto.de/itemdist/itm_list.xsd");
   WriteXML(XMLWriter, "Fire", "one");
   WriteXML(XMLWriter, "Bomb", "zero");
   XMLWriter.WriteEndElement();
   XMLWriter.Close();
   
   XMLtext.Read(TempFileName);

Download 1Cv8.cf (7.45 KB)
Edited: Xin Wang - Jan 25, 2013 11:40 AM
 
#11
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 23, 2013
Company: OTTO

Thank you, Xin Wang!

But we must using XDTOFactory for this. How?..........
Guess platform can not this...

 
#12
People who like this:1Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

I have requested additional information regarding this topic from our developers and will notify you later.

 
#13
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Alexey, unfortunately it is not possible to set schemaLocation using XDTO package. I can suggest you to use the solution provided by Xin Wang or process the resulting file, generated with usage of XDTOPackage and containing no schemaLocation, using XMLReader and XMLWriter to add schemaLocation where it is needed.

If you can give reasons that support of schemaLocation is critical for you and other users, I will send your request to our developers.

 
#14
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Jan 23, 2013
Company: OTTO

Quote
If you can give reasons that support of schemaLocation is critical for you and other users, I will send your request to our developers.
XDTOFactory can not do
that inherent in XML standard
this is the reason

Timofey Bugaevsky, thanks for the reply and help.

 
#15
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Our developers said that this is not the often used functionality due to the development and data should be separated.

 
#16
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

Quote
Timofey Bugaevsky wrote:
If you can give reasons that support of schemaLocation is critical for you and other users, I will send your request to our developers.

1.2.28. Instance document must use the same namespace prefixes as used in the XBRL schemas or conformance suite instances together with the recommended default namespace prefix for all namespaces.

Below is a list of XBRL schemas for the core document files that are supported by disclosure systems following Global Filing Manual (e.g. instance, linkbase, XLink documents). The namespace that represents each document must be used in the form as shown. A recommended prefix that represents each namespace is provided. The location of the actual schema file is also identified.

http://www.ifrs.org/NR/rdonlyres/ED69E57A-E38C-42E8-895C-B2844A1655C6/0/GlobalFilingManual20110419.pdf

Really we also feel lack of functionality (flexibility) of XDTO. We had to stop using it because we have not find a solution to implement what we needed.
Please listen to us and add flexibility to prefixes.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.