PC SOFT
ONLINE REPOSITORY
FOR WINDEVWEBDEV AND WINDEV MOBILE

Home |  | Sign in | English US
WD Reading and writing in XML format - WD Lendo e escrevendo em formato XML
Published by Boller
- Unclassified
New features



Description
WD Reading and writing in XML format - WD Lendo e escrevendo em formato XML


// XML Document
XMLDoc is a xmlDocument
sTag is string
sSubChild is string
sRootChild is string

// Declare the root node
xmlCard is a xmlNode
xmlCard..Name = "CARD"

// Tag used for the fill operation
xmlSubTag is a xmlNode

// Browses the root
sTag = TreeGiveChild(TREE_REE_ROOT, Null, tvFirst)
WHILE sTag <> ""

// Reinitialization
ArrayDeleteAll(xmlSubTag..ChildNode)

// Define the node
xmlSubTag..Name = sTag

// Browses the first-level elements (starters, main dishes, dessert)
sRootChild = TreeGiveChild(TREE_REE_ROOT, sTag, tvFirst)
WHILE sRootChild <> ""

// Type of dish
xmlDishType is a xmlNode

// Adds the different dishes that make up the categories
sSubChild = TreeGiveChild(TREE_REE_ROOT, sTag + TAB + sRootChild, tvFirst)
WHILE sSubChild <> ""

// Adds the dish of the category by giving the name of the disk as text property
xmlDishType..Name = sRootChild
xmlDishType..Text = sSubChild
IF CBOX_ATTRIBUTES[1] = True THEN xmlDishType:attribute = sSubChild

Add(xmlSubTag, xmlDishType)

// Next sub-child
sSubChild = TreeGiveChild(TREE_REE_ROOT, sTag + TAB + sRootChild, tvNext)
END

sRootChild = TreeGiveChild(TREE_REE_ROOT, sTag, tvNext)
END

// Adds to the root
Add(xmlCard..ChildNode, xmlSubTag)

// Next RootChild
sTag = TreeGiveChild(TREE_REE_ROOT, Null, tvNext)
END

// Adds the root node to the document
Add(XMLDoc..RootNode, xmlCard)

// Save the XML
XMLSave(XMLDoc,"export.xml",XMLDocumentDefault)

// Assign the XML code to the two controls
CONTROL_RESULT = CompleteDir(fExeDir()) + "export.xml"
CTL_CODE_XML = CompleteDir(fExeDir()) + "export.


//--------------------------------------------------------------------------------------------------------------


// Variable
XMLDoc is a xmlDocument

// Open the XML file
XMLDoc = XMLOpen("export.xml")

// Browse the children of the STARTERS node
EntryNode is a xmlNode
FOR EACH EntryNode OF XMLDoc.CARD.STARTERS
TreeAdd(TREE_REE_REBUILD, XMLDoc.CARD.STARTERS..Name + TAB + EntryNode..Name + TAB + EntryNode..Text)
END

// Browse the children of the DISH node
MainNode is a xmlNode
FOR EACH MainNode OF XMLDoc.CARD.MAIN
TreeAdd(TREE_REE_REBUILD, XMLDoc.CARD.MAIN..Name + TAB + MainNode..Name + TAB + MainNode..Text)
END

// Browse the children of the DESSERT node
DessertNode is a xmlNode
FOR EACH DessertNode OF XMLDoc.CARD.DESSERT
TreeAdd(TREE_REE_REBUILD, XMLDoc.CARD.DESSERT..Name + TAB + DessertNode..Name + TAB + DessertNode..Text)
END
Illustrations, screen shots
none
none
User reviews
(To evaluate this resource, click 'Write a review')
No review or comment? Be the first one!