Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NfXML
Message
De
11/07/2016 07:37:59
 
 
À
10/07/2016 16:24:15
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Titre:
Re: NfXML
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01638182
Message ID:
01638208
Vues:
160
>Hi Antonio, Namespaces are just name prefixes.. if I understand you correctly,
>putting a namespace attribute for each element would make element navigation
>( like myatt = oXml.root.root.branch.deep.a_58_x._attributes_.b_58_attrib )
>impossible , and casting properties is a xmldom parser job that must be done by
> specifying the xml schema. ( not yet implemented ).
>
>The goal was to achieve easy XML navigation and discovery, similar to the one XMLPAD ( the most amazing free xml tool ) offers in grid view ( see attached image ).

What I defend is that each object in the VFP final hierarchy should have a property, where its namespace would be stored (in the same way that the DOM associates every element and attribute to a single namespace).

I think that it would be better to get rid of prefixes in the process of serialization. They have only local meaning and can get too confusing to handle. For instance, root.root.a:branch and root.root.branch.deep.a:x share the same prefix but belong to different namespaces.

I tried 3 minor changes to your code that remove prefixes in element handling (but not in attribute, yet).

The first changes the instantiation of the parser as MSXML2.DOMDocument.6.0; the second sets the node name from its base name (unprefixed, that is); and the third looks for sibling elements that share the same name:
*	oXml = Createobject('microsoft.xmldom')
	oXml = Createobject('MSXML2.DOMDocument.6.0')

* ....

*		NombreNodo = conv2asc(.nodeName)
		NombreNodo = conv2asc(.baseName)

* ....

*			If .selectNodes('../'+.nodeName).Length =  1
			If .selectNodes('../*[local-name() = "'+ m.NombreNodo + '"]').Length =  1
This is far from being fully tested, but I think the resulting output is more clear (the object hierarchy is laid down in the attached image, for you to compare).

If you prefer to continue this discussion in VfpX, then I'll move along.
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform