|
FOROS PROFESIONALES WINDEV, WEBDEV y WINDEV Mobile |
| | | | | |
| Iniciado por guev, 06,jul. 2019 08:26 - 8 respuestas |
| |
| | | |
|
| |
Miembro registrado 80 mensajes |
|
| Publicado el 06,julio 2019 - 08:26 |
Bonjour,
Qui peux m'aider pour générer ce type de fichier XML ?
<?xml version="1.0" encoding="UTF-8"?> <entity_profile> <post id_post="1" is_featured="0" products="53-55" thumb = "Sans-titre-1.jpg" image ="prise-de-masse.jpg" added_by ="1" modified_by="1" enabled="1" datetime_added ="2019-04-07 13:45:38" datetime_modified="2019-04-07 17:04:35" datetime_active="" sort_order="1" click_number="5" likes ="0" is_customer="0" > <language iso_code ="fr" default="1"> <title><![CDATA[texte ici]]></title> <meta_title><![CDATA[texte ici]]></meta_title> <url_alias><![CDATA[texte ici]]></url_alias> <description><![CDATA[texte ici]]></short_description> <meta_keywords><![CDATA[texte ici]]></meta_keywords> <meta_description><![CDATA[texte ici]]></meta_description> </language> <category id_category="1"> </category> </post> </entity_profile>
En vous remeciant. Hervé
-- Hervé |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 299 mensajes |
|
| Publicado el 07,julio 2019 - 19:19 |
| Pourquoi ne pas l'écrire comme un fichier texte ? |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 281 mensajes |
|
| Publicado el 07,julio 2019 - 21:24 |
Bonsoir,
Regardez l’aide en ligne de PCSoft, il y a tout ce qu’il faut pour créer des fichiers XML. |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 80 mensajes |
|
| Publicado el 08,julio 2019 - 11:12 |
Bonjour
j'ai avancé sur mon projet. Voici le code
dDate est une Date = DateVersChaîne(DateSys(),"AAAAMMJJ") hHeure est une Heure = HeureVersChaîne(Maintenant(),"HHMMSS") MonXML est un xmlDocument <Description="blog-data"> XMLLang est un xmlNoeud, Description="blog-data.entity_profile.post.language" XMLLang..Type = XMLCDATA
SI HExécuteRequête(REQ_BlogPost) = Faux ALORS Erreur("Erreur d'initialisation de la requête" + RC + HErreurInfo()) RETOUR FIN
POUR TOUT REQ_BlogPost MonXML.entity_profile.post:id_post=REQ_BlogPost.id_prestablog_news MonXML.entity_profile.post:is_featured="0" MonXML.entity_profile.post:products="0" MonXML.entity_profile.post:thumb="0" MonXML.entity_profile.post:Image="0" MonXML.entity_profile.post:added_by="0" MonXML.entity_profile.post:modified_by="0" MonXML.entity_profile.post:enabled="0" MonXML.entity_profile.post:datetime_added="0" MonXML.entity_profile.post:datetime_modified="0" MonXML.entity_profile.post:datetime_active="0" MonXML.entity_profile.post:sort_order="0" MonXML.entity_profile.post:click_number="0" MonXML.entity_profile.post:likes="0" MonXML.entity_profile.post:is_customer="0" MonXML.entity_profile.post.language:iso_code="fr" MonXML.entity_profile.post.language:Default="1" XMLLang.title=REQ_BlogPost.title XMLLang.meta_title=REQ_BlogPost.meta_title XMLLang.url_alias=REQ_BlogPost.link_rewrite XMLLang.description=REQ_BlogPost.content XMLLang.short_description=Gauche(REQ_BlogPost.content, 50) XMLLang.meta_keywords=REQ_BlogPost.meta_keywords XMLLang.meta_description=REQ_BlogPost.meta_description MonXML.entity_profile.post.category:id_category="1" FIN
XMLSauve(MonXML, fRepExe()+"\ybc_blog_" + dDate + hHeure + ".xml", XMLMiseEnForme)
HAnnuleDéclaration(REQ_BlogPost)
J'ai une erreur à la ligne 5 Erreur à la ligne 5 du traitement Clic sur BTN_Exporter2. Le type du noeud ne peut être modifié après sa création.
Il faut que les données du noeud language soit de type XMLCDATA, exemple : <title><![CDATA[texte pour le titre]]></title>
Merci pour votre aide. hervé
-- Hervé |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 299 mensajes |
|
| Publicado el 08,julio 2019 - 12:34 |
Parce que vous changez le type du nœud XMLLang..Type = XMLCDATA
alors que le nœud a été créé à la ligne du dessus. Il faut donc créer le nœud directement avec le bon type |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 80 mensajes |
|
| Publicado el 08,julio 2019 - 21:59 |
Bonjour
Oui mais quelle est la syntaxe car je n'ai pas trouvé dans l'aide. J'ai essayé plusieurs choses mais ce n'est pas ça.
Merci pour votre aide.
-- Hervé |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 299 mensajes |
|
| Publicado el 08,julio 2019 - 22:56 |
Sous toute réserve parce que je gère mes XML autrement :
xmlLang est un xmlNoeud xmlLang..Description="blog-data.entity_profile.post.language" xmlLang..Type = XMLCDATA Ajoute(MonXML, xmlLang) |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 80 mensajes |
|
| Publicado el 09,julio 2019 - 03:50 |
Bonjour
Merci pour votre réponse mais ça ne fonctionne pas. Si quelqu'un à la solution je suis preneur.
Je trouve la doc très incomplète à ce niveau ou alors je regarde mal. Merci
-- HervéMensaje modificado, 09,julio 2019 - 03:52 |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 80 mensajes |
|
| Publicado el 09,julio 2019 - 04:37 |
Bonjour
Alors ça fonctionne avec ce code, j'ai bien la balise CDATA mais je n'ai plus les données. Le fichier XML est vide.
dDate est une Date = DateVersChaîne(DateSys(),"AAAAMMJJ") hHeure est une Heure = HeureVersChaîne(Maintenant(),"HHMMSS") MonXML est un xmlDocument <Description="blog-data">
sTitle est une chaîne MonXML.entity_profile.post.language = sTitle XMLTitle est un xmlNoeud XMLTitle..Type = XMLCDATA XMLTitle = sTitle XMLTitle..Nom = "title" Ajoute(MonXML.entity_profile.post.language, XMLTitle)
sMetaTitle est une chaîne MonXML.entity_profile.post.language = sMetaTitle XMLMetaTitle est un xmlNoeud XMLMetaTitle..Type = XMLCDATA XMLMetaTitle = sMetaTitle XMLMetaTitle..Nom = "meta_title" Ajoute(MonXML.entity_profile.post.language, XMLMetaTitle)
sUrlAlias est une chaîne MonXML.entity_profile.post.language = sUrlAlias XMLUrlAlias est un xmlNoeud XMLUrlAlias..Type = XMLCDATA XMLUrlAlias = sUrlAlias XMLUrlAlias..Nom = "url_alias" Ajoute(MonXML.entity_profile.post.language, XMLUrlAlias)
sDescription est une chaîne MonXML.entity_profile.post.language = sDescription XMLDescription est un xmlNoeud XMLDescription..Type = XMLCDATA XMLDescription = sDescription XMLDescription..Nom = "description" Ajoute(MonXML.entity_profile.post.language, XMLDescription)
sShortDescription est une chaîne MonXML.entity_profile.post.language = sShortDescription XMLShortDescription est un xmlNoeud XMLShortDescription..Type = XMLCDATA XMLShortDescription = sShortDescription XMLShortDescription..Nom = "short_description" Ajoute(MonXML.entity_profile.post.language, XMLShortDescription)
sMetaKeywords est une chaîne MonXML.entity_profile.post.language = sMetaKeywords XMLMetaKeywords est un xmlNoeud XMLMetaKeywords..Type = XMLCDATA XMLMetaKeywords = sMetaKeywords XMLMetaKeywords..Nom = "meta_keywords" Ajoute(MonXML.entity_profile.post.language, XMLMetaKeywords)
sMetaDescription est une chaîne MonXML.entity_profile.post.language = sMetaDescription XMLMetaDescription est un xmlNoeud XMLMetaDescription..Type = XMLCDATA XMLMetaDescription = sMetaDescription XMLMetaDescription..Nom = "meta_description" Ajoute(MonXML.entity_profile.post.language, XMLMetaDescription)
SI HExécuteRequête(REQ_BlogPost) = Faux ALORS Erreur("Erreur d'initialisation de la requête" + RC + HErreurInfo()) RETOUR FIN
POUR TOUT REQ_BlogPost MonXML.entity_profile.post:id_post=REQ_BlogPost.id_prestablog_news MonXML.entity_profile.post:is_featured="0" MonXML.entity_profile.post:products="0" MonXML.entity_profile.post:thumb="0" MonXML.entity_profile.post:Image="0" MonXML.entity_profile.post:added_by="0" MonXML.entity_profile.post:modified_by="0" MonXML.entity_profile.post:enabled="0" MonXML.entity_profile.post:datetime_added="0" MonXML.entity_profile.post:datetime_modified="0" MonXML.entity_profile.post:datetime_active="0" MonXML.entity_profile.post:sort_order="0" MonXML.entity_profile.post:click_number="0" MonXML.entity_profile.post:likes="0" MonXML.entity_profile.post:is_customer="0" MonXML.entity_profile.post.language:iso_code="fr" MonXML.entity_profile.post.language:Default="1" XMLTitle.title=REQ_BlogPost.title XMLMetaTitle.meta_title=REQ_BlogPost.meta_title XMLUrlAlias.url_alias=REQ_BlogPost.link_rewrite XMLDescription.description=REQ_BlogPost.content XMLShortDescription.short_description=Gauche(REQ_BlogPost.content, 50) XMLMetaKeywords.meta_keywords=REQ_BlogPost.meta_keywords XMLMetaDescription.meta_description=REQ_BlogPost.meta_description MonXML.entity_profile.post.category:id_category="1" FIN
XMLSauve(MonXML, fRepExe()+"\ybc_blog_" + dDate + hHeure + ".xml", XMLMiseEnForme)
HAnnuleDéclaration(REQ_BlogPost)
le fichier XML
<?xml version="1.0" encoding="UTF-8"?> <entity_profile> <post id_post="48" is_featured="0" products="0" thumb="0" image="0" added_by="0" modified_by="0" enabled="0" datetime_added="0" datetime_modified="0" datetime_active="0" sort_order="0" click_number="0" likes="0" is_customer="0"> <language iso_code="fr" default="1"> <title><![CDATA[]]></title> <meta_title><![CDATA[]]></meta_title> <url_alias><![CDATA[]]></url_alias> <description><![CDATA[]]></description> <short_description><![CDATA[]]></short_description> <meta_keywords><![CDATA[]]></meta_keywords> <meta_description><![CDATA[]]></meta_description> </language> <category id_category="1"/> </post> </entity_profile>
Et également, mon POUR TOUT sur ma requête ne fonctionne pas. Seule la dernière ligne de la requête est prise en compte. Merci pour votre aide.
-- HervéMensaje modificado, 09,julio 2019 - 04:40 |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|